diff options
author | Stanislaw Gruszka <sgruszka@redhat.com> | 2011-10-24 16:49:25 +0200 |
---|---|---|
committer | Stanislaw Gruszka <sgruszka@redhat.com> | 2011-11-15 11:17:00 +0100 |
commit | 46bc8d4b0e73ac75de323646d75a2333f47b84c3 (patch) | |
tree | a11a89b1a3480135e1510aacd5909485ab2e5be7 /drivers/net | |
parent | e2ebc8337d116acdc25469ec8547ae665f50a4c1 (diff) | |
download | blackbird-obmc-linux-46bc8d4b0e73ac75de323646d75a2333f47b84c3.tar.gz blackbird-obmc-linux-46bc8d4b0e73ac75de323646d75a2333f47b84c3.zip |
iwlegacy: rename priv to il
Make code shorter.
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Diffstat (limited to 'drivers/net')
41 files changed, 5518 insertions, 5520 deletions
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c b/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c index 954aed4e7b34..b767979c5dbb 100644 --- a/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c +++ b/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c @@ -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:"); diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-led.c b/drivers/net/wireless/iwlegacy/iwl-3945-led.c index 69703b07bd69..53ec4637015e 100644 --- a/drivers/net/wireless/iwlegacy/iwl-3945-led.c +++ b/drivers/net/wireless/iwlegacy/iwl-3945-led.c @@ -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 = { diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-rs.c b/drivers/net/wireless/iwlegacy/iwl-3945-rs.c index d97f24bfc451..38f1b825af10 100644 --- a/drivers/net/wireless/iwlegacy/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlegacy/iwl-3945-rs.c @@ -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(); diff --git a/drivers/net/wireless/iwlegacy/iwl-3945.c b/drivers/net/wireless/iwlegacy/iwl-3945.c index 6d1740b051df..c9b5dcf446b4 100644 --- a/drivers/net/wireless/iwlegacy/iwl-3945.c +++ b/drivers/net/wireless/iwlegacy/iwl-3945.c @@ -108,7 +108,7 @@ static inline u8 il3945_get_prev_ieee_rate(u8 rate_index) * Use for only special debugging. This function is just a placeholder as-is, * you'll need to provide the special bits! ... * ... and set IL_EVT_DISABLE to 1. */ -void il3945_disable_events(struct il_priv *priv) +void il3945_disable_events(struct il_priv *il) { int i; u32 base; /* SRAM address of event log header */ @@ -164,27 +164,27 @@ void il3945_disable_events(struct il_priv *priv) 0x00000000, /* 1503 - 1472 */ }; - base = le32_to_cpu(priv->card_alive.log_event_table_ptr); + base = le32_to_cpu(il->card_alive.log_event_table_ptr); if (!il3945_hw_valid_rtc_data_addr(base)) { - IL_ERR(priv, "Invalid event log pointer 0x%08X\n", base); + IL_ERR(il, "Invalid event log pointer 0x%08X\n", base); return; } - disable_ptr = il_read_targ_mem(priv, base + (4 * sizeof(u32))); - array_size = il_read_targ_mem(priv, base + (5 * sizeof(u32))); + disable_ptr = il_read_targ_mem(il, base + (4 * sizeof(u32))); + array_size = il_read_targ_mem(il, base + (5 * sizeof(u32))); if (IL_EVT_DISABLE && (array_size == IL_EVT_DISABLE_SIZE)) { - IL_DEBUG_INFO(priv, "Disabling selected uCode log events at 0x%x\n", + IL_DEBUG_INFO(il, "Disabling selected uCode log events at 0x%x\n", disable_ptr); for (i = 0; i < IL_EVT_DISABLE_SIZE; i++) - il_write_targ_mem(priv, + il_write_targ_mem(il, disable_ptr + (i * sizeof(u32)), evt_disable[i]); } else { - IL_DEBUG_INFO(priv, "Selected uCode log events may be disabled\n"); - IL_DEBUG_INFO(priv, " by writing \"1\"s into disable bitmap\n"); - IL_DEBUG_INFO(priv, " in SRAM at 0x%x, size %d u32s\n", + IL_DEBUG_INFO(il, "Selected uCode log events may be disabled\n"); + IL_DEBUG_INFO(il, " by writing \"1\"s into disable bitmap\n"); + IL_DEBUG_INFO(il, " in SRAM at 0x%x, size %d u32s\n", disable_ptr, array_size); } @@ -240,11 +240,11 @@ static inline const char *il3945_get_tx_fail_reason(u32 status) * for A and B mode we need to overright prev * value */ -int il3945_rs_next_rate(struct il_priv *priv, int rate) +int il3945_rs_next_rate(struct il_priv *il, int rate) { int next_rate = il3945_get_prev_ieee_rate(rate); - switch (priv->band) { + switch (il->band) { case IEEE80211_BAND_5GHZ: if (rate == IL_RATE_12M_INDEX) next_rate = IL_RATE_9M_INDEX; @@ -252,8 +252,8 @@ int il3945_rs_next_rate(struct il_priv *priv, int rate) next_rate = IL_RATE_6M_INDEX; break; case IEEE80211_BAND_2GHZ: - if (!(priv->_3945.sta_supp_rates & IL_OFDM_RATES_MASK) && - il_is_associated(priv, IL_RXON_CTX_BSS)) { + if (!(il->_3945.sta_supp_rates & IL_OFDM_RATES_MASK) && + il_is_associated(il, IL_RXON_CTX_BSS)) { if (rate == IL_RATE_11M_INDEX) next_rate = IL_RATE_5M_INDEX; } @@ -274,10 +274,10 @@ int il3945_rs_next_rate(struct il_priv *priv, int rate) * 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 il3945_tx_queue_reclaim(struct il_priv *priv, +static void il3945_tx_queue_reclaim(struct il_priv *il, int txq_id, int index) { - struct il_tx_queue *txq = &priv->txq[txq_id]; + struct il_tx_queue *txq = &il->txq[txq_id]; struct il_queue *q = &txq->q; struct il_tx_info *tx_info; @@ -288,28 +288,28 @@ static void il3945_tx_queue_reclaim(struct il_priv *priv, q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd)) { tx_info = &txq->txb[txq->q.read_ptr]; - ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb); + ieee80211_tx_status_irqsafe(il->hw, tx_info->skb); tx_info->skb = NULL; - priv->cfg->ops->lib->txq_free_tfd(priv, txq); + il->cfg->ops->lib->txq_free_tfd(il, txq); } if (il_queue_space(q) > q->low_mark && (txq_id >= 0) && (txq_id != IWL39_CMD_QUEUE_NUM) && - priv->mac80211_registered) - il_wake_queue(priv, txq); + il->mac80211_registered) + il_wake_queue(il, txq); } /** * il3945_rx_reply_tx - Handle Tx response */ -static void il3945_rx_reply_tx(struct il_priv *priv, +static void il3945_rx_reply_tx(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); int txq_id = SEQ_TO_QUEUE(sequence); int index = SEQ_TO_INDEX(sequence); - struct il_tx_queue *txq = &priv->txq[txq_id]; + struct il_tx_queue *txq = &il->txq[txq_id]; struct ieee80211_tx_info *info; struct il3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; u32 status = le32_to_cpu(tx_resp->status); @@ -317,7 +317,7 @@ static void il3945_rx_reply_tx(struct il_priv *priv, int fail; if ((index >= txq->q.n_bd) || (il_queue_used(&txq->q, index) == 0)) { - IL_ERR(priv, "Read index for DMA queue txq_id (%d) index %d " + IL_ERR(il, "Read index for DMA queue txq_id (%d) index %d " "is out of range [0-%d] %d %d\n", txq_id, index, txq->q.n_bd, txq->q.write_ptr, txq->q.read_ptr); @@ -342,15 +342,15 @@ static void il3945_rx_reply_tx(struct il_priv *priv, info->flags |= ((status & TX_STATUS_MSK) == TX_STATUS_SUCCESS) ? IEEE80211_TX_STAT_ACK : 0; - IL_DEBUG_TX(priv, "Tx queue %d Status %s (0x%08x) plcp rate %d retries %d\n", + IL_DEBUG_TX(il, "Tx queue %d Status %s (0x%08x) plcp rate %d retries %d\n", txq_id, il3945_get_tx_fail_reason(status), status, tx_resp->rate, tx_resp->failure_frame); - IL_DEBUG_TX_REPLY(priv, "Tx queue reclaim %d\n", index); - il3945_tx_queue_reclaim(priv, txq_id, index); + IL_DEBUG_TX_REPLY(il, "Tx queue reclaim %d\n", index); + il3945_tx_queue_reclaim(il, txq_id, index); if (status & TX_ABORT_REQUIRED_MSK) - IL_ERR(priv, "TODO: Implement Tx ABORT REQUIRED!!!\n"); + IL_ERR(il, "TODO: Implement Tx ABORT REQUIRED!!!\n"); } @@ -363,7 +363,7 @@ static void il3945_rx_reply_tx(struct il_priv *priv, * *****************************************************************************/ #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS -static void il3945_accumulative_statistics(struct il_priv *priv, +static void il3945_accumulative_statistics(struct il_priv *il, __le32 *stats) { int i; @@ -371,10 +371,10 @@ static void il3945_accumulative_statistics(struct il_priv *priv, u32 *accum_stats; u32 *delta, *max_delta; - prev_stats = (__le32 *)&priv->_3945.statistics; - accum_stats = (u32 *)&priv->_3945.accum_statistics; - delta = (u32 *)&priv->_3945.delta_statistics; - max_delta = (u32 *)&priv->_3945.max_delta; + prev_stats = (__le32 *)&il->_3945.statistics; + accum_stats = (u32 *)&il->_3945.accum_statistics; + delta = (u32 *)&il->_3945.delta_statistics; + max_delta = (u32 *)&il->_3945.max_delta; for (i = sizeof(__le32); i < sizeof(struct il3945_notif_statistics); i += sizeof(__le32), stats++, prev_stats++, delta++, @@ -389,29 +389,29 @@ static void il3945_accumulative_statistics(struct il_priv *priv, } /* reset accumulative statistics for "no-counter" type statistics */ - priv->_3945.accum_statistics.general.temperature = - priv->_3945.statistics.general.temperature; - priv->_3945.accum_statistics.general.ttl_timestamp = - priv->_3945.statistics.general.ttl_timestamp; + il->_3945.accum_statistics.general.temperature = + il->_3945.statistics.general.temperature; + il->_3945.accum_statistics.general.ttl_timestamp = + il->_3945.statistics.general.ttl_timestamp; } #endif -void il3945_hw_rx_statistics(struct il_priv *priv, +void il3945_hw_rx_statistics(struct il_priv *il, struct il_rx_mem_buffer *rxb) { struct il_rx_packet *pkt = rxb_addr(rxb); - IL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n", + IL_DEBUG_RX(il, "Statistics notification received (%d vs %d).\n", (int)sizeof(struct il3945_notif_statistics), le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK); #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS - il3945_accumulative_statistics(priv, (__le32 *)&pkt->u.raw); + il3945_accumulative_statistics(il, (__le32 *)&pkt->u.raw); #endif - memcpy(&priv->_3945.statistics, pkt->u.raw, sizeof(priv->_3945.statistics)); + memcpy(&il->_3945.statistics, pkt->u.raw, sizeof(il->_3945.statistics)); } -void il3945_reply_statistics(struct il_priv *priv, +void il3945_reply_statistics(struct il_priv *il, struct il_rx_mem_buffer *rxb) { struct il_rx_packet *pkt = rxb_addr(rxb); @@ -419,16 +419,16 @@ void il3945_reply_statistics(struct il_priv *priv, if (le32_to_cpu(*flag) & UCODE_STATISTICS_CLEAR_MSK) { #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS - memset(&priv->_3945.accum_statistics, 0, + memset(&il->_3945.accum_statistics, 0, sizeof(struct il3945_notif_statistics)); - memset(&priv->_3945.delta_statistics, 0, + memset(&il->_3945.delta_statistics, 0, sizeof(struct il3945_notif_statistics)); - memset(&priv->_3945.max_delta, 0, + memset(&il->_3945.max_delta, 0, sizeof(struct il3945_notif_statistics)); #endif - IL_DEBUG_RX(priv, "Statistics have been cleared\n"); + IL_DEBUG_RX(il, "Statistics have been cleared\n"); } - il3945_hw_rx_statistics(priv, rxb); + il3945_hw_rx_statistics(il, rxb); } @@ -439,24 +439,24 @@ void il3945_reply_statistics(struct il_priv *priv, ******************************************************************************/ /* This is necessary only for a number of statistics, see the caller. */ -static int il3945_is_network_packet(struct il_priv *priv, +static int il3945_is_network_packet(struct il_priv *il, struct ieee80211_hdr *header) { /* Filter incoming packets to determine if they are targeted toward * this network, discarding packets coming from ourselves */ - switch (priv->iw_mode) { + switch (il->iw_mode) { case NL80211_IFTYPE_ADHOC: /* Header: Dest. | Source | BSSID */ /* packets to our IBSS update information */ - return !compare_ether_addr(header->addr3, priv->bssid); + return !compare_ether_addr(header->addr3, il->bssid); case NL80211_IFTYPE_STATION: /* Header: Dest. | AP{BSSID} | Source */ /* packets to our IBSS update information */ - return !compare_ether_addr(header->addr2, priv->bssid); + return !compare_ether_addr(header->addr2, il->bssid); default: return 1; } } -static void il3945_pass_packet_to_mac80211(struct il_priv *priv, +static void il3945_pass_packet_to_mac80211(struct il_priv *il, struct il_rx_mem_buffer *rxb, struct ieee80211_rx_status *stats) { @@ -470,43 +470,43 @@ static void il3945_pass_packet_to_mac80211(struct il_priv *priv, /* We received data from the HW, so stop the watchdog */ if (unlikely(len + IWL39_RX_FRAME_SIZE > - PAGE_SIZE << priv->hw_params.rx_page_order)) { - IL_DEBUG_DROP(priv, "Corruption detected!\n"); + PAGE_SIZE << il->hw_params.rx_page_order)) { + IL_DEBUG_DROP(il, "Corruption detected!\n"); return; } /* 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; } skb = dev_alloc_skb(128); if (!skb) { - IL_ERR(priv, "dev_alloc_skb failed\n"); + IL_ERR(il, "dev_alloc_skb failed\n"); return; } if (!il3945_mod_params.sw_crypto) - il_set_decrypted_flag(priv, + il_set_decrypted_flag(il, (struct ieee80211_hdr *)rxb_addr(rxb), le32_to_cpu(rx_end->status), stats); skb_add_rx_frag(skb, 0, rxb->page, (void *)rx_hdr->payload - (void *)pkt, len); - 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; } #define IL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6) -static void il3945_rx_reply_rx(struct il_priv *priv, +static void il3945_rx_reply_rx(struct il_priv *il, struct il_rx_mem_buffer *rxb) { struct ieee80211_hdr *header; @@ -539,14 +539,14 @@ static void il3945_rx_reply_rx(struct il_priv *priv, rx_status.flag |= RX_FLAG_SHORTPRE; if ((unlikely(rx_stats->phy_count > 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", rx_stats->phy_count); return; } if (!(rx_end->status & RX_RES_STATUS_NO_CRC32_ERROR) || !(rx_end->status & RX_RES_STATUS_NO_RXE_OVERFLOW)) { - IL_DEBUG_RX(priv, "Bad CRC or FIFO: 0x%08X.\n", rx_end->status); + IL_DEBUG_RX(il, "Bad CRC or FIFO: 0x%08X.\n", rx_end->status); return; } @@ -555,34 +555,34 @@ static void il3945_rx_reply_rx(struct il_priv *priv, /* Convert 3945's rssi indicator to dBm */ rx_status.signal = rx_stats->rssi - IWL39_RSSI_OFFSET; - IL_DEBUG_STATS(priv, "Rssi %d sig_avg %d noise_diff %d\n", + IL_DEBUG_STATS(il, "Rssi %d sig_avg %d noise_diff %d\n", rx_status.signal, rx_stats_sig_avg, rx_stats_noise_diff); header = (struct ieee80211_hdr *)IL_RX_DATA(pkt); - network_packet = il3945_is_network_packet(priv, header); + network_packet = il3945_is_network_packet(il, header); - IL_DEBUG_STATS_LIMIT(priv, "[%c] %d RSSI:%d Signal:%u, Rate:%u\n", + IL_DEBUG_STATS_LIMIT(il, "[%c] %d RSSI:%d Signal:%u, Rate:%u\n", network_packet ? '*' : ' ', le16_to_cpu(rx_hdr->channel), rx_status.signal, rx_status.signal, rx_status.rate_idx); - il_dbg_log_rx_data_frame(priv, le16_to_cpu(rx_hdr->len), + il_dbg_log_rx_data_frame(il, le16_to_cpu(rx_hdr->len), header); if (network_packet) { - priv->_3945.last_beacon_time = + il->_3945.last_beacon_time = le32_to_cpu(rx_end->beacon_timestamp); - priv->_3945.last_tsf = le64_to_cpu(rx_end->timestamp); - priv->_3945.last_rx_rssi = rx_status.signal; + il->_3945.last_tsf = le64_to_cpu(rx_end->timestamp); + il->_3945.last_rx_rssi = rx_status.signal; } - il3945_pass_packet_to_mac80211(priv, rxb, &rx_status); + il3945_pass_packet_to_mac80211(il, rxb, &rx_status); } -int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *priv, +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) { @@ -600,7 +600,7 @@ int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *priv, count = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags)); if ((count >= NUM_TFD_CHUNKS) || (count < 0)) { - IL_ERR(priv, "Error can not send more than %d chunks\n", + IL_ERR(il, "Error can not send more than %d chunks\n", NUM_TFD_CHUNKS); return -EINVAL; } @@ -621,19 +621,19 @@ int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *priv, * * Does NOT advance any indexes */ -void il3945_hw_txq_free_tfd(struct il_priv *priv, struct il_tx_queue *txq) +void il3945_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq) { struct il3945_tfd *tfd_tmp = (struct il3945_tfd *)txq->tfds; int index = txq->q.read_ptr; struct il3945_tfd *tfd = &tfd_tmp[index]; - struct pci_dev *dev = priv->pci_dev; + struct pci_dev *dev = il->pci_dev; int i; int counter; /* sanity check */ counter = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags)); if (counter > NUM_TFD_CHUNKS) { - IL_ERR(priv, "Too many chunks: %i\n", counter); + IL_ERR(il, "Too many chunks: %i\n", counter); /* @todo issue fatal error, it is quite serious situation */ return; } @@ -669,13 +669,13 @@ void il3945_hw_txq_free_tfd(struct il_priv *priv, struct il_tx_queue *txq) * il3945_hw_build_tx_cmd_rate - Add rate portion to TX_CMD: * */ -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) { - u16 hw_value = ieee80211_get_tx_rate(priv->hw, info)->hw_value; + u16 hw_value = ieee80211_get_tx_rate(il->hw, info)->hw_value; u16 rate_index = min(hw_value & 0xffff, IL_RATE_COUNT_3945); u16 rate_mask; int rate; @@ -718,13 +718,13 @@ void il3945_hw_build_tx_cmd_rate(struct il_priv *priv, /* CCK */ tx_cmd->supp_rates[1] = (rate_mask & 0xF); - IL_DEBUG_RATE(priv, "Tx sta id: %d, rate: %d (plcp), flags: 0x%4X " + IL_DEBUG_RATE(il, "Tx sta id: %d, rate: %d (plcp), flags: 0x%4X " "cck/ofdm mask: 0x%x/0x%x\n", sta_id, tx_cmd->rate, le32_to_cpu(tx_cmd->tx_flags), tx_cmd->supp_rates[1], tx_cmd->supp_rates[0]); } -static u8 il3945_sync_sta(struct il_priv *priv, int sta_id, u16 tx_rate) +static u8 il3945_sync_sta(struct il_priv *il, int sta_id, u16 tx_rate) { unsigned long flags_spin; struct il_station_entry *station; @@ -732,52 +732,52 @@ static u8 il3945_sync_sta(struct il_priv *priv, int sta_id, u16 tx_rate) if (sta_id == IL_INVALID_STATION) return IL_INVALID_STATION; - spin_lock_irqsave(&priv->sta_lock, flags_spin); - station = &priv->stations[sta_id]; + spin_lock_irqsave(&il->sta_lock, flags_spin); + station = &il->stations[sta_id]; station->sta.sta.modify_mask = STA_MODIFY_TX_RATE_MSK; station->sta.rate_n_flags = cpu_to_le16(tx_rate); station->sta.mode = STA_CONTROL_MODIFY_MSK; - il_send_add_sta(priv, &station->sta, CMD_ASYNC); - spin_unlock_irqrestore(&priv->sta_lock, flags_spin); + il_send_add_sta(il, &station->sta, CMD_ASYNC); + spin_unlock_irqrestore(&il->sta_lock, flags_spin); - IL_DEBUG_RATE(priv, "SCALE sync station %d to rate %d\n", + IL_DEBUG_RATE(il, "SCALE sync station %d to rate %d\n", sta_id, tx_rate); return sta_id; } -static void il3945_set_pwr_vmain(struct il_priv *priv) +static void il3945_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_poll_bit(priv, CSR_GPIO_IN, + il_poll_bit(il, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VAUX_PWR_SRC, CSR_GPIO_IN_BIT_AUX_POWER, 5000); } */ - 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); - il_poll_bit(priv, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VMAIN_PWR_SRC, + il_poll_bit(il, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VMAIN_PWR_SRC, CSR_GPIO_IN_BIT_AUX_POWER, 5000); /* uS */ } -static int il3945_rx_init(struct il_priv *priv, struct il_rx_queue *rxq) +static int il3945_rx_init(struct il_priv *il, struct il_rx_queue *rxq) { - il_write_direct32(priv, FH39_RCSR_RBD_BASE(0), rxq->bd_dma); - il_write_direct32(priv, FH39_RCSR_RPTR_ADDR(0), + il_write_direct32(il, FH39_RCSR_RBD_BASE(0), rxq->bd_dma); + il_write_direct32(il, FH39_RCSR_RPTR_ADDR(0), rxq->rb_stts_dma); - il_write_direct32(priv, FH39_RCSR_WPTR(0), 0); - il_write_direct32(priv, FH39_RCSR_CONFIG(0), + il_write_direct32(il, FH39_RCSR_WPTR(0), 0); + il_write_direct32(il, FH39_RCSR_CONFIG(0), FH39_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE | FH39_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE | FH39_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN | @@ -788,32 +788,32 @@ static int il3945_rx_init(struct il_priv *priv, struct il_rx_queue *rxq) FH39_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH); /* fake read to flush all prev I/O */ - il_read_direct32(priv, FH39_RSSR_CTRL); + il_read_direct32(il, FH39_RSSR_CTRL); return 0; } -static int il3945_tx_reset(struct il_priv *priv) +static int il3945_tx_reset(struct il_priv *il) { /* bypass mode */ - il_write_prph(priv, ALM_SCD_MODE_REG, 0x2); + il_write_prph(il, ALM_SCD_MODE_REG, 0x2); /* RA 0 is active */ - il_write_prph(priv, ALM_SCD_ARASTAT_REG, 0x01); + il_write_prph(il, ALM_SCD_ARASTAT_REG, 0x01); /* all 6 fifo are active */ - il_write_prph(priv, ALM_SCD_TXFACT_REG, 0x3f); + il_write_prph(il, ALM_SCD_TXFACT_REG, 0x3f); - il_write_prph(priv, ALM_SCD_SBYP_MODE_1_REG, 0x010000); - il_write_prph(priv, ALM_SCD_SBYP_MODE_2_REG, 0x030002); - il_write_prph(priv, ALM_SCD_TXF4MF_REG, 0x000004); - il_write_prph(priv, ALM_SCD_TXF5MF_REG, 0x000005); + il_write_prph(il, ALM_SCD_SBYP_MODE_1_REG, 0x010000); + il_write_prph(il, ALM_SCD_SBYP_MODE_2_REG, 0x030002); + il_write_prph(il, ALM_SCD_TXF4MF_REG, 0x000004); + il_write_prph(il, ALM_SCD_TXF5MF_REG, 0x000005); - il_write_direct32(priv, FH39_TSSR_CBB_BASE, - priv->_3945.shared_phys); + il_write_direct32(il, FH39_TSSR_CBB_BASE, + il->_3945.shared_phys); - il_write_direct32(priv, FH39_TSSR_MSG_CONFIG, + il_write_direct32(il, FH39_TSSR_MSG_CONFIG, FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON | FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON | FH39_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B | @@ -831,31 +831,31 @@ static int il3945_tx_reset(struct il_priv *priv) * * Destroys all DMA structures and initialize them again */ -static int il3945_txq_ctx_reset(struct il_priv *priv) +static int il3945_txq_ctx_reset(struct il_priv *il) { int rc; int txq_id, slots_num; - il3945_hw_txq_ctx_free(priv); + il3945_hw_txq_ctx_free(il); /* allocate tx queue structure */ - rc = il_alloc_txq_mem(priv); + rc = il_alloc_txq_mem(il); if (rc) return rc; /* Tx CMD queue */ - rc = il3945_tx_reset(priv); + rc = il3945_tx_reset(il); if (rc) goto error; /* Tx queue(s) */ - for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { + for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) { slots_num = (txq_id == IWL39_CMD_QUEUE_NUM) ? TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; - rc = il_tx_queue_init(priv, &priv->txq[txq_id], + rc = il_tx_queue_init(il, &il->txq[txq_id], slots_num, txq_id); if (rc) { - IL_ERR(priv, "Tx %d queue init failed\n", txq_id); + IL_ERR(il, "Tx %d queue init failed\n", txq_id); goto error; } } @@ -863,7 +863,7 @@ static int il3945_txq_ctx_reset(struct il_priv *priv) return rc; error: - il3945_hw_txq_ctx_free(priv); + il3945_hw_txq_ctx_free(il); return rc; } @@ -873,127 +873,127 @@ static int il3945_txq_ctx_reset(struct il_priv *priv) * (e.g. after platform boot, or shutdown via il_apm_stop()) * NOTE: This does not load uCode nor start the embedded processor */ -static int il3945_apm_init(struct il_priv *priv) +static int il3945_apm_init(struct il_priv *il) { - int ret = il_apm_init(priv); + int ret = il_apm_init(il); /* Clear APMG (NIC's internal power management) interrupts */ - il_write_prph(priv, APMG_RTC_INT_MSK_REG, 0x0); - il_write_prph(priv, APMG_RTC_INT_STT_REG, 0xFFFFFFFF); + il_write_prph(il, APMG_RTC_INT_MSK_REG, 0x0); + il_write_prph(il, APMG_RTC_INT_STT_REG, 0xFFFFFFFF); /* Reset radio chip */ - il_set_bits_prph(priv, APMG_PS_CTRL_REG, + il_set_bits_prph(il, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_RESET_REQ); udelay(5); - il_clear_bits_prph(priv, APMG_PS_CTRL_REG, + il_clear_bits_prph(il, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_RESET_REQ); return ret; } -static void il3945_nic_config(struct il_priv *priv) +static void il3945_nic_config(struct il_priv *il) { - struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; + struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; unsigned long flags; - u8 rev_id = priv->pci_dev->revision; + u8 rev_id = il->pci_dev->revision; - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); /* Determine HW type */ - IL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n", rev_id); + IL_DEBUG_INFO(il, "HW Revision ID = 0x%X\n", rev_id); if (rev_id & PCI_CFG_REV_ID_BIT_RTP) - IL_DEBUG_INFO(priv, "RTP type\n"); + IL_DEBUG_INFO(il, "RTP type\n"); else if (rev_id & PCI_CFG_REV_ID_BIT_BASIC_SKU) { - IL_DEBUG_INFO(priv, "3945 RADIO-MB type\n"); - il_set_bit(priv, CSR_HW_IF_CONFIG_REG, + IL_DEBUG_INFO(il, "3945 RADIO-MB type\n"); + il_set_bit(il, CSR_HW_IF_CONFIG_REG, CSR39_HW_IF_CONFIG_REG_BIT_3945_MB); } else { - IL_DEBUG_INFO(priv, "3945 RADIO-MM type\n"); - il_set_bit(priv, CSR_HW_IF_CONFIG_REG, + IL_DEBUG_INFO(il, "3945 RADIO-MM type\n"); + il_set_bit(il, CSR_HW_IF_CONFIG_REG, CSR39_HW_IF_CONFIG_REG_BIT_3945_MM); } if (EEPROM_SKU_CAP_OP_MODE_MRC == eeprom->sku_cap) { - IL_DEBUG_INFO(priv, "SKU OP mode is mrc\n"); - il_set_bit(priv, CSR_HW_IF_CONFIG_REG, + IL_DEBUG_INFO(il, "SKU OP mode is mrc\n"); + il_set_bit(il, CSR_HW_IF_CONFIG_REG, CSR39_HW_IF_CONFIG_REG_BIT_SKU_MRC); } else - IL_DEBUG_INFO(priv, "SKU OP mode is basic\n"); + IL_DEBUG_INFO(il, "SKU OP mode is basic\n"); if ((eeprom->board_revision & 0xF0) == 0xD0) { - IL_DEBUG_INFO(priv, "3945ABG revision is 0x%X\n", + IL_DEBUG_INFO(il, "3945ABG revision is 0x%X\n", eeprom->board_revision); - il_set_bit(priv, CSR_HW_IF_CONFIG_REG, + il_set_bit(il, CSR_HW_IF_CONFIG_REG, CSR39_HW_IF_CONFIG_REG_BIT_BOARD_TYPE); } else { - IL_DEBUG_INFO(priv, "3945ABG revision is 0x%X\n", + IL_DEBUG_INFO(il, "3945ABG revision is 0x%X\n", eeprom->board_revision); - il_clear_bit(priv, CSR_HW_IF_CONFIG_REG, + il_clear_bit(il, CSR_HW_IF_CONFIG_REG, CSR39_HW_IF_CONFIG_REG_BIT_BOARD_TYPE); } if (eeprom->almgor_m_version <= 1) { - il_set_bit(priv, CSR_HW_IF_CONFIG_REG, + il_set_bit(il, CSR_HW_IF_CONFIG_REG, CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A); - IL_DEBUG_INFO(priv, "Card M type A version is 0x%X\n", + IL_DEBUG_INFO(il, "Card M type A version is 0x%X\n", eeprom->almgor_m_version); } else { - IL_DEBUG_INFO(priv, "Card M type B version is 0x%X\n", + IL_DEBUG_INFO(il, "Card M type B version is 0x%X\n", eeprom->almgor_m_version); - il_set_bit(priv, CSR_HW_IF_CONFIG_REG, + il_set_bit(il, CSR_HW_IF_CONFIG_REG, CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B); } - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&il->lock, flags); if (eeprom->sku_cap & EEPROM_SKU_CAP_SW_RF_KILL_ENABLE) - IL_DEBUG_RF_KILL(priv, "SW RF KILL supported in EEPROM.\n"); + IL_DEBUG_RF_KILL(il, "SW RF KILL supported in EEPROM.\n"); if (eeprom->sku_cap & EEPROM_SKU_CAP_HW_RF_KILL_ENABLE) - IL_DEBUG_RF_KILL(priv, "HW RF KILL supported in EEPROM.\n"); + IL_DEBUG_RF_KILL(il, "HW RF KILL supported in EEPROM.\n"); } -int il3945_hw_nic_init(struct il_priv *priv) +int il3945_hw_nic_init(struct il_priv *il) { int rc; unsigned long flags; - struct il_rx_queue *rxq = &priv->rxq; + struct il_rx_queue *rxq = &il->rxq; - spin_lock_irqsave(&priv->lock, flags); - priv->cfg->ops->lib->apm_ops.init(priv); - spin_unlock_irqrestore(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); + il->cfg->ops->lib->apm_ops.init(il); + spin_unlock_irqrestore(&il->lock, flags); - il3945_set_pwr_vmain(priv); + il3945_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) { - rc = il_rx_queue_alloc(priv); + rc = il_rx_queue_alloc(il); if (rc) { - IL_ERR(priv, "Unable to initialize Rx queue\n"); + IL_ERR(il, "Unable to initialize Rx queue\n"); return -ENOMEM; } } else - il3945_rx_queue_reset(priv, rxq); + il3945_rx_queue_reset(il, rxq); - il3945_rx_replenish(priv); + il3945_rx_replenish(il); - il3945_rx_init(priv, rxq); + il3945_rx_init(il, rxq); /* Look at using this instead: rxq->need_update = 1; - il_rx_queue_update_write_ptr(priv, rxq); + il_rx_queue_update_write_ptr(il, rxq); */ - il_write_direct32(priv, FH39_RCSR_WPTR(0), rxq->write & ~7); + il_write_direct32(il, FH39_RCSR_WPTR(0), rxq->write & ~7); - rc = il3945_txq_ctx_reset(priv); + rc = il3945_txq_ctx_reset(il); if (rc) return rc; - set_bit(STATUS_INIT, &priv->status); + set_bit(STATUS_INIT, &il->status); return 0; } @@ -1003,40 +1003,40 @@ int il3945_hw_nic_init(struct il_priv *priv) * * Destroy all TX DMA queues and structures */ -void il3945_hw_txq_ctx_free(struct il_priv *priv) +void il3945_hw_txq_ctx_free(struct il_priv *il) { int txq_id; /* Tx queues */ - if (priv->txq) - for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; + if (il->txq) + for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) if (txq_id == IWL39_CMD_QUEUE_NUM) - il_cmd_queue_free(priv); + il_cmd_queue_free(il); else - il_tx_queue_free(priv, txq_id); + il_tx_queue_free(il, txq_id); /* free tx queue structure */ - il_txq_mem(priv); + il_txq_mem(il); } -void il3945_hw_txq_ctx_stop(struct il_priv *priv) +void il3945_hw_txq_ctx_stop(struct il_priv *il) { int txq_id; /* stop SCD */ - il_write_prph(priv, ALM_SCD_MODE_REG, 0); - il_write_prph(priv, ALM_SCD_TXFACT_REG, 0); + il_write_prph(il, ALM_SCD_MODE_REG, 0); + il_write_prph(il, ALM_SCD_TXFACT_REG, 0); /* reset TFD queues */ - for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { - il_write_direct32(priv, FH39_TCSR_CONFIG(txq_id), 0x0); - il_poll_direct_bit(priv, FH39_TSSR_TX_STATUS, + for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) { + il_write_direct32(il, FH39_TCSR_CONFIG(txq_id), 0x0); + il_poll_direct_bit(il, FH39_TSSR_TX_STATUS, FH39_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(txq_id), 1000); } - il3945_hw_txq_ctx_free(priv); + il3945_hw_txq_ctx_free(il); } /** @@ -1056,36 +1056,36 @@ static inline int il3945_hw_reg_temp_out_of_range(int temperature) return ((temperature < -260) || (temperature > 25)) ? 1 : 0; } -int il3945_hw_get_temperature(struct il_priv *priv) +int il3945_hw_get_temperature(struct il_priv *il) { - return il_read32(priv, CSR_UCODE_DRV_GP2); + return il_read32(il, CSR_UCODE_DRV_GP2); } /** * il3945_hw_reg_txpower_get_temperature * get the current temperature by reading from NIC */ -static int il3945_hw_reg_txpower_get_temperature(struct il_priv *priv) +static int il3945_hw_reg_txpower_get_temperature(struct il_priv *il) { - struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; + struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; int temperature; - temperature = il3945_hw_get_temperature(priv); + temperature = il3945_hw_get_temperature(il); /* driver's okay range is -260 to +25. * human readable okay range is 0 to +285 */ - IL_DEBUG_INFO(priv, "Temperature: %d\n", temperature + IL_TEMP_CONVERT); + IL_DEBUG_INFO(il, "Temperature: %d\n", temperature + IL_TEMP_CONVERT); /* handle insane temp reading */ if (il3945_hw_reg_temp_out_of_range(temperature)) { - IL_ERR(priv, "Error bad temperature value %d\n", temperature); + IL_ERR(il, "Error bad temperature value %d\n", temperature); /* if really really hot(?), * substitute the 3rd band/group's temp measured at factory */ - if (priv->last_temperature > 100) + if (il->last_temperature > 100) temperature = eeprom->groups[2].temperature; else /* else use most recent "sane" value from driver */ - temperature = priv->last_temperature; + temperature = il->last_temperature; } return temperature; /* raw, not "human readable" */ @@ -1102,33 +1102,33 @@ static int il3945_hw_reg_txpower_get_temperature(struct il_priv *priv) * records new temperature in tx_mgr->temperature. * replaces tx_mgr->last_temperature *only* if calib needed * (assumes caller will actually do the calibration!). */ -static int il3945_is_temp_calib_needed(struct il_priv *priv) +static int il3945_is_temp_calib_needed(struct il_priv *il) { int temp_diff; - priv->temperature = il3945_hw_reg_txpower_get_temperature(priv); - temp_diff = priv->temperature - priv->last_temperature; + il->temperature = il3945_hw_reg_txpower_get_temperature(il); + temp_diff = il->temperature - il->last_temperature; /* get absolute value */ if (temp_diff < 0) { - IL_DEBUG_POWER(priv, "Getting cooler, delta %d,\n", temp_diff); + IL_DEBUG_POWER(il, "Getting cooler, delta %d,\n", temp_diff); temp_diff = -temp_diff; } else if (temp_diff == 0) - IL_DEBUG_POWER(priv, "Same temp,\n"); + IL_DEBUG_POWER(il, "Same temp,\n"); else - IL_DEBUG_POWER(priv, "Getting warmer, delta %d,\n", temp_diff); + IL_DEBUG_POWER(il, "Getting warmer, delta %d,\n", temp_diff); /* if we don't need calibration, *don't* update last_temperature */ if (temp_diff < IL_TEMPERATURE_LIMIT_TIMER) { - IL_DEBUG_POWER(priv, "Timed thermal calib not needed\n"); + IL_DEBUG_POWER(il, "Timed thermal calib not needed\n"); return 0; } - IL_DEBUG_POWER(priv, "Timed thermal calib needed\n"); + IL_DEBUG_POWER(il, "Timed thermal calib needed\n"); /* assume that caller will actually do calib ... * update the "last temperature" value */ - priv->last_temperature = priv->temperature; + il->last_temperature = il->temperature; return 1; } @@ -1317,7 +1317,7 @@ static inline u8 il3945_hw_reg_fix_power_index(int index) * Set (in our channel info database) the direct scan Tx power for 1 Mbit (CCK) * or 6 Mbit (OFDM) rates. */ -static void il3945_hw_reg_set_scan_power(struct il_priv *priv, u32 scan_tbl_index, +static void il3945_hw_reg_set_scan_power(struct il_priv *il, u32 scan_tbl_index, s32 rate_index, const s8 *clip_pwrs, struct il_channel_info *ch_info, int band_index) @@ -1333,7 +1333,7 @@ static void il3945_hw_reg_set_scan_power(struct il_priv *priv, u32 scan_tbl_inde * based on eeprom channel data) for this channel. */ power = min(ch_info->scan_power, clip_pwrs[IL_RATE_6M_INDEX_TABLE]); - power = min(power, priv->tx_power_user_lmt); + power = min(power, il->tx_power_user_lmt); scan_power_info->requested_power = power; /* find difference between new scan *power* and current "normal" @@ -1370,32 +1370,32 @@ static void il3945_hw_reg_set_scan_power(struct il_priv *priv, u32 scan_tbl_inde * Configures power settings for all rates for the current channel, * using values from channel info struct, and send to NIC */ -static int il3945_send_tx_power(struct il_priv *priv) +static int il3945_send_tx_power(struct il_priv *il) { int rate_idx, i; const struct il_channel_info *ch_info = NULL; struct il3945_txpowertable_cmd txpower = { - .channel = priv->contexts[IL_RXON_CTX_BSS].active.channel, + .channel = il->contexts[IL_RXON_CTX_BSS].active.channel, }; u16 chan; - if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &priv->status), + if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &il->status), "TX Power requested while scanning!\n")) return -EAGAIN; - chan = le16_to_cpu(priv->contexts[IL_RXON_CTX_BSS].active.channel); + chan = le16_to_cpu(il->contexts[IL_RXON_CTX_BSS].active.channel); - txpower.band = (priv->band == IEEE80211_BAND_5GHZ) ? 0 : 1; - ch_info = il_get_channel_info(priv, priv->band, chan); + txpower.band = (il->band == IEEE80211_BAND_5GHZ) ? 0 : 1; + ch_info = il_get_channel_info(il, il->band, chan); if (!ch_info) { - IL_ERR(priv, + IL_ERR(il, "Failed to get channel info for channel %d [%d]\n", - chan, priv->band); + chan, il->band); return -EINVAL; } if (!il_is_channel_valid(ch_info)) { - IL_DEBUG_POWER(priv, "Not calling TX_PWR_TABLE_CMD on " + IL_DEBUG_POWER(il, "Not calling TX_PWR_TABLE_CMD on " "non-Tx channel.\n"); return 0; } @@ -1408,7 +1408,7 @@ static int il3945_send_tx_power(struct il_priv *priv) txpower.power[i].tpc = ch_info->power_info[i].tpc; txpower.power[i].rate = il3945_rates[rate_idx].plcp; - IL_DEBUG_POWER(priv, "ch %d:%d rf %d dsp %3d rate code 0x%02x\n", + IL_DEBUG_POWER(il, "ch %d:%d rf %d dsp %3d rate code 0x%02x\n", le16_to_cpu(txpower.channel), txpower.band, txpower.power[i].tpc.tx_gain, @@ -1421,7 +1421,7 @@ static int il3945_send_tx_power(struct il_priv *priv) txpower.power[i].tpc = ch_info->power_info[i].tpc; txpower.power[i].rate = il3945_rates[rate_idx].plcp; - IL_DEBUG_POWER(priv, "ch %d:%d rf %d dsp %3d rate code 0x%02x\n", + IL_DEBUG_POWER(il, "ch %d:%d rf %d dsp %3d rate code 0x%02x\n", le16_to_cpu(txpower.channel), txpower.band, txpower.power[i].tpc.tx_gain, @@ -1429,7 +1429,7 @@ static int il3945_send_tx_power(struct il_priv *priv) txpower.power[i].rate); } - return il_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD, + return il_send_cmd_pdu(il, REPLY_TX_PWR_TABLE_CMD, sizeof(struct il3945_txpowertable_cmd), &txpower); @@ -1451,7 +1451,7 @@ static int il3945_send_tx_power(struct il_priv *priv) * properly fill out the scan powers, and actual h/w gain settings, * and send changes to NIC */ -static int il3945_hw_reg_set_new_power(struct il_priv *priv, +static int il3945_hw_reg_set_new_power(struct il_priv *il, struct il_channel_info *ch_info) { struct il3945_channel_power_info *power_info; @@ -1461,7 +1461,7 @@ static int il3945_hw_reg_set_new_power(struct il_priv *priv, int power; /* Get this chnlgrp's rate-to-max/clip-powers table */ - clip_pwrs = priv->_3945.clip_groups[ch_info->group_index].clip_powers; + clip_pwrs = il->_3945.clip_groups[ch_info->group_index].clip_powers; /* Get this channel's rate-to-current-power settings table */ power_info = ch_info->power_info; @@ -1542,10 +1542,10 @@ static int il3945_hw_reg_get_ch_txpower_limit(struct il_channel_info *ch_info) * * If RxOn is "associated", this sends the new Txpower to NIC! */ -static int il3945_hw_reg_comp_txpower_temp(struct il_priv *priv) +static int il3945_hw_reg_comp_txpower_temp(struct il_priv *il) { struct il_channel_info *ch_info = NULL; - struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; + struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; int delta_index; const s8 *clip_pwrs; /* array of h/w max power levels for each rate */ u8 a_band; @@ -1553,16 +1553,16 @@ static int il3945_hw_reg_comp_txpower_temp(struct il_priv *priv) u8 scan_tbl_index; u8 i; int ref_temp; - int temperature = priv->temperature; + int temperature = il->temperature; - if (priv->disable_tx_power_cal || - test_bit(STATUS_SCANNING, &priv->status)) { + if (il->disable_tx_power_cal || + test_bit(STATUS_SCANNING, &il->status)) { /* do not perform tx power calibration */ return 0; } /* set up new Tx power info for each and every channel, 2.4 and 5.x */ - for (i = 0; i < priv->channel_count; i++) { - ch_info = &priv->channel_info[i]; + for (i = 0; i < il->channel_count; i++) { + ch_info = &il->channel_info[i]; a_band = il_is_channel_a_band(ch_info); /* Get this chnlgrp's factory calibration temperature */ @@ -1592,43 +1592,43 @@ static int il3945_hw_reg_comp_txpower_temp(struct il_priv *priv) } /* Get this chnlgrp's rate-to-max/clip-powers table */ - clip_pwrs = priv->_3945.clip_groups[ch_info->group_index].clip_powers; + clip_pwrs = il->_3945.clip_groups[ch_info->group_index].clip_powers; /* set scan tx power, 1Mbit for CCK, 6Mbit for OFDM */ for (scan_tbl_index = 0; scan_tbl_index < IL_NUM_SCAN_RATES; scan_tbl_index++) { s32 actual_index = (scan_tbl_index == 0) ? IL_RATE_1M_INDEX_TABLE : IL_RATE_6M_INDEX_TABLE; - il3945_hw_reg_set_scan_power(priv, scan_tbl_index, + il3945_hw_reg_set_scan_power(il, scan_tbl_index, actual_index, clip_pwrs, ch_info, a_band); } } /* send Txpower command for current channel to ucode */ - return priv->cfg->ops->lib->send_tx_power(priv); + return il->cfg->ops->lib->send_tx_power(il); } -int il3945_hw_reg_set_txpower(struct il_priv *priv, s8 power) +int il3945_hw_reg_set_txpower(struct il_priv *il, s8 power) { struct il_channel_info *ch_info; s8 max_power; u8 a_band; u8 i; - if (priv->tx_power_user_lmt == power) { - IL_DEBUG_POWER(priv, "Requested Tx power same as current " + if (il->tx_power_user_lmt == power) { + IL_DEBUG_POWER(il, "Requested Tx power same as current " "limit: %ddBm.\n", power); return 0; } - IL_DEBUG_POWER(priv, "Setting upper limit clamp to %ddBm.\n", power); - priv->tx_power_user_lmt = power; + IL_DEBUG_POWER(il, "Setting upper limit clamp to %ddBm.\n", power); + il->tx_power_user_lmt = power; /* set up new Tx powers for each and every channel, 2.4 and 5.x */ - for (i = 0; i < priv->channel_count; i++) { - ch_info = &priv->channel_info[i]; + for (i = 0; i < il->channel_count; i++) { + ch_info = &il->channel_info[i]; a_band = il_is_channel_a_band(ch_info); /* find minimum power of all user and regulatory constraints @@ -1639,19 +1639,19 @@ int il3945_hw_reg_set_txpower(struct il_priv *priv, s8 power) ch_info->curr_txpow = max_power; /* this considers the h/w clipping limitations */ - il3945_hw_reg_set_new_power(priv, ch_info); + il3945_hw_reg_set_new_power(il, ch_info); } } /* update txpower settings for all channels, * send to NIC if associated. */ - il3945_is_temp_calib_needed(priv); - il3945_hw_reg_comp_txpower_temp(priv); + il3945_is_temp_calib_needed(il); + il3945_hw_reg_comp_txpower_temp(il); return 0; } -static int il3945_send_rxon_assoc(struct il_priv *priv, +static int il3945_send_rxon_assoc(struct il_priv *il, struct il_rxon_context *ctx) { int rc = 0; @@ -1670,7 +1670,7 @@ static int il3945_send_rxon_assoc(struct il_priv *priv, (rxon1->filter_flags == rxon2->filter_flags) && (rxon1->cck_basic_rates == rxon2->cck_basic_rates) && (rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates)) { - IL_DEBUG_INFO(priv, "Using current RXON_ASSOC. Not resending.\n"); + IL_DEBUG_INFO(il, "Using current RXON_ASSOC. Not resending.\n"); return 0; } @@ -1680,17 +1680,17 @@ static int il3945_send_rxon_assoc(struct il_priv *priv, rxon_assoc.cck_basic_rates = ctx->staging.cck_basic_rates; rxon_assoc.reserved = 0; - rc = il_send_cmd_sync(priv, &cmd); + rc = il_send_cmd_sync(il, &cmd); if (rc) return rc; pkt = (struct il_rx_packet *)cmd.reply_page; if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { - IL_ERR(priv, "Bad return from REPLY_RXON_ASSOC command\n"); + IL_ERR(il, "Bad return from REPLY_RXON_ASSOC command\n"); rc = -EIO; } - il_free_pages(priv, cmd.reply_page); + il_free_pages(il, cmd.reply_page); return rc; } @@ -1703,7 +1703,7 @@ static int il3945_send_rxon_assoc(struct il_priv *priv, * function correctly transitions out of the RXON_ASSOC_MSK state if * a HW tune is required based on the RXON structure changes. */ -int il3945_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) +int il3945_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx) { /* cast away the const for active_rxon in this function */ struct il3945_rxon_cmd *active_rxon = (void *)&ctx->active; @@ -1711,10 +1711,10 @@ int il3945_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) int rc = 0; bool new_assoc = !!(staging_rxon->filter_flags & RXON_FILTER_ASSOC_MSK); - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) + if (test_bit(STATUS_EXIT_PENDING, &il->status)) return -EINVAL; - if (!il_is_alive(priv)) + if (!il_is_alive(il)) return -1; /* always get timestamp with Rx frame */ @@ -1723,23 +1723,23 @@ int il3945_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) /* select antenna */ staging_rxon->flags &= ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK); - staging_rxon->flags |= il3945_get_antenna_flags(priv); + staging_rxon->flags |= il3945_get_antenna_flags(il); - rc = il_check_rxon_cmd(priv, ctx); + rc = il_check_rxon_cmd(il, ctx); if (rc) { - IL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); + IL_ERR(il, "Invalid RXON configuration. Not committing.\n"); return -EINVAL; } /* If we don't need to send a full RXON, we can use * il3945_rxon_assoc_cmd which is used to reconfigure filter * and other flags for the current radio configuration. */ - if (!il_full_rxon_required(priv, - &priv->contexts[IL_RXON_CTX_BSS])) { - rc = il_send_rxon_assoc(priv, - &priv->contexts[IL_RXON_CTX_BSS]); + if (!il_full_rxon_required(il, + &il->contexts[IL_RXON_CTX_BSS])) { + rc = il_send_rxon_assoc(il, + &il->contexts[IL_RXON_CTX_BSS]); if (rc) { - IL_ERR(priv, "Error setting RXON_ASSOC " + IL_ERR(il, "Error setting RXON_ASSOC " "configuration (%d).\n", rc); return rc; } @@ -1749,7 +1749,7 @@ int il3945_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) * We do not commit tx power settings while channel changing, * do it now if tx power changed. */ - il_set_tx_power(priv, priv->tx_power_next, false); + il_set_tx_power(il, il->tx_power_next, false); return 0; } @@ -1757,8 +1757,8 @@ int il3945_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) * an RXON_ASSOC and the new config wants the associated mask enabled, * we must clear the associated from the active configuration * before we apply the new config */ - if (il_is_associated(priv, IL_RXON_CTX_BSS) && new_assoc) { - IL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n"); + if (il_is_associated(il, IL_RXON_CTX_BSS) && new_assoc) { + IL_DEBUG_INFO(il, "Toggling associated bit on current RXON\n"); active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; /* @@ -1767,25 +1767,25 @@ int il3945_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) */ active_rxon->reserved4 = 0; active_rxon->reserved5 = 0; - rc = il_send_cmd_pdu(priv, REPLY_RXON, + rc = il_send_cmd_pdu(il, REPLY_RXON, sizeof(struct il3945_rxon_cmd), - &priv->contexts[IL_RXON_CTX_BSS].active); + &il->contexts[IL_RXON_CTX_BSS].active); /* If the mask clearing failed then we set * active_rxon back to what it was previously */ if (rc) { active_rxon->filter_flags |= RXON_FILTER_ASSOC_MSK; - IL_ERR(priv, "Error clearing ASSOC_MSK on current " + IL_ERR(il, "Error clearing ASSOC_MSK on current " "configuration (%d).\n", rc); return rc; } - il_clear_ucode_stations(priv, - &priv->contexts[IL_RXON_CTX_BSS]); - il_restore_stations(priv, - &priv->contexts[IL_RXON_CTX_BSS]); + il_clear_ucode_stations(il, + &il->contexts[IL_RXON_CTX_BSS]); + il_restore_stations(il, + &il->contexts[IL_RXON_CTX_BSS]); } - IL_DEBUG_INFO(priv, "Sending RXON\n" + IL_DEBUG_INFO(il, "Sending RXON\n" "* with%s RXON_FILTER_ASSOC_MSK\n" "* channel = %d\n" "* bssid = %pM\n", @@ -1800,38 +1800,38 @@ int il3945_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) staging_rxon->reserved4 = 0; staging_rxon->reserved5 = 0; - il_set_rxon_hwcrypto(priv, ctx, !il3945_mod_params.sw_crypto); + il_set_rxon_hwcrypto(il, ctx, !il3945_mod_params.sw_crypto); /* Apply the new configuration */ - rc = il_send_cmd_pdu(priv, REPLY_RXON, + rc = il_send_cmd_pdu(il, REPLY_RXON, sizeof(struct il3945_rxon_cmd), staging_rxon); if (rc) { - IL_ERR(priv, "Error setting new configuration (%d).\n", rc); + IL_ERR(il, "Error setting new configuration (%d).\n", rc); return rc; } memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); if (!new_assoc) { - il_clear_ucode_stations(priv, - &priv->contexts[IL_RXON_CTX_BSS]); - il_restore_stations(priv, - &priv->contexts[IL_RXON_CTX_BSS]); + il_clear_ucode_stations(il, + &il->contexts[IL_RXON_CTX_BSS]); + il_restore_stations(il, + &il->contexts[IL_RXON_CTX_BSS]); } /* If we issue a new RXON command which required a tune then we must * send a new TXPOWER command or we won't be able to Tx any frames */ - rc = il_set_tx_power(priv, priv->tx_power_next, true); + rc = il_set_tx_power(il, il->tx_power_next, true); if (rc) { - IL_ERR(priv, "Error setting Tx power (%d).\n", rc); + IL_ERR(il, "Error setting Tx power (%d).\n", rc); return rc; } /* Init the hardware's rate fallback order based on the band */ - rc = il3945_init_hw_rate_table(priv); + rc = il3945_init_hw_rate_table(il); if (rc) { - IL_ERR(priv, "Error setting HW rate table: %02X\n", rc); + IL_ERR(il, "Error setting HW rate table: %02X\n", rc); return -EIO; } @@ -1848,34 +1848,34 @@ int il3945_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) * -- send new set of gain settings to NIC * NOTE: This should continue working, even when we're not associated, * so we can keep our internal table of scan powers current. */ -void il3945_reg_txpower_periodic(struct il_priv *priv) +void il3945_reg_txpower_periodic(struct il_priv *il) { /* This will kick in the "brute force" * il3945_hw_reg_comp_txpower_temp() below */ - if (!il3945_is_temp_calib_needed(priv)) + if (!il3945_is_temp_calib_needed(il)) goto reschedule; /* Set up a new set of temp-adjusted TxPowers, send to NIC. * This is based *only* on current temperature, * ignoring any previous power measurements */ - il3945_hw_reg_comp_txpower_temp(priv); + il3945_hw_reg_comp_txpower_temp(il); reschedule: - queue_delayed_work(priv->workqueue, - &priv->_3945.thermal_periodic, REG_RECALIB_PERIOD * HZ); + queue_delayed_work(il->workqueue, + &il->_3945.thermal_periodic, REG_RECALIB_PERIOD * HZ); } static void il3945_bg_reg_txpower_periodic(struct work_struct *work) { - struct il_priv *priv = container_of(work, struct il_priv, + struct il_priv *il = container_of(work, struct il_priv, _3945.thermal_periodic.work); - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) + if (test_bit(STATUS_EXIT_PENDING, &il->status)) return; - mutex_lock(&priv->mutex); - il3945_reg_txpower_periodic(priv); - mutex_unlock(&priv->mutex); + mutex_lock(&il->mutex); + il3945_reg_txpower_periodic(il); + mutex_unlock(&il->mutex); } /** @@ -1889,10 +1889,10 @@ static void il3945_bg_reg_txpower_periodic(struct work_struct *work) * on A-band, EEPROM's "group frequency" entries represent the top * channel in each group 1-4. Group 5 All B/G channels are in group 0. */ -static u16 il3945_hw_reg_get_ch_grp_index(struct il_priv *priv, +static u16 il3945_hw_reg_get_ch_grp_index(struct il_priv *il, const struct il_channel_info *ch_info) { - struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; + struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; struct il3945_eeprom_txpower_group *ch_grp = &eeprom->groups[0]; u8 group; u16 group_index = 0; /* based on factory calib frequencies */ @@ -1913,7 +1913,7 @@ static u16 il3945_hw_reg_get_ch_grp_index(struct il_priv *priv, } else group_index = 0; /* 2.4 GHz, group 0 */ - IL_DEBUG_POWER(priv, "Chnl %d mapped to grp %d\n", ch_info->channel, + IL_DEBUG_POWER(il, "Chnl %d mapped to grp %d\n", ch_info->channel, group_index); return group_index; } @@ -1924,12 +1924,12 @@ static u16 il3945_hw_reg_get_ch_grp_index(struct il_priv *priv, * Interpolate to get nominal (i.e. at factory calibration temperature) index * into radio/DSP gain settings table for requested power. */ -static int il3945_hw_reg_get_matched_power_index(struct il_priv *priv, +static int il3945_hw_reg_get_matched_power_index(struct il_priv *il, s8 requested_power, s32 setting_index, s32 *new_index) { const struct il3945_eeprom_txpower_group *chnl_grp = NULL; - struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; + struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; s32 index0, index1; s32 power = 2 * requested_power; s32 i; @@ -1973,14 +1973,14 @@ static int il3945_hw_reg_get_matched_power_index(struct il_priv *priv, return 0; } -static void il3945_hw_reg_init_channel_groups(struct il_priv *priv) +static void il3945_hw_reg_init_channel_groups(struct il_priv *il) { u32 i; s32 rate_index; - struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; + struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; const struct il3945_eeprom_txpower_group *group; - IL_DEBUG_POWER(priv, "Initializing factory calib info from EEPROM\n"); + IL_DEBUG_POWER(il, "Initializing factory calib info from EEPROM\n"); for (i = 0; i < IL_NUM_TX_CALIB_GROUPS; i++) { s8 *clip_pwrs; /* table of power levels for each rate */ @@ -1989,7 +1989,7 @@ static void il3945_hw_reg_init_channel_groups(struct il_priv *priv) /* sanity check on factory saturation power value */ if (group->saturation_power < 40) { - IL_WARN(priv, "Error: saturation power is %d, " + IL_WARN(il, "Error: saturation power is %d, " "less than minimum expected 40\n", group->saturation_power); return; @@ -2004,7 +2004,7 @@ static void il3945_hw_reg_init_channel_groups(struct il_priv *priv) * power peaks, without too much distortion (clipping). */ /* we'll fill in this array with h/w max power levels */ - clip_pwrs = (s8 *) priv->_3945.clip_groups[i].clip_powers; + clip_pwrs = (s8 *) il->_3945.clip_groups[i].clip_powers; /* divide factory saturation power by 2 to find -3dB level */ satur_pwr = (s8) (group->saturation_power >> 1); @@ -2042,7 +2042,7 @@ static void il3945_hw_reg_init_channel_groups(struct il_priv *priv) /** * il3945_txpower_set_from_eeprom - Set channel power info based on EEPROM * - * Second pass (during init) to set up priv->channel_info + * Second pass (during init) to set up il->channel_info * * Set up Tx-power settings in our channel info database for each VALID * (for this geo/SKU) channel, at all Tx data rates, based on eeprom values @@ -2054,11 +2054,11 @@ static void il3945_hw_reg_init_channel_groups(struct il_priv *priv) * * This does *not* write values to NIC, just sets up our internal table. */ -int il3945_txpower_set_from_eeprom(struct il_priv *priv) +int il3945_txpower_set_from_eeprom(struct il_priv *il) { struct il_channel_info *ch_info = NULL; struct il3945_channel_power_info *pwr_info; - struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; + struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; int delta_index; u8 rate_index; u8 scan_tbl_index; @@ -2071,13 +2071,13 @@ int il3945_txpower_set_from_eeprom(struct il_priv *priv) /* save temperature reference, * so we can determine next time to calibrate */ - temperature = il3945_hw_reg_txpower_get_temperature(priv); - priv->last_temperature = temperature; + temperature = il3945_hw_reg_txpower_get_temperature(il); + il->last_temperature = temperature; - il3945_hw_reg_init_channel_groups(priv); + il3945_hw_reg_init_channel_groups(il); /* initialize Tx power info for each and every channel, 2.4 and 5.x */ - for (i = 0, ch_info = priv->channel_info; i < priv->channel_count; + for (i = 0, ch_info = il->channel_info; i < il->channel_count; i++, ch_info++) { a_band = il_is_channel_a_band(ch_info); if (!il_is_channel_valid(ch_info)) @@ -2085,10 +2085,10 @@ int il3945_txpower_set_from_eeprom(struct il_priv *priv) /* find this channel's channel group (*not* "band") index */ ch_info->group_index = - il3945_hw_reg_get_ch_grp_index(priv, ch_info); + il3945_hw_reg_get_ch_grp_index(il, ch_info); /* Get this chnlgrp's rate->max/clip-powers table */ - clip_pwrs = priv->_3945.clip_groups[ch_info->group_index].clip_powers; + clip_pwrs = il->_3945.clip_groups[ch_info->group_index].clip_powers; /* calculate power index *adjustment* value according to * diff between current temperature and factory temperature */ @@ -2096,7 +2096,7 @@ int il3945_txpower_set_from_eeprom(struct il_priv *priv) eeprom->groups[ch_info->group_index]. temperature); - IL_DEBUG_POWER(priv, "Delta index for channel %d: %d [%d]\n", + IL_DEBUG_POWER(il, "Delta index for channel %d: %d [%d]\n", ch_info->channel, delta_index, temperature + IL_TEMP_CONVERT); @@ -2115,11 +2115,11 @@ int il3945_txpower_set_from_eeprom(struct il_priv *priv) /* get base (i.e. at factory-measured temperature) * power table index for this rate's power */ - rc = il3945_hw_reg_get_matched_power_index(priv, pwr, + rc = il3945_hw_reg_get_matched_power_index(il, pwr, ch_info->group_index, &power_idx); if (rc) { - IL_ERR(priv, "Invalid power index\n"); + IL_ERR(il, "Invalid power index\n"); return rc; } pwr_info->base_power_index = (u8) power_idx; @@ -2171,7 +2171,7 @@ int il3945_txpower_set_from_eeprom(struct il_priv *priv) scan_tbl_index < IL_NUM_SCAN_RATES; scan_tbl_index++) { s32 actual_index = (scan_tbl_index == 0) ? IL_RATE_1M_INDEX_TABLE : IL_RATE_6M_INDEX_TABLE; - il3945_hw_reg_set_scan_power(priv, scan_tbl_index, + il3945_hw_reg_set_scan_power(il, scan_tbl_index, actual_index, clip_pwrs, ch_info, a_band); } } @@ -2179,31 +2179,31 @@ int il3945_txpower_set_from_eeprom(struct il_priv *priv) return 0; } -int il3945_hw_rxq_stop(struct il_priv *priv) +int il3945_hw_rxq_stop(struct il_priv *il) { int rc; - il_write_direct32(priv, FH39_RCSR_CONFIG(0), 0); - rc = il_poll_direct_bit(priv, FH39_RSSR_STATUS, + il_write_direct32(il, FH39_RCSR_CONFIG(0), 0); + rc = il_poll_direct_bit(il, FH39_RSSR_STATUS, FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000); if (rc < 0) - IL_ERR(priv, "Can't stop Rx DMA.\n"); + IL_ERR(il, "Can't stop Rx DMA.\n"); return 0; } -int il3945_hw_tx_queue_init(struct il_priv *priv, struct il_tx_queue *txq) +int il3945_hw_tx_queue_init(struct il_priv *il, struct il_tx_queue *txq) { int txq_id = txq->q.id; - struct il3945_shared *shared_data = priv->_3945.shared_virt; + struct il3945_shared *shared_data = il->_3945.shared_virt; shared_data->tx_base_ptr[txq_id] = cpu_to_le32((u32)txq->q.dma_addr); - il_write_direct32(priv, FH39_CBCC_CTRL(txq_id), 0); - il_write_direct32(priv, FH39_CBCC_BASE(txq_id), 0); + il_write_direct32(il, FH39_CBCC_CTRL(txq_id), 0); + il_write_direct32(il, FH39_CBCC_BASE(txq_id), 0); - il_write_direct32(priv, FH39_TCSR_CONFIG(txq_id), + il_write_direct32(il, FH39_TCSR_CONFIG(txq_id), FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT | FH39_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF | FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD | @@ -2211,7 +2211,7 @@ int il3945_hw_tx_queue_init(struct il_priv *priv, struct il_tx_queue *txq) FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE); /* fake read to flush all prev. writes */ - il_read32(priv, FH39_TSSR_CBB_BASE); + il_read32(il, FH39_TSSR_CBB_BASE); return 0; } @@ -2250,10 +2250,10 @@ static u16 il3945_build_addsta_hcmd(const struct il_addsta_cmd *cmd, return (u16)sizeof(struct il3945_addsta_cmd); } -static int il3945_add_bssid_station(struct il_priv *priv, +static int il3945_add_bssid_station(struct il_priv *il, const u8 *addr, u8 *sta_id_r) { - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; int ret; u8 sta_id; unsigned long flags; @@ -2261,49 +2261,49 @@ static int il3945_add_bssid_station(struct il_priv *priv, 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); return 0; } -static int il3945_manage_ibss_station(struct il_priv *priv, +static int il3945_manage_ibss_station(struct il_priv *il, struct ieee80211_vif *vif, bool add) { struct il_vif_priv *vif_priv = (void *)vif->drv_priv; int ret; if (add) { - ret = il3945_add_bssid_station(priv, vif->bss_conf.bssid, + ret = il3945_add_bssid_station(il, vif->bss_conf.bssid, &vif_priv->ibss_bssid_sta_id); if (ret) return ret; - il3945_sync_sta(priv, vif_priv->ibss_bssid_sta_id, - (priv->band == IEEE80211_BAND_5GHZ) ? + il3945_sync_sta(il, vif_priv->ibss_bssid_sta_id, + (il->band == IEEE80211_BAND_5GHZ) ? IL_RATE_6M_PLCP : IL_RATE_1M_PLCP); - il3945_rate_scale_init(priv->hw, vif_priv->ibss_bssid_sta_id); + il3945_rate_scale_init(il->hw, vif_priv->ibss_bssid_sta_id); return 0; } - 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); } /** * il3945_init_hw_rate_table - Initialize the hardware rate fallback table */ -int il3945_init_hw_rate_table(struct il_priv *priv) +int il3945_init_hw_rate_table(struct il_priv *il) { int rc, i, index, prev_index; struct il3945_rate_scaling_cmd rate_cmd = { @@ -2316,15 +2316,15 @@ int il3945_init_hw_rate_table(struct il_priv *priv) table[index].rate_n_flags = il3945_hw_set_rate_n_flags(il3945_rates[i].plcp, 0); - table[index].try_cnt = priv->retry_rate; + table[index].try_cnt = il->retry_rate; prev_index = il3945_get_prev_ieee_rate(i); table[index].next_rate_index = il3945_rates[prev_index].table_rs_index; } - switch (priv->band) { + switch (il->band) { case IEEE80211_BAND_5GHZ: - IL_DEBUG_RATE(priv, "Select A mode rate scale\n"); + IL_DEBUG_RATE(il, "Select A mode rate scale\n"); /* If one of the following CCK rates is used, * have it fall back to the 6M OFDM rate */ for (i = IL_RATE_1M_INDEX_TABLE; @@ -2342,12 +2342,12 @@ int il3945_init_hw_rate_table(struct il_priv *priv) break; case IEEE80211_BAND_2GHZ: - IL_DEBUG_RATE(priv, "Select B/G mode rate scale\n"); + IL_DEBUG_RATE(il, "Select B/G mode rate scale\n"); /* If an OFDM rate is used, have it fall back to the * 1M CCK rates */ - if (!(priv->_3945.sta_supp_rates & IL_OFDM_RATES_MASK) && - il_is_associated(priv, IL_RXON_CTX_BSS)) { + if (!(il->_3945.sta_supp_rates & IL_OFDM_RATES_MASK) && + il_is_associated(il, IL_RXON_CTX_BSS)) { index = IL_FIRST_CCK_RATE; for (i = IL_RATE_6M_INDEX_TABLE; @@ -2368,52 +2368,52 @@ int il3945_init_hw_rate_table(struct il_priv *priv) /* Update the rate scaling for control frame Tx */ rate_cmd.table_id = 0; - rc = il_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd), + rc = il_send_cmd_pdu(il, REPLY_RATE_SCALE, sizeof(rate_cmd), &rate_cmd); if (rc) return rc; /* Update the rate scaling for data frame Tx */ rate_cmd.table_id = 1; - return il_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd), + return il_send_cmd_pdu(il, REPLY_RATE_SCALE, sizeof(rate_cmd), &rate_cmd); } /* Called when initializing driver */ -int il3945_hw_set_hw_params(struct il_priv *priv) +int il3945_hw_set_hw_params(struct il_priv *il) { - memset((void *)&priv->hw_params, 0, + memset((void *)&il->hw_params, 0, sizeof(struct il_hw_params)); - priv->_3945.shared_virt = - dma_alloc_coherent(&priv->pci_dev->dev, + il->_3945.shared_virt = + dma_alloc_coherent(&il->pci_dev->dev, sizeof(struct il3945_shared), - &priv->_3945.shared_phys, GFP_KERNEL); - if (!priv->_3945.shared_virt) { - IL_ERR(priv, "failed to allocate pci memory\n"); + &il->_3945.shared_phys, GFP_KERNEL); + if (!il->_3945.shared_virt) { + IL_ERR(il, "failed to allocate pci memory\n"); return -ENOMEM; } /* Assign number of Usable TX queues */ - priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues; + il->hw_params.max_txq_num = il->cfg->base_params->num_of_queues; - priv->hw_params.tfd_size = sizeof(struct il3945_tfd); - priv->hw_params.rx_page_order = get_order(IL_RX_BUF_SIZE_3K); - priv->hw_params.max_rxq_size = RX_QUEUE_SIZE; - priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG; - priv->hw_params.max_stations = IWL3945_STATION_COUNT; - priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id = IWL3945_BROADCAST_ID; + il->hw_params.tfd_size = sizeof(struct il3945_tfd); + il->hw_params.rx_page_order = get_order(IL_RX_BUF_SIZE_3K); + il->hw_params.max_rxq_size = RX_QUEUE_SIZE; + il->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG; + il->hw_params.max_stations = IWL3945_STATION_COUNT; + il->contexts[IL_RXON_CTX_BSS].bcast_sta_id = IWL3945_BROADCAST_ID; - priv->sta_key_max_num = STA_KEY_MAX_NUM; + il->sta_key_max_num = STA_KEY_MAX_NUM; - priv->hw_params.rx_wrt_ptr_reg = FH39_RSCSR_CHNL0_WPTR; - priv->hw_params.max_beacon_itrvl = IWL39_MAX_UCODE_BEACON_INTERVAL; - priv->hw_params.beacon_time_tsf_bits = IWL3945_EXT_BEACON_TIME_POS; + il->hw_params.rx_wrt_ptr_reg = FH39_RSCSR_CHNL0_WPTR; + il->hw_params.max_beacon_itrvl = IWL39_MAX_UCODE_BEACON_INTERVAL; + il->hw_params.beacon_time_tsf_bits = IWL3945_EXT_BEACON_TIME_POS; return 0; } -unsigned int il3945_hw_get_beacon_cmd(struct il_priv *priv, +unsigned int il3945_hw_get_beacon_cmd(struct il_priv *il, struct il3945_frame *frame, u8 rate) { struct il3945_tx_beacon_cmd *tx_beacon_cmd; @@ -2423,10 +2423,10 @@ unsigned int il3945_hw_get_beacon_cmd(struct il_priv *priv, memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); tx_beacon_cmd->tx.sta_id = - priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id; + il->contexts[IL_RXON_CTX_BSS].bcast_sta_id; tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; - frame_size = il3945_fill_beacon_frame(priv, + frame_size = il3945_fill_beacon_frame(il, tx_beacon_cmd->frame, sizeof(frame->u) - sizeof(*tx_beacon_cmd)); @@ -2447,41 +2447,41 @@ unsigned int il3945_hw_get_beacon_cmd(struct il_priv *priv, return sizeof(struct il3945_tx_beacon_cmd) + frame_size; } -void il3945_hw_rx_handler_setup(struct il_priv *priv) +void il3945_hw_rx_handler_setup(struct il_priv *il) { - priv->rx_handlers[REPLY_TX] = il3945_rx_reply_tx; - priv->rx_handlers[REPLY_3945_RX] = il3945_rx_reply_rx; + il->rx_handlers[REPLY_TX] = il3945_rx_reply_tx; + il->rx_handlers[REPLY_3945_RX] = il3945_rx_reply_rx; } -void il3945_hw_setup_deferred_work(struct il_priv *priv) +void il3945_hw_setup_deferred_work(struct il_priv *il) { - INIT_DELAYED_WORK(&priv->_3945.thermal_periodic, + INIT_DELAYED_WORK(&il->_3945.thermal_periodic, il3945_bg_reg_txpower_periodic); } -void il3945_hw_cancel_deferred_work(struct il_priv *priv) +void il3945_hw_cancel_deferred_work(struct il_priv *il) { - cancel_delayed_work(&priv->_3945.thermal_periodic); + cancel_delayed_work(&il->_3945.thermal_periodic); } /* check contents of special bootstrap uCode SRAM */ -static int il3945_verify_bsm(struct il_priv *priv) +static int il3945_verify_bsm(struct il_priv *il) { - __le32 *image = priv->ucode_boot.v_addr; - u32 len = priv->ucode_boot.len; + __le32 *image = il->ucode_boot.v_addr; + u32 len = il->ucode_boot.len; u32 reg; u32 val; - IL_DEBUG_INFO(priv, "Begin verify bsm\n"); + IL_DEBUG_INFO(il, "Begin verify bsm\n"); /* verify BSM SRAM contents */ - val = il_read_prph(priv, BSM_WR_DWCOUNT_REG); + val = il_read_prph(il, BSM_WR_DWCOUNT_REG); for (reg = BSM_SRAM_LOWER_BOUND; reg < BSM_SRAM_LOWER_BOUND + len; reg += sizeof(u32), image++) { - val = il_read_prph(priv, reg); + val = il_read_prph(il, reg); if (val != le32_to_cpu(*image)) { - IL_ERR(priv, "BSM uCode verification failed at " + IL_ERR(il, "BSM uCode verification failed at " "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n", BSM_SRAM_LOWER_BOUND, reg - BSM_SRAM_LOWER_BOUND, len, @@ -2490,7 +2490,7 @@ static int il3945_verify_bsm(struct il_priv *priv) } } - IL_DEBUG_INFO(priv, "BSM bootstrap uCode image OK\n"); + IL_DEBUG_INFO(il, "BSM bootstrap uCode image OK\n"); return 0; } @@ -2510,14 +2510,14 @@ static int il3945_verify_bsm(struct il_priv *priv) * simply claims ownership, which should be safe when this function is called * (i.e. before loading uCode!). */ -static int il3945_eeprom_acquire_semaphore(struct il_priv *priv) +static int il3945_eeprom_acquire_semaphore(struct il_priv *il) { - _il_clear_bit(priv, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK); + _il_clear_bit(il, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK); return 0; } -static void il3945_eeprom_release_semaphore(struct il_priv *priv) +static void il3945_eeprom_release_semaphore(struct il_priv *il) { return; } @@ -2554,10 +2554,10 @@ static void il3945_eeprom_release_semaphore(struct il_priv *priv) * the runtime uCode instructions and the backup data cache into SRAM, * and re-launches the runtime uCode from where it left off. */ -static int il3945_load_bsm(struct il_priv *priv) +static int il3945_load_bsm(struct il_priv *il) { - __le32 *image = priv->ucode_boot.v_addr; - u32 len = priv->ucode_boot.len; + __le32 *image = il->ucode_boot.v_addr; + u32 len = il->ucode_boot.len; dma_addr_t pinst; dma_addr_t pdata; u32 inst_len; @@ -2567,7 +2567,7 @@ static int il3945_load_bsm(struct il_priv *priv) u32 done; u32 reg_offset; - IL_DEBUG_INFO(priv, "Begin load bsm\n"); + IL_DEBUG_INFO(il, "Begin load bsm\n"); /* make sure bootstrap program is no larger than BSM's SRAM size */ if (len > IWL39_MAX_BSM_SIZE) @@ -2578,55 +2578,55 @@ static int il3945_load_bsm(struct il_priv *priv) * NOTE: il3945_initialize_alive_start() will replace these values, * after the "initialize" uCode has run, to point to * runtime/protocol instructions and backup data cache. */ - pinst = priv->ucode_init.p_addr; - pdata = priv->ucode_init_data.p_addr; - inst_len = priv->ucode_init.len; - data_len = priv->ucode_init_data.len; + pinst = il->ucode_init.p_addr; + pdata = il->ucode_init_data.p_addr; + inst_len = il->ucode_init.len; + data_len = il->ucode_init_data.len; - il_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); - il_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); - il_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); - il_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); + il_write_prph(il, BSM_DRAM_INST_PTR_REG, pinst); + il_write_prph(il, BSM_DRAM_DATA_PTR_REG, pdata); + il_write_prph(il, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); + il_write_prph(il, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); /* Fill BSM memory with bootstrap instructions */ for (reg_offset = BSM_SRAM_LOWER_BOUND; reg_offset < BSM_SRAM_LOWER_BOUND + len; reg_offset += sizeof(u32), image++) - _il_write_prph(priv, reg_offset, + _il_write_prph(il, reg_offset, le32_to_cpu(*image)); - rc = il3945_verify_bsm(priv); + rc = il3945_verify_bsm(il); if (rc) return rc; /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */ - il_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0); - il_write_prph(priv, BSM_WR_MEM_DST_REG, + il_write_prph(il, BSM_WR_MEM_SRC_REG, 0x0); + il_write_prph(il, BSM_WR_MEM_DST_REG, IWL39_RTC_INST_LOWER_BOUND); - il_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); + il_write_prph(il, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); /* Load bootstrap code into instruction SRAM now, * to prepare to load "initialize" uCode */ - il_write_prph(priv, BSM_WR_CTRL_REG, + il_write_prph(il, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START); /* Wait for load of bootstrap uCode to finish */ for (i = 0; i < 100; i++) { - done = il_read_prph(priv, BSM_WR_CTRL_REG); + done = il_read_prph(il, BSM_WR_CTRL_REG); if (!(done & BSM_WR_CTRL_REG_BIT_START)) break; udelay(10); } if (i < 100) - IL_DEBUG_INFO(priv, "BSM write complete, poll %d iterations\n", i); + IL_DEBUG_INFO(il, "BSM write complete, poll %d iterations\n", i); else { - IL_ERR(priv, "BSM write did not complete!\n"); + IL_ERR(il, "BSM write did not complete!\n"); return -EIO; } /* Enable future boot loads whenever power management unit triggers it * (e.g. when powering back up after power-save shutdown) */ - il_write_prph(priv, BSM_WR_CTRL_REG, + il_write_prph(il, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START_EN); return 0; diff --git a/drivers/net/wireless/iwlegacy/iwl-3945.h b/drivers/net/wireless/iwlegacy/iwl-3945.h index 167eedcfeb63..abe778b1b424 100644 --- a/drivers/net/wireless/iwlegacy/iwl-3945.h +++ b/drivers/net/wireless/iwlegacy/iwl-3945.h @@ -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]; diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-calib.c b/drivers/net/wireless/iwlegacy/iwl-4965-calib.c index 115eeb3d7c39..7807dc59e9c5 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-calib.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-calib.c @@ -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); } diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-calib.h b/drivers/net/wireless/iwlegacy/iwl-4965-calib.h index a23081f1d03e..0e30ea7ff12e 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-calib.h +++ b/drivers/net/wireless/iwlegacy/iwl-4965-calib.h @@ -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__ */ diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c b/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c index 3c2876ffadc5..8ea0ac205f7f 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c @@ -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, diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c b/drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c index e657b444cf48..947475ea3cef 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c @@ -87,23 +87,23 @@ * EEPROM chip, not a single event, so even reads could conflict if they * weren't arbitrated by the semaphore. */ -int 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); } diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-led.c b/drivers/net/wireless/iwlegacy/iwl-4965-led.c index d2c8eacd6835..1436a1b7ebf6 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-led.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-led.c @@ -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 = { diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-led.h b/drivers/net/wireless/iwlegacy/iwl-4965-led.h index ab03dff812fd..e804fe16caef 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-led.h +++ b/drivers/net/wireless/iwlegacy/iwl-4965-led.h @@ -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__ */ diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c index 25f1d4768e7b..4d25590b0339 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c @@ -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; } diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c index a7298f5997a2..e53ed1a5d5db 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c @@ -140,11 +140,11 @@ static int il4965_hwrate_to_plcp_idx(u32 rate_n_flags) return -1; } -static void il4965_rs_rate_scale_perform(struct il_priv *priv, +static void il4965_rs_rate_scale_perform(struct il_priv *il, struct sk_buff *skb, struct ieee80211_sta *sta, struct il_lq_sta *lq_sta); -static void il4965_rs_fill_link_cmd(struct il_priv *priv, +static void il4965_rs_fill_link_cmd(struct il_priv *il, struct il_lq_sta *lq_sta, u32 rate_n_flags); static void il4965_rs_stay_in_table(struct il_lq_sta *lq_sta, bool force_search); @@ -348,7 +348,7 @@ static u32 il4965_rs_tl_get_load(struct il_lq_sta *lq_data, u8 tid) return tl->total; } -static int il4965_rs_tl_turn_on_agg_for_tid(struct il_priv *priv, +static int il4965_rs_tl_turn_on_agg_for_tid(struct il_priv *il, struct il_lq_sta *lq_data, u8 tid, struct ieee80211_sta *sta) { @@ -358,7 +358,7 @@ static int il4965_rs_tl_turn_on_agg_for_tid(struct il_priv *priv, load = il4965_rs_tl_get_load(lq_data, tid); if (load > IL_AGG_LOAD_THRESHOLD) { - IL_DEBUG_HT(priv, "Starting Tx agg: STA: %pM tid: %d\n", + IL_DEBUG_HT(il, "Starting Tx agg: STA: %pM tid: %d\n", sta->addr, tid); ret = ieee80211_start_tx_ba_session(sta, tid, 5000); if (ret == -EAGAIN) { @@ -367,25 +367,25 @@ static int il4965_rs_tl_turn_on_agg_for_tid(struct il_priv *priv, * this might be cause by reloading firmware * stop the tx ba session here */ - IL_ERR(priv, "Fail start Tx agg on tid: %d\n", + IL_ERR(il, "Fail start Tx agg on tid: %d\n", tid); ieee80211_stop_tx_ba_session(sta, tid); } } else { - IL_ERR(priv, "Aggregation not enabled for tid %d " + IL_ERR(il, "Aggregation not enabled for tid %d " "because load = %u\n", tid, load); } return ret; } -static void il4965_rs_tl_turn_on_agg(struct il_priv *priv, u8 tid, +static void il4965_rs_tl_turn_on_agg(struct il_priv *il, u8 tid, struct il_lq_sta *lq_data, struct ieee80211_sta *sta) { if (tid < TID_MAX_LOAD_COUNT) - il4965_rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta); + il4965_rs_tl_turn_on_agg_for_tid(il, lq_data, tid, sta); else - IL_ERR(priv, "tid exceeds max load count: %d/%d\n", + IL_ERR(il, "tid exceeds max load count: %d/%d\n", tid, TID_MAX_LOAD_COUNT); } @@ -492,7 +492,7 @@ static int il4965_rs_collect_tx_data(struct il_scale_tbl_info *tbl, /* * Fill uCode API rate_n_flags field, based on "search" or "active" table. */ -static u32 il4965_rate_n_flags_from_tbl(struct il_priv *priv, +static u32 il4965_rate_n_flags_from_tbl(struct il_priv *il, struct il_scale_tbl_info *tbl, int index, u8 use_green) { @@ -505,7 +505,7 @@ static u32 il4965_rate_n_flags_from_tbl(struct il_priv *priv, } else if (is_Ht(tbl->lq_type)) { if (index > IL_LAST_OFDM_RATE) { - IL_ERR(priv, "Invalid HT rate index %d\n", index); + IL_ERR(il, "Invalid HT rate index %d\n", index); index = IL_LAST_OFDM_RATE; } rate_n_flags = RATE_MCS_HT_MSK; @@ -515,7 +515,7 @@ static u32 il4965_rate_n_flags_from_tbl(struct il_priv *priv, else rate_n_flags |= iwlegacy_rates[index].plcp_mimo2; } else { - IL_ERR(priv, "Invalid tbl->lq_type %d\n", tbl->lq_type); + IL_ERR(il, "Invalid tbl->lq_type %d\n", tbl->lq_type); } rate_n_flags |= ((tbl->ant_type << RATE_MCS_ANT_POS) & @@ -535,7 +535,7 @@ static u32 il4965_rate_n_flags_from_tbl(struct il_priv *priv, rate_n_flags |= RATE_MCS_GF_MSK; if (is_siso(tbl->lq_type) && tbl->is_SGI) { rate_n_flags &= ~RATE_MCS_SGI_MSK; - IL_ERR(priv, "GF was set with SGI:SISO\n"); + IL_ERR(il, "GF was set with SGI:SISO\n"); } } } @@ -667,7 +667,7 @@ static u16 il4965_rs_get_supported_rates(struct il_lq_sta *lq_sta, } static u16 -il4965_rs_get_adjacent_rate(struct il_priv *priv, u8 index, u16 rate_mask, +il4965_rs_get_adjacent_rate(struct il_priv *il, u8 index, u16 rate_mask, int rate_type) { u8 high = IL_RATE_INVALID; @@ -707,7 +707,7 @@ il4965_rs_get_adjacent_rate(struct il_priv *priv, u8 index, u16 rate_mask, 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; @@ -717,7 +717,7 @@ il4965_rs_get_adjacent_rate(struct il_priv *priv, u8 index, u16 rate_mask, 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; @@ -732,7 +732,7 @@ static u32 il4965_rs_get_lower_rate(struct il_lq_sta *lq_sta, u16 high_low; u8 switch_to_legacy = 0; u8 is_green = lq_sta->is_green; - struct il_priv *priv = lq_sta->drv; + struct il_priv *il = lq_sta->drv; /* check if we need to switch from HT to legacy rates. * assumption is that mandatory rates (1Mbps or 6Mbps) @@ -747,7 +747,7 @@ static u32 il4965_rs_get_lower_rate(struct il_lq_sta *lq_sta, if (il4965_num_of_ant(tbl->ant_type) > 1) tbl->ant_type = - il4965_first_antenna(priv->hw_params.valid_tx_ant); + il4965_first_antenna(il->hw_params.valid_tx_ant); tbl->is_ht40 = 0; tbl->is_SGI = 0; @@ -798,17 +798,17 @@ static bool il4965_table_type_matches(struct il_scale_tbl_info *a, * mac80211 sends us Tx status */ static void -il4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *priv_sta, +il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband, + struct ieee80211_sta *sta, void *il_sta, struct sk_buff *skb) { int legacy_success; int retries; int rs_index, mac_index, i; - struct il_lq_sta *lq_sta = priv_sta; + struct il_lq_sta *lq_sta = il_sta; struct il_link_quality_cmd *table; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct il_priv *priv = (struct il_priv *)priv_r; + struct il_priv *il = (struct il_priv *)il_r; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); enum mac80211_rate_control_flags mac_flags; u32 tx_rate; @@ -817,15 +817,15 @@ il4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, struct il_station_priv *sta_priv = (void *)sta->drv_priv; struct il_rxon_context *ctx = sta_priv->common.ctx; - IL_DEBUG_RATE_LIMIT(priv, + IL_DEBUG_RATE_LIMIT(il, "get frame ack response, update rate scale window\n"); /* Treat uninitialized rate scaling data same as non-existing. */ if (!lq_sta) { - IL_DEBUG_RATE(priv, "Station rate scaling not created yet.\n"); + IL_DEBUG_RATE(il, "Station rate scaling not created yet.\n"); return; } else if (!lq_sta->drv) { - IL_DEBUG_RATE(priv, "Rate scaling not initialized yet.\n"); + IL_DEBUG_RATE(il, "Rate scaling not initialized yet.\n"); return; } @@ -849,8 +849,8 @@ il4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, table = &lq_sta->lq; tx_rate = le32_to_cpu(table->rs_table[0].rate_n_flags); il4965_rs_get_tbl_info_from_mcs(tx_rate, - priv->band, &tbl_type, &rs_index); - if (priv->band == IEEE80211_BAND_5GHZ) + il->band, &tbl_type, &rs_index); + if (il->band == IEEE80211_BAND_5GHZ) rs_index -= IL_FIRST_OFDM_RATE; mac_flags = info->status.rates[0].flags; mac_index = info->status.rates[0].idx; @@ -863,7 +863,7 @@ il4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, * mac80211 HT index is always zero-indexed; we need to move * HT OFDM rates after CCK rates in 2.4 GHz band */ - if (priv->band == IEEE80211_BAND_2GHZ) + if (il->band == IEEE80211_BAND_2GHZ) mac_index += IL_FIRST_OFDM_RATE; } /* Here we actually compare this rate to the latest LQ command */ @@ -880,7 +880,7 @@ il4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, (!!(tx_rate & RATE_MCS_GF_MSK) != !!(mac_flags & IEEE80211_TX_RC_GREEN_FIELD)) || (rs_index != mac_index)) { - IL_DEBUG_RATE(priv, + IL_DEBUG_RATE(il, "initial rate %d does not match %d (0x%x)\n", mac_index, rs_index, tx_rate); /* @@ -891,7 +891,7 @@ il4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, lq_sta->missed_rate_counter++; if (lq_sta->missed_rate_counter > IL_MISSED_RATE_MAX) { lq_sta->missed_rate_counter = 0; - il_send_lq_cmd(priv, ctx, &lq_sta->lq, + il_send_lq_cmd(il, ctx, &lq_sta->lq, CMD_ASYNC, false); } /* Regardless, ignore this status info for outdated rate */ @@ -910,15 +910,15 @@ il4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, curr_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); other_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); } else { - IL_DEBUG_RATE(priv, + IL_DEBUG_RATE(il, "Neither active nor search matches tx rate\n"); tmp_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - IL_DEBUG_RATE(priv, "active- lq:%x, ant:%x, SGI:%d\n", + IL_DEBUG_RATE(il, "active- lq:%x, ant:%x, SGI:%d\n", tmp_tbl->lq_type, tmp_tbl->ant_type, tmp_tbl->is_SGI); tmp_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); - IL_DEBUG_RATE(priv, "search- lq:%x, ant:%x, SGI:%d\n", + IL_DEBUG_RATE(il, "search- lq:%x, ant:%x, SGI:%d\n", tmp_tbl->lq_type, tmp_tbl->ant_type, tmp_tbl->is_SGI); - IL_DEBUG_RATE(priv, "actual- lq:%x, ant:%x, SGI:%d\n", + IL_DEBUG_RATE(il, "actual- lq:%x, ant:%x, SGI:%d\n", tbl_type.lq_type, tbl_type.ant_type, tbl_type.is_SGI); /* * no matching table found, let's by-pass the data collection @@ -937,7 +937,7 @@ il4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, */ if (info->flags & IEEE80211_TX_STAT_AMPDU) { tx_rate = le32_to_cpu(table->rs_table[0].rate_n_flags); - il4965_rs_get_tbl_info_from_mcs(tx_rate, priv->band, &tbl_type, + il4965_rs_get_tbl_info_from_mcs(tx_rate, il->band, &tbl_type, &rs_index); il4965_rs_collect_tx_data(curr_tbl, rs_index, info->status.ampdu_len, @@ -962,7 +962,7 @@ il4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, /* Collect data for each rate used during failed TX attempts */ for (i = 0; i <= retries; ++i) { tx_rate = le32_to_cpu(table->rs_table[i].rate_n_flags); - il4965_rs_get_tbl_info_from_mcs(tx_rate, priv->band, + il4965_rs_get_tbl_info_from_mcs(tx_rate, il->band, &tbl_type, &rs_index); /* * Only collect stats if retried rate is in the same RS @@ -990,7 +990,7 @@ il4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, done: /* See if there's a better rate or modulation mode to try. */ if (sta && sta->supp_rates[sband->band]) - il4965_rs_rate_scale_perform(priv, skb, sta, lq_sta); + il4965_rs_rate_scale_perform(il, skb, sta, lq_sta); } /* @@ -1001,10 +1001,10 @@ done: * These control how long we stay using same modulation mode before * searching for a new mode. */ -static void il4965_rs_set_stay_in_table(struct il_priv *priv, u8 is_legacy, +static void il4965_rs_set_stay_in_table(struct il_priv *il, u8 is_legacy, struct il_lq_sta *lq_sta) { - IL_DEBUG_RATE(priv, "we are staying in the same table\n"); + IL_DEBUG_RATE(il, "we are staying in the same table\n"); lq_sta->stay_in_tbl = 1; /* only place this gets set */ if (is_legacy) { lq_sta->table_count_limit = IL_LEGACY_TABLE_COUNT; @@ -1077,7 +1077,7 @@ static void il4965_rs_set_expected_tpt_table(struct il_lq_sta *lq_sta, * to decrease to match "active" throughput. When moving from MIMO to SISO, * bit rate will typically need to increase, but not if performance was bad. */ -static s32 il4965_rs_get_best_rate(struct il_priv *priv, +static s32 il4965_rs_get_best_rate(struct il_priv *il, struct il_lq_sta *lq_sta, struct il_scale_tbl_info *tbl, /* "search" */ u16 rate_mask, s8 index) @@ -1098,7 +1098,7 @@ static s32 il4965_rs_get_best_rate(struct il_priv *priv, new_rate = high = low = start_hi = IL_RATE_INVALID; for (; ;) { - high_low = il4965_rs_get_adjacent_rate(priv, rate, rate_mask, + high_low = il4965_rs_get_adjacent_rate(il, rate, rate_mask, tbl->lq_type); low = high_low & 0xff; @@ -1171,7 +1171,7 @@ static s32 il4965_rs_get_best_rate(struct il_priv *priv, /* * Set up search table for MIMO2 */ -static int il4965_rs_switch_to_mimo2(struct il_priv *priv, +static int il4965_rs_switch_to_mimo2(struct il_priv *il, struct il_lq_sta *lq_sta, struct ieee80211_conf *conf, struct ieee80211_sta *sta, @@ -1191,10 +1191,10 @@ static int il4965_rs_switch_to_mimo2(struct il_priv *priv, return -1; /* Need both Tx chains/antennas to support MIMO */ - if (priv->hw_params.tx_chains_num < 2) + if (il->hw_params.tx_chains_num < 2) return -1; - IL_DEBUG_RATE(priv, "LQ: try to switch to MIMO2\n"); + IL_DEBUG_RATE(il, "LQ: try to switch to MIMO2\n"); tbl->lq_type = LQ_MIMO2; tbl->is_dup = lq_sta->is_dup; @@ -1202,27 +1202,27 @@ static int il4965_rs_switch_to_mimo2(struct il_priv *priv, tbl->max_search = IL_MAX_SEARCH; rate_mask = lq_sta->active_mimo2_rate; - if (il_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap)) + if (il_is_ht40_tx_allowed(il, ctx, &sta->ht_cap)) tbl->is_ht40 = 1; else tbl->is_ht40 = 0; il4965_rs_set_expected_tpt_table(lq_sta, tbl); - rate = il4965_rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index); + rate = il4965_rs_get_best_rate(il, lq_sta, tbl, rate_mask, index); - IL_DEBUG_RATE(priv, "LQ: MIMO2 best rate %d mask %X\n", + IL_DEBUG_RATE(il, "LQ: MIMO2 best rate %d mask %X\n", rate, rate_mask); if ((rate == IL_RATE_INVALID) || !((1 << rate) & rate_mask)) { - IL_DEBUG_RATE(priv, + IL_DEBUG_RATE(il, "Can't switch with index %d rate mask %x\n", rate, rate_mask); return -1; } - tbl->current_rate = il4965_rate_n_flags_from_tbl(priv, + tbl->current_rate = il4965_rate_n_flags_from_tbl(il, tbl, rate, is_green); - IL_DEBUG_RATE(priv, "LQ: Switch to new mcs %X index is green %X\n", + IL_DEBUG_RATE(il, "LQ: Switch to new mcs %X index is green %X\n", tbl->current_rate, is_green); return 0; } @@ -1230,7 +1230,7 @@ static int il4965_rs_switch_to_mimo2(struct il_priv *priv, /* * Set up search table for SISO */ -static int il4965_rs_switch_to_siso(struct il_priv *priv, +static int il4965_rs_switch_to_siso(struct il_priv *il, struct il_lq_sta *lq_sta, struct ieee80211_conf *conf, struct ieee80211_sta *sta, @@ -1245,7 +1245,7 @@ static int il4965_rs_switch_to_siso(struct il_priv *priv, if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) return -1; - IL_DEBUG_RATE(priv, "LQ: try to switch to SISO\n"); + IL_DEBUG_RATE(il, "LQ: try to switch to SISO\n"); tbl->is_dup = lq_sta->is_dup; tbl->lq_type = LQ_SISO; @@ -1253,7 +1253,7 @@ static int il4965_rs_switch_to_siso(struct il_priv *priv, tbl->max_search = IL_MAX_SEARCH; rate_mask = lq_sta->active_siso_rate; - if (il_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap)) + if (il_is_ht40_tx_allowed(il, ctx, &sta->ht_cap)) tbl->is_ht40 = 1; else tbl->is_ht40 = 0; @@ -1262,18 +1262,18 @@ static int il4965_rs_switch_to_siso(struct il_priv *priv, tbl->is_SGI = 0; /*11n spec: no SGI in SISO+Greenfield*/ il4965_rs_set_expected_tpt_table(lq_sta, tbl); - rate = il4965_rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index); + rate = il4965_rs_get_best_rate(il, lq_sta, tbl, rate_mask, index); - IL_DEBUG_RATE(priv, "LQ: get best rate %d mask %X\n", rate, rate_mask); + IL_DEBUG_RATE(il, "LQ: get best rate %d mask %X\n", rate, rate_mask); if ((rate == IL_RATE_INVALID) || !((1 << rate) & rate_mask)) { - IL_DEBUG_RATE(priv, + IL_DEBUG_RATE(il, "can not switch with index %d rate mask %x\n", rate, rate_mask); return -1; } - tbl->current_rate = il4965_rate_n_flags_from_tbl(priv, + tbl->current_rate = il4965_rate_n_flags_from_tbl(il, tbl, rate, is_green); - IL_DEBUG_RATE(priv, "LQ: Switch to new mcs %X index is green %X\n", + IL_DEBUG_RATE(il, "LQ: Switch to new mcs %X index is green %X\n", tbl->current_rate, is_green); return 0; } @@ -1281,7 +1281,7 @@ static int il4965_rs_switch_to_siso(struct il_priv *priv, /* * Try to switch to new modulation mode from legacy */ -static int il4965_rs_move_legacy_other(struct il_priv *priv, +static int il4965_rs_move_legacy_other(struct il_priv *il, struct il_lq_sta *lq_sta, struct ieee80211_conf *conf, struct ieee80211_sta *sta, @@ -1294,8 +1294,8 @@ static int il4965_rs_move_legacy_other(struct il_priv *priv, u32 sz = (sizeof(struct il_scale_tbl_info) - (sizeof(struct il_rate_scale_data) * IL_RATE_COUNT)); u8 start_action; - u8 valid_tx_ant = priv->hw_params.valid_tx_ant; - u8 tx_chains_num = priv->hw_params.tx_chains_num; + u8 valid_tx_ant = il->hw_params.valid_tx_ant; + u8 tx_chains_num = il->hw_params.tx_chains_num; int ret = 0; u8 update_search_tbl_counter = 0; @@ -1307,7 +1307,7 @@ static int il4965_rs_move_legacy_other(struct il_priv *priv, switch (tbl->action) { case IL_LEGACY_SWITCH_ANTENNA1: case IL_LEGACY_SWITCH_ANTENNA2: - IL_DEBUG_RATE(priv, "LQ: Legacy toggle Antenna\n"); + IL_DEBUG_RATE(il, "LQ: Legacy toggle Antenna\n"); if ((tbl->action == IL_LEGACY_SWITCH_ANTENNA1 && tx_chains_num <= 1) || @@ -1331,12 +1331,12 @@ static int il4965_rs_move_legacy_other(struct il_priv *priv, } break; case IL_LEGACY_SWITCH_SISO: - IL_DEBUG_RATE(priv, "LQ: Legacy switch to SISO\n"); + IL_DEBUG_RATE(il, "LQ: Legacy switch to SISO\n"); /* Set up search table to try SISO */ memcpy(search_tbl, tbl, sz); search_tbl->is_SGI = 0; - ret = il4965_rs_switch_to_siso(priv, lq_sta, conf, sta, + ret = il4965_rs_switch_to_siso(il, lq_sta, conf, sta, search_tbl, index); if (!ret) { lq_sta->action_counter = 0; @@ -1347,7 +1347,7 @@ static int il4965_rs_move_legacy_other(struct il_priv *priv, case IL_LEGACY_SWITCH_MIMO2_AB: case IL_LEGACY_SWITCH_MIMO2_AC: case IL_LEGACY_SWITCH_MIMO2_BC: - IL_DEBUG_RATE(priv, "LQ: Legacy switch to MIMO2\n"); + IL_DEBUG_RATE(il, "LQ: Legacy switch to MIMO2\n"); /* Set up search table to try MIMO */ memcpy(search_tbl, tbl, sz); @@ -1364,7 +1364,7 @@ static int il4965_rs_move_legacy_other(struct il_priv *priv, search_tbl->ant_type)) break; - ret = il4965_rs_switch_to_mimo2(priv, lq_sta, + ret = il4965_rs_switch_to_mimo2(il, lq_sta, conf, sta, search_tbl, index); if (!ret) { @@ -1398,7 +1398,7 @@ out: /* * Try to switch to new modulation mode from SISO */ -static int il4965_rs_move_siso_to_other(struct il_priv *priv, +static int il4965_rs_move_siso_to_other(struct il_priv *il, struct il_lq_sta *lq_sta, struct ieee80211_conf *conf, struct ieee80211_sta *sta, int index) @@ -1412,8 +1412,8 @@ static int il4965_rs_move_siso_to_other(struct il_priv *priv, u32 sz = (sizeof(struct il_scale_tbl_info) - (sizeof(struct il_rate_scale_data) * IL_RATE_COUNT)); u8 start_action; - u8 valid_tx_ant = priv->hw_params.valid_tx_ant; - u8 tx_chains_num = priv->hw_params.tx_chains_num; + u8 valid_tx_ant = il->hw_params.valid_tx_ant; + u8 tx_chains_num = il->hw_params.tx_chains_num; u8 update_search_tbl_counter = 0; int ret; @@ -1424,7 +1424,7 @@ static int il4965_rs_move_siso_to_other(struct il_priv *priv, switch (tbl->action) { case IL_SISO_SWITCH_ANTENNA1: case IL_SISO_SWITCH_ANTENNA2: - IL_DEBUG_RATE(priv, "LQ: SISO toggle Antenna\n"); + IL_DEBUG_RATE(il, "LQ: SISO toggle Antenna\n"); if ((tbl->action == IL_SISO_SWITCH_ANTENNA1 && tx_chains_num <= 1) || (tbl->action == IL_SISO_SWITCH_ANTENNA2 && @@ -1444,7 +1444,7 @@ static int il4965_rs_move_siso_to_other(struct il_priv *priv, case IL_SISO_SWITCH_MIMO2_AB: case IL_SISO_SWITCH_MIMO2_AC: case IL_SISO_SWITCH_MIMO2_BC: - IL_DEBUG_RATE(priv, "LQ: SISO switch to MIMO2\n"); + IL_DEBUG_RATE(il, "LQ: SISO switch to MIMO2\n"); memcpy(search_tbl, tbl, sz); search_tbl->is_SGI = 0; @@ -1459,7 +1459,7 @@ static int il4965_rs_move_siso_to_other(struct il_priv *priv, search_tbl->ant_type)) break; - ret = il4965_rs_switch_to_mimo2(priv, lq_sta, + ret = il4965_rs_switch_to_mimo2(il, lq_sta, conf, sta, search_tbl, index); if (!ret) @@ -1473,14 +1473,14 @@ static int il4965_rs_move_siso_to_other(struct il_priv *priv, IEEE80211_HT_CAP_SGI_40)) break; - IL_DEBUG_RATE(priv, "LQ: SISO toggle SGI/NGI\n"); + IL_DEBUG_RATE(il, "LQ: SISO toggle SGI/NGI\n"); memcpy(search_tbl, tbl, sz); if (is_green) { if (!tbl->is_SGI) break; else - IL_ERR(priv, + IL_ERR(il, "SGI was set in GF+SISO\n"); } search_tbl->is_SGI = !tbl->is_SGI; @@ -1491,7 +1491,7 @@ static int il4965_rs_move_siso_to_other(struct il_priv *priv, break; } search_tbl->current_rate = - il4965_rate_n_flags_from_tbl(priv, search_tbl, + il4965_rate_n_flags_from_tbl(il, search_tbl, index, is_green); update_search_tbl_counter = 1; goto out; @@ -1520,7 +1520,7 @@ static int il4965_rs_move_siso_to_other(struct il_priv *priv, /* * Try to switch to new modulation mode from MIMO2 */ -static int il4965_rs_move_mimo2_to_other(struct il_priv *priv, +static int il4965_rs_move_mimo2_to_other(struct il_priv *il, struct il_lq_sta *lq_sta, struct ieee80211_conf *conf, struct ieee80211_sta *sta, int index) @@ -1534,8 +1534,8 @@ static int il4965_rs_move_mimo2_to_other(struct il_priv *priv, u32 sz = (sizeof(struct il_scale_tbl_info) - (sizeof(struct il_rate_scale_data) * IL_RATE_COUNT)); u8 start_action; - u8 valid_tx_ant = priv->hw_params.valid_tx_ant; - u8 tx_chains_num = priv->hw_params.tx_chains_num; + u8 valid_tx_ant = il->hw_params.valid_tx_ant; + u8 tx_chains_num = il->hw_params.tx_chains_num; u8 update_search_tbl_counter = 0; int ret; @@ -1545,7 +1545,7 @@ static int il4965_rs_move_mimo2_to_other(struct il_priv *priv, switch (tbl->action) { case IL_MIMO2_SWITCH_ANTENNA1: case IL_MIMO2_SWITCH_ANTENNA2: - IL_DEBUG_RATE(priv, "LQ: MIMO2 toggle Antennas\n"); + IL_DEBUG_RATE(il, "LQ: MIMO2 toggle Antennas\n"); if (tx_chains_num <= 2) break; @@ -1563,7 +1563,7 @@ static int il4965_rs_move_mimo2_to_other(struct il_priv *priv, case IL_MIMO2_SWITCH_SISO_A: case IL_MIMO2_SWITCH_SISO_B: case IL_MIMO2_SWITCH_SISO_C: - IL_DEBUG_RATE(priv, "LQ: MIMO2 switch to SISO\n"); + IL_DEBUG_RATE(il, "LQ: MIMO2 switch to SISO\n"); /* Set up new search table for SISO */ memcpy(search_tbl, tbl, sz); @@ -1579,7 +1579,7 @@ static int il4965_rs_move_mimo2_to_other(struct il_priv *priv, search_tbl->ant_type)) break; - ret = il4965_rs_switch_to_siso(priv, lq_sta, + ret = il4965_rs_switch_to_siso(il, lq_sta, conf, sta, search_tbl, index); if (!ret) @@ -1595,7 +1595,7 @@ static int il4965_rs_move_mimo2_to_other(struct il_priv *priv, IEEE80211_HT_CAP_SGI_40)) break; - IL_DEBUG_RATE(priv, "LQ: MIMO2 toggle SGI/NGI\n"); + IL_DEBUG_RATE(il, "LQ: MIMO2 toggle SGI/NGI\n"); /* Set up new search table for MIMO2 */ memcpy(search_tbl, tbl, sz); @@ -1613,7 +1613,7 @@ static int il4965_rs_move_mimo2_to_other(struct il_priv *priv, break; } search_tbl->current_rate = - il4965_rate_n_flags_from_tbl(priv, search_tbl, + il4965_rate_n_flags_from_tbl(il, search_tbl, index, is_green); update_search_tbl_counter = 1; goto out; @@ -1654,9 +1654,9 @@ il4965_rs_stay_in_table(struct il_lq_sta *lq_sta, bool force_search) int i; int active_tbl; int flush_interval_passed = 0; - struct il_priv *priv; + struct il_priv *il; - priv = lq_sta->drv; + il = lq_sta->drv; active_tbl = lq_sta->active_tbl; tbl = &(lq_sta->lq_info[active_tbl]); @@ -1684,7 +1684,7 @@ il4965_rs_stay_in_table(struct il_lq_sta *lq_sta, bool force_search) (lq_sta->total_success > lq_sta->max_success_limit) || ((!lq_sta->search_better_tbl) && (lq_sta->flush_timer) && (flush_interval_passed))) { - IL_DEBUG_RATE(priv, "LQ: stay is expired %d %d %d\n:", + IL_DEBUG_RATE(il, "LQ: stay is expired %d %d %d\n:", lq_sta->total_failed, lq_sta->total_success, flush_interval_passed); @@ -1707,7 +1707,7 @@ il4965_rs_stay_in_table(struct il_lq_sta *lq_sta, bool force_search) lq_sta->table_count_limit) { lq_sta->table_count = 0; - IL_DEBUG_RATE(priv, + IL_DEBUG_RATE(il, "LQ: stay in table clear win\n"); for (i = 0; i < IL_RATE_COUNT; i++) il4965_rs_rate_scale_clear_window( @@ -1730,7 +1730,7 @@ il4965_rs_stay_in_table(struct il_lq_sta *lq_sta, bool force_search) * setup rate table in uCode * return rate_n_flags as used in the table */ -static u32 il4965_rs_update_rate_tbl(struct il_priv *priv, +static u32 il4965_rs_update_rate_tbl(struct il_priv *il, struct il_rxon_context *ctx, struct il_lq_sta *lq_sta, struct il_scale_tbl_info *tbl, @@ -1739,9 +1739,9 @@ static u32 il4965_rs_update_rate_tbl(struct il_priv *priv, u32 rate; /* Update uCode's rate table. */ - rate = il4965_rate_n_flags_from_tbl(priv, tbl, index, is_green); - il4965_rs_fill_link_cmd(priv, lq_sta, rate); - il_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false); + rate = il4965_rate_n_flags_from_tbl(il, tbl, index, is_green); + il4965_rs_fill_link_cmd(il, lq_sta, rate); + il_send_lq_cmd(il, ctx, &lq_sta->lq, CMD_ASYNC, false); return rate; } @@ -1749,12 +1749,12 @@ static u32 il4965_rs_update_rate_tbl(struct il_priv *priv, /* * Do rate scaling and search for new modulation mode. */ -static void il4965_rs_rate_scale_perform(struct il_priv *priv, +static void il4965_rs_rate_scale_perform(struct il_priv *il, struct sk_buff *skb, struct ieee80211_sta *sta, struct il_lq_sta *lq_sta) { - struct ieee80211_hw *hw = priv->hw; + struct ieee80211_hw *hw = il->hw; struct ieee80211_conf *conf = &hw->conf; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; @@ -1783,7 +1783,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, struct il_station_priv *sta_priv = (void *)sta->drv_priv; struct il_rxon_context *ctx = sta_priv->common.ctx; - IL_DEBUG_RATE(priv, "rate scale calculate new rate for skb\n"); + IL_DEBUG_RATE(il, "rate scale calculate new rate for skb\n"); /* Send management frames and NO_ACK data using lowest rate. */ /* TODO: this could probably be improved.. */ @@ -1798,7 +1798,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, tid = il4965_rs_tl_add_packet(lq_sta, hdr); if ((tid != MAX_TID_COUNT) && (lq_sta->tx_agg_tid_en & (1 << tid))) { - tid_data = &priv->stations[lq_sta->lq.sta_id].tid[tid]; + tid_data = &il->stations[lq_sta->lq.sta_id].tid[tid]; if (tid_data->agg.state == IL_AGG_OFF) lq_sta->is_agg = 0; else @@ -1826,13 +1826,13 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, /* current tx rate */ index = lq_sta->last_txrate_idx; - IL_DEBUG_RATE(priv, "Rate scale index %d for type %d\n", index, + IL_DEBUG_RATE(il, "Rate scale index %d for type %d\n", index, tbl->lq_type); /* rates available for this association, and for modulation mode */ rate_mask = il4965_rs_get_supported_rates(lq_sta, hdr, tbl->lq_type); - IL_DEBUG_RATE(priv, "mask 0x%04X\n", rate_mask); + IL_DEBUG_RATE(il, "mask 0x%04X\n", rate_mask); /* mask with station rate restriction */ if (is_legacy(tbl->lq_type)) { @@ -1851,7 +1851,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, rate_scale_index_msk = rate_mask; if (!((1 << index) & rate_scale_index_msk)) { - IL_ERR(priv, "Current Rate is not valid\n"); + IL_ERR(il, "Current Rate is not valid\n"); if (lq_sta->search_better_tbl) { /* revert to active table if search table is not valid*/ tbl->lq_type = LQ_NONE; @@ -1859,7 +1859,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); /* get "active" rate info */ index = il4965_hwrate_to_plcp_idx(tbl->current_rate); - rate = il4965_rs_update_rate_tbl(priv, ctx, lq_sta, + rate = il4965_rs_update_rate_tbl(il, ctx, lq_sta, tbl, index, is_green); } return; @@ -1867,7 +1867,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, /* Get expected throughput table and history window for current rate */ if (!tbl->expected_tpt) { - IL_ERR(priv, "tbl->expected_tpt is NULL\n"); + IL_ERR(il, "tbl->expected_tpt is NULL\n"); return; } @@ -1892,7 +1892,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, fail_count = window->counter - window->success_counter; if ((fail_count < IL_RATE_MIN_FAILURE_TH) && (window->success_counter < IL_RATE_MIN_SUCCESS_TH)) { - IL_DEBUG_RATE(priv, "LQ: still below TH. succ=%d total=%d " + IL_DEBUG_RATE(il, "LQ: still below TH. succ=%d total=%d " "for index %d\n", window->success_counter, window->counter, index); @@ -1909,7 +1909,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, * actual average throughput */ if (window->average_tpt != ((window->success_ratio * tbl->expected_tpt[index] + 64) / 128)) { - IL_ERR(priv, + IL_ERR(il, "expected_tpt should have been calculated by now\n"); window->average_tpt = ((window->success_ratio * tbl->expected_tpt[index] + 64) / 128); @@ -1922,7 +1922,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, * continuing to use the setup that we've been trying. */ if (window->average_tpt > lq_sta->last_tpt) { - IL_DEBUG_RATE(priv, "LQ: SWITCHING TO NEW TABLE " + IL_DEBUG_RATE(il, "LQ: SWITCHING TO NEW TABLE " "suc=%d cur-tpt=%d old-tpt=%d\n", window->success_ratio, window->average_tpt, @@ -1938,7 +1938,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, /* Else poor success; go back to mode in "active" table */ } else { - IL_DEBUG_RATE(priv, "LQ: GOING BACK TO THE OLD TABLE " + IL_DEBUG_RATE(il, "LQ: GOING BACK TO THE OLD TABLE " "suc=%d cur-tpt=%d old-tpt=%d\n", window->success_ratio, window->average_tpt, @@ -1968,7 +1968,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, /* (Else) not in search of better modulation mode, try for better * starting rate, while staying in this mode. */ - high_low = il4965_rs_get_adjacent_rate(priv, index, + high_low = il4965_rs_get_adjacent_rate(il, index, rate_scale_index_msk, tbl->lq_type); low = high_low & 0xff; @@ -1992,7 +1992,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, /* Too many failures, decrease rate */ if ((sr <= IL_RATE_DECREASE_TH) || (current_tpt == 0)) { - IL_DEBUG_RATE(priv, + IL_DEBUG_RATE(il, "decrease rate because of low success_ratio\n"); scale_action = -1; @@ -2031,7 +2031,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, } else if (low_tpt != IL_INVALID_VALUE) { /* Lower rate has better throughput */ 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 (sr >= IL_RATE_INCREASE_TH) { @@ -2070,14 +2070,14 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, break; } - IL_DEBUG_RATE(priv, "choose rate scale index %d action %d low %d " + IL_DEBUG_RATE(il, "choose rate scale index %d action %d low %d " "high %d type %d\n", index, scale_action, low, high, tbl->lq_type); lq_update: /* Replace uCode's rate table for the destination station. */ if (update_lq) - rate = il4965_rs_update_rate_tbl(priv, ctx, lq_sta, + rate = il4965_rs_update_rate_tbl(il, ctx, lq_sta, tbl, index, is_green); /* Should we stay with this modulation mode, @@ -2098,13 +2098,13 @@ lq_update: /* Select a new "search" modulation mode to try. * If one is found, set up the new "search" table. */ if (is_legacy(tbl->lq_type)) - il4965_rs_move_legacy_other(priv, lq_sta, + il4965_rs_move_legacy_other(il, lq_sta, conf, sta, index); else if (is_siso(tbl->lq_type)) - il4965_rs_move_siso_to_other(priv, lq_sta, + il4965_rs_move_siso_to_other(il, lq_sta, conf, sta, index); else /* (is_mimo2(tbl->lq_type)) */ - il4965_rs_move_mimo2_to_other(priv, lq_sta, + il4965_rs_move_mimo2_to_other(il, lq_sta, conf, sta, index); /* If new "search" mode was selected, set up in uCode table */ @@ -2118,12 +2118,12 @@ lq_update: /* Use new "search" start rate */ index = il4965_hwrate_to_plcp_idx(tbl->current_rate); - IL_DEBUG_RATE(priv, + IL_DEBUG_RATE(il, "Switch current mcs: %X index: %d\n", tbl->current_rate, index); - il4965_rs_fill_link_cmd(priv, lq_sta, + il4965_rs_fill_link_cmd(il, lq_sta, tbl->current_rate); - il_send_lq_cmd(priv, ctx, + il_send_lq_cmd(il, ctx, &lq_sta->lq, CMD_ASYNC, false); } else done_search = 1; @@ -2138,8 +2138,8 @@ lq_update: tbl1 = &(lq_sta->lq_info[lq_sta->active_tbl]); if (is_legacy(tbl1->lq_type) && !conf_is_ht(conf) && lq_sta->action_counter > tbl1->max_search) { - IL_DEBUG_RATE(priv, "LQ: STAY in legacy table\n"); - il4965_rs_set_stay_in_table(priv, 1, lq_sta); + IL_DEBUG_RATE(il, "LQ: STAY in legacy table\n"); + il4965_rs_set_stay_in_table(il, 1, lq_sta); } /* If we're in an HT mode, and all 3 mode switch actions @@ -2151,21 +2151,21 @@ lq_update: (lq_sta->tx_agg_tid_en & (1 << tid)) && (tid != MAX_TID_COUNT)) { tid_data = - &priv->stations[lq_sta->lq.sta_id].tid[tid]; + &il->stations[lq_sta->lq.sta_id].tid[tid]; if (tid_data->agg.state == IL_AGG_OFF) { - IL_DEBUG_RATE(priv, + IL_DEBUG_RATE(il, "try to aggregate tid %d\n", tid); - il4965_rs_tl_turn_on_agg(priv, tid, + il4965_rs_tl_turn_on_agg(il, tid, lq_sta, sta); } } - il4965_rs_set_stay_in_table(priv, 0, lq_sta); + il4965_rs_set_stay_in_table(il, 0, lq_sta); } } out: - tbl->current_rate = il4965_rate_n_flags_from_tbl(priv, tbl, + tbl->current_rate = il4965_rate_n_flags_from_tbl(il, tbl, index, is_green); i = index; lq_sta->last_txrate_idx = i; @@ -2185,7 +2185,7 @@ out: * calling this function (which runs REPLY_TX_LINK_QUALITY_CMD, * which requires station table entry to exist). */ -static void il4965_rs_initialize_lq(struct il_priv *priv, +static void il4965_rs_initialize_lq(struct il_priv *il, struct ieee80211_conf *conf, struct ieee80211_sta *sta, struct il_lq_sta *lq_sta) @@ -2208,7 +2208,7 @@ static void il4965_rs_initialize_lq(struct il_priv *priv, i = lq_sta->last_txrate_idx; - valid_tx_ant = priv->hw_params.valid_tx_ant; + valid_tx_ant = il->hw_params.valid_tx_ant; if (!lq_sta->search_better_tbl) active_tbl = lq_sta->active_tbl; @@ -2227,31 +2227,31 @@ static void il4965_rs_initialize_lq(struct il_priv *priv, if (i >= IL_FIRST_CCK_RATE && i <= IL_LAST_CCK_RATE) rate |= RATE_MCS_CCK_MSK; - il4965_rs_get_tbl_info_from_mcs(rate, priv->band, tbl, &rate_idx); + il4965_rs_get_tbl_info_from_mcs(rate, il->band, tbl, &rate_idx); if (!il4965_rs_is_valid_ant(valid_tx_ant, tbl->ant_type)) il4965_rs_toggle_antenna(valid_tx_ant, &rate, tbl); - rate = il4965_rate_n_flags_from_tbl(priv, tbl, rate_idx, use_green); + rate = il4965_rate_n_flags_from_tbl(il, tbl, rate_idx, use_green); tbl->current_rate = rate; il4965_rs_set_expected_tpt_table(lq_sta, tbl); il4965_rs_fill_link_cmd(NULL, lq_sta, rate); - priv->stations[lq_sta->lq.sta_id].lq = &lq_sta->lq; - il_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_SYNC, true); + il->stations[lq_sta->lq.sta_id].lq = &lq_sta->lq; + il_send_lq_cmd(il, ctx, &lq_sta->lq, CMD_SYNC, true); } static void -il4965_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, +il4965_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta, struct ieee80211_tx_rate_control *txrc) { struct sk_buff *skb = txrc->skb; struct ieee80211_supported_band *sband = txrc->sband; - 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); - struct il_lq_sta *lq_sta = priv_sta; + struct il_lq_sta *lq_sta = il_sta; int rate_idx; - IL_DEBUG_RATE_LIMIT(priv, "rate scale calculate new rate for skb\n"); + IL_DEBUG_RATE_LIMIT(il, "rate scale calculate new rate for skb\n"); /* Get max rate if user set max rate */ if (lq_sta) { @@ -2266,12 +2266,12 @@ il4965_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, /* Treat uninitialized rate scaling data same as non-existing. */ if (lq_sta && !lq_sta->drv) { - IL_DEBUG_RATE(priv, "Rate scaling not initialized yet.\n"); - priv_sta = NULL; + IL_DEBUG_RATE(il, "Rate scaling not initialized yet.\n"); + il_sta = NULL; } /* Send management frames and NO_ACK data using lowest rate. */ - if (rate_control_send_low(sta, priv_sta, txrc)) + if (rate_control_send_low(sta, il_sta, txrc)) return; if (!lq_sta) @@ -2314,16 +2314,16 @@ il4965_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, } -static void *il4965_rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta, +static void *il4965_rs_alloc_sta(void *il_rate, struct ieee80211_sta *sta, gfp_t gfp) { struct il_lq_sta *lq_sta; struct il_station_priv *sta_priv = (struct il_station_priv *) sta->drv_priv; - struct il_priv *priv; + struct il_priv *il; - priv = (struct il_priv *)priv_rate; - IL_DEBUG_RATE(priv, "create station rate scale window\n"); + il = (struct il_priv *)il_rate; + IL_DEBUG_RATE(il, "create station rate scale window\n"); lq_sta = &sta_priv->lq_sta; @@ -2334,13 +2334,13 @@ static void *il4965_rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta, * Called after adding a new station to initialize rate scaling */ void -il4965_rs_rate_init(struct il_priv *priv, +il4965_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_id) { int i, j; - 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 ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; struct il_station_priv *sta_priv; struct il_lq_sta *lq_sta; @@ -2365,7 +2365,7 @@ il4965_rs_rate_init(struct il_priv *priv, il4965_rs_rate_scale_clear_window( &lq_sta->lq_info[j].win[i]); - IL_DEBUG_RATE(priv, "LQ:" + IL_DEBUG_RATE(il, "LQ:" "*** rate scale station global init for station %d ***\n", sta_id); /* TODO: what is a good starting rate for STA? About middle? Maybe not @@ -2377,8 +2377,8 @@ il4965_rs_rate_init(struct il_priv *priv, lq_sta->max_rate_idx = -1; lq_sta->missed_rate_counter = IL_MISSED_RATE_MAX; lq_sta->is_green = il4965_rs_use_green(sta); - lq_sta->active_legacy_rate = priv->active_rate & ~(0x1000); - lq_sta->band = priv->band; + lq_sta->active_legacy_rate = il->active_rate & ~(0x1000); + lq_sta->band = il->band; /* * active_siso_rate mask includes 9 MBits (bit 5), and CCK (bits 0-3), * supp_rates[] does not; shift to convert format, force 9 MBits off. @@ -2396,20 +2396,20 @@ il4965_rs_rate_init(struct il_priv *priv, /* These values will be overridden later */ lq_sta->lq.general_params.single_stream_ant_msk = - il4965_first_antenna(priv->hw_params.valid_tx_ant); + il4965_first_antenna(il->hw_params.valid_tx_ant); lq_sta->lq.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 (!lq_sta->lq.general_params.dual_stream_ant_msk) { lq_sta->lq.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) { lq_sta->lq.general_params.dual_stream_ant_msk = - priv->hw_params.valid_tx_ant; + il->hw_params.valid_tx_ant; } /* as default allow aggregation for all tids */ lq_sta->tx_agg_tid_en = IL_AGG_ALL_TID; - lq_sta->drv = priv; + lq_sta->drv = il; /* Set last_txrate_idx to lowest rate */ lq_sta->last_txrate_idx = rate_lowest_index(sband, sta); @@ -2421,10 +2421,10 @@ il4965_rs_rate_init(struct il_priv *priv, lq_sta->dbg_fixed_rate = 0; #endif - il4965_rs_initialize_lq(priv, conf, sta, lq_sta); + il4965_rs_initialize_lq(il, conf, sta, lq_sta); } -static void il4965_rs_fill_link_cmd(struct il_priv *priv, +static void il4965_rs_fill_link_cmd(struct il_priv *il, struct il_lq_sta *lq_sta, u32 new_rate) { struct il_scale_tbl_info tbl_type; @@ -2467,8 +2467,8 @@ static void il4965_rs_fill_link_cmd(struct il_priv *priv, index++; repeat_rate--; - if (priv) - valid_tx_ant = priv->hw_params.valid_tx_ant; + if (il) + valid_tx_ant = il->hw_params.valid_tx_ant; /* Fill rest of rate table */ while (index < LINK_QUAL_MAX_RETRY_NUM) { @@ -2479,7 +2479,7 @@ static void il4965_rs_fill_link_cmd(struct il_priv *priv, if (is_legacy(tbl_type.lq_type)) { if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) ant_toggle_cnt++; - else if (priv && + else if (il && il4965_rs_toggle_antenna(valid_tx_ant, &new_rate, &tbl_type)) ant_toggle_cnt = 1; @@ -2514,7 +2514,7 @@ static void il4965_rs_fill_link_cmd(struct il_priv *priv, if (is_legacy(tbl_type.lq_type)) { if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) ant_toggle_cnt++; - else if (priv && + else if (il && il4965_rs_toggle_antenna(valid_tx_ant, &new_rate, &tbl_type)) ant_toggle_cnt = 1; @@ -2551,18 +2551,18 @@ static void return hw->priv; } /* rate scale requires free function to be implemented */ -static void il4965_rs_free(void *priv_rate) +static void il4965_rs_free(void *il_rate) { return; } -static void il4965_rs_free_sta(void *priv_r, struct ieee80211_sta *sta, - void *priv_sta) +static void il4965_rs_free_sta(void *il_r, struct ieee80211_sta *sta, + void *il_sta) { - struct il_priv *priv __maybe_unused = priv_r; + struct il_priv *il __maybe_unused = il_r; - IL_DEBUG_RATE(priv, "enter\n"); - IL_DEBUG_RATE(priv, "leave\n"); + IL_DEBUG_RATE(il, "enter\n"); + IL_DEBUG_RATE(il, "leave\n"); } @@ -2575,28 +2575,28 @@ static int il4965_open_file_generic(struct inode *inode, struct file *file) static void il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta, u32 *rate_n_flags, int index) { - struct il_priv *priv; + struct il_priv *il; u8 valid_tx_ant; u8 ant_sel_tx; - priv = lq_sta->drv; - valid_tx_ant = priv->hw_params.valid_tx_ant; + il = lq_sta->drv; + valid_tx_ant = il->hw_params.valid_tx_ant; if (lq_sta->dbg_fixed_rate) { ant_sel_tx = ((lq_sta->dbg_fixed_rate & RATE_MCS_ANT_ABC_MSK) >> RATE_MCS_ANT_POS); if ((valid_tx_ant & ant_sel_tx) == ant_sel_tx) { *rate_n_flags = lq_sta->dbg_fixed_rate; - IL_DEBUG_RATE(priv, "Fixed rate ON\n"); + IL_DEBUG_RATE(il, "Fixed rate ON\n"); } else { lq_sta->dbg_fixed_rate = 0; - IL_ERR(priv, + IL_ERR(il, "Invalid antenna selection 0x%X, Valid is 0x%X\n", ant_sel_tx, valid_tx_ant); - IL_DEBUG_RATE(priv, "Fixed rate OFF\n"); + IL_DEBUG_RATE(il, "Fixed rate OFF\n"); } } else { - IL_DEBUG_RATE(priv, "Fixed rate OFF\n"); + IL_DEBUG_RATE(il, "Fixed rate OFF\n"); } } @@ -2604,7 +2604,7 @@ static ssize_t il4965_rs_sta_dbgfs_scale_table_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { struct il_lq_sta *lq_sta = file->private_data; - struct il_priv *priv; + struct il_priv *il; char buf[64]; size_t buf_size; u32 parsed_rate; @@ -2612,7 +2612,7 @@ static ssize_t il4965_rs_sta_dbgfs_scale_table_write(struct file *file, container_of(lq_sta, struct il_station_priv, lq_sta); struct il_rxon_context *ctx = sta_priv->common.ctx; - priv = lq_sta->drv; + il = lq_sta->drv; memset(buf, 0, sizeof(buf)); buf_size = min(count, sizeof(buf) - 1); if (copy_from_user(buf, user_buf, buf_size)) @@ -2627,7 +2627,7 @@ static ssize_t il4965_rs_sta_dbgfs_scale_table_write(struct file *file, lq_sta->active_siso_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ lq_sta->active_mimo2_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ - IL_DEBUG_RATE(priv, "sta_id %d rate 0x%X\n", + IL_DEBUG_RATE(il, "sta_id %d rate 0x%X\n", lq_sta->lq.sta_id, lq_sta->dbg_fixed_rate); if (lq_sta->dbg_fixed_rate) { @@ -2649,10 +2649,10 @@ static ssize_t il4965_rs_sta_dbgfs_scale_table_read(struct file *file, ssize_t ret; struct il_lq_sta *lq_sta = file->private_data; - struct il_priv *priv; + struct il_priv *il; struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - priv = lq_sta->drv; + il = lq_sta->drv; buff = kmalloc(1024, GFP_KERNEL); if (!buff) return -ENOMEM; @@ -2664,9 +2664,9 @@ static ssize_t il4965_rs_sta_dbgfs_scale_table_read(struct file *file, desc += sprintf(buff+desc, "fixed rate 0x%X\n", lq_sta->dbg_fixed_rate); desc += sprintf(buff+desc, "valid_tx_ant %s%s%s\n", - (priv->hw_params.valid_tx_ant & ANT_A) ? "ANT_A," : "", - (priv->hw_params.valid_tx_ant & ANT_B) ? "ANT_B," : "", - (priv->hw_params.valid_tx_ant & ANT_C) ? "ANT_C" : ""); + (il->hw_params.valid_tx_ant & ANT_A) ? "ANT_A," : "", + (il->hw_params.valid_tx_ant & ANT_B) ? "ANT_B," : "", + (il->hw_params.valid_tx_ant & ANT_C) ? "ANT_C" : ""); desc += sprintf(buff+desc, "lq type %s\n", (is_legacy(tbl->lq_type)) ? "legacy" : "HT"); if (is_Ht(tbl->lq_type)) { @@ -2781,10 +2781,10 @@ static ssize_t il4965_rs_sta_dbgfs_rate_scale_data_read(struct file *file, ssize_t ret; struct il_lq_sta *lq_sta = file->private_data; - struct il_priv *priv; + struct il_priv *il; struct il_scale_tbl_info *tbl = &lq_sta->lq_info[lq_sta->active_tbl]; - priv = lq_sta->drv; + il = lq_sta->drv; if (is_Ht(tbl->lq_type)) desc += sprintf(buff+desc, @@ -2805,10 +2805,10 @@ static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { .llseek = default_llseek, }; -static void il4965_rs_add_debugfs(void *priv, void *priv_sta, +static void il4965_rs_add_debugfs(void *il, void *il_sta, struct dentry *dir) { - struct il_lq_sta *lq_sta = priv_sta; + struct il_lq_sta *lq_sta = il_sta; lq_sta->rs_sta_dbgfs_scale_table_file = debugfs_create_file("rate_scale_table", S_IRUSR | S_IWUSR, dir, lq_sta, &rs_sta_dbgfs_scale_table_ops); @@ -2824,9 +2824,9 @@ static void il4965_rs_add_debugfs(void *priv, void *priv_sta, } -static void il4965_rs_remove_debugfs(void *priv, void *priv_sta) +static void il4965_rs_remove_debugfs(void *il, void *il_sta) { - struct il_lq_sta *lq_sta = priv_sta; + struct il_lq_sta *lq_sta = il_sta; debugfs_remove(lq_sta->rs_sta_dbgfs_scale_table_file); debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); debugfs_remove(lq_sta->rs_sta_dbgfs_rate_scale_data_file); @@ -2840,8 +2840,8 @@ static void il4965_rs_remove_debugfs(void *priv, void *priv_sta) * station is added we ignore it. */ static void -il4965_rs_rate_init_stub(void *priv_r, struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *priv_sta) +il4965_rs_rate_init_stub(void *il_r, struct ieee80211_supported_band *sband, + struct ieee80211_sta *sta, void *il_sta) { } static struct rate_control_ops rs_4965_ops = { diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-rx.c b/drivers/net/wireless/iwlegacy/iwl-4965-rx.c index 47cbe565a530..c987c80a37cf 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-rx.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-rx.c @@ -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); } diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-sta.c b/drivers/net/wireless/iwlegacy/iwl-4965-sta.c index 3ac9aef439a6..20290d24fd62 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-sta.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-sta.c @@ -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); } diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c index 3fdb9d9201dd..59d737496b5c 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c @@ -99,7 +99,7 @@ il4965_get_fifo_from_tid(struct il_rxon_context *ctx, u16 tid) /* * handle build REPLY_TX command notification. */ -static void il4965_tx_cmd_build_basic(struct il_priv *priv, +static void il4965_tx_cmd_build_basic(struct il_priv *il, struct sk_buff *skb, struct il_tx_cmd *tx_cmd, struct ieee80211_tx_info *info, @@ -137,7 +137,7 @@ static void il4965_tx_cmd_build_basic(struct il_priv *priv, tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; } - il_tx_cmd_protection(priv, info, fc, &tx_flags); + il_tx_cmd_protection(il, info, fc, &tx_flags); tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK); if (ieee80211_is_mgmt(fc)) { @@ -156,7 +156,7 @@ static void il4965_tx_cmd_build_basic(struct il_priv *priv, #define RTS_DFAULT_RETRY_LIMIT 60 -static void il4965_tx_cmd_build_rate(struct il_priv *priv, +static void il4965_tx_cmd_build_rate(struct il_priv *il, struct il_tx_cmd *tx_cmd, struct ieee80211_tx_info *info, __le16 fc) @@ -197,7 +197,7 @@ static void il4965_tx_cmd_build_rate(struct il_priv *priv, rate_idx = info->control.rates[0].idx; if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS || (rate_idx < 0) || (rate_idx > IL_RATE_COUNT_LEGACY)) - rate_idx = rate_lowest_index(&priv->bands[info->band], + rate_idx = rate_lowest_index(&il->bands[info->band], info->control.sta); /* For 5 GHZ band, remap mac80211 rate indices into driver indices */ if (info->band == IEEE80211_BAND_5GHZ) @@ -212,16 +212,16 @@ static void il4965_tx_cmd_build_rate(struct il_priv *priv, rate_flags |= RATE_MCS_CCK_MSK; /* Set up antennas */ - priv->mgmt_tx_ant = il4965_toggle_tx_ant(priv, priv->mgmt_tx_ant, - priv->hw_params.valid_tx_ant); + il->mgmt_tx_ant = il4965_toggle_tx_ant(il, il->mgmt_tx_ant, + il->hw_params.valid_tx_ant); - rate_flags |= il4965_ant_idx_to_flags(priv->mgmt_tx_ant); + rate_flags |= il4965_ant_idx_to_flags(il->mgmt_tx_ant); /* Set the rate in the TX cmd */ tx_cmd->rate_n_flags = il4965_hw_set_rate_n_flags(rate_plcp, rate_flags); } -static void il4965_tx_cmd_build_hwcrypto(struct il_priv *priv, +static void il4965_tx_cmd_build_hwcrypto(struct il_priv *il, struct ieee80211_tx_info *info, struct il_tx_cmd *tx_cmd, struct sk_buff *skb_frag, @@ -235,13 +235,13 @@ static void il4965_tx_cmd_build_hwcrypto(struct il_priv *priv, memcpy(tx_cmd->key, keyconf->key, keyconf->keylen); if (info->flags & IEEE80211_TX_CTL_AMPDU) tx_cmd->tx_flags |= TX_CMD_FLG_AGG_CCMP_MSK; - IL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n"); + IL_DEBUG_TX(il, "tx_cmd with AES hwcrypto\n"); break; case WLAN_CIPHER_SUITE_TKIP: tx_cmd->sec_ctl = TX_CMD_SEC_TKIP; ieee80211_get_tkip_p2k(keyconf, skb_frag, tx_cmd->key); - IL_DEBUG_TX(priv, "tx_cmd with tkip hwcrypto\n"); + IL_DEBUG_TX(il, "tx_cmd with tkip hwcrypto\n"); break; case WLAN_CIPHER_SUITE_WEP104: @@ -253,12 +253,12 @@ static void il4965_tx_cmd_build_hwcrypto(struct il_priv *priv, memcpy(&tx_cmd->key[3], keyconf->key, keyconf->keylen); - IL_DEBUG_TX(priv, "Configuring packet for WEP encryption " + IL_DEBUG_TX(il, "Configuring packet for WEP encryption " "with key %d\n", keyconf->keyidx); break; default: - IL_ERR(priv, "Unknown encode cipher %x\n", keyconf->cipher); + IL_ERR(il, "Unknown encode cipher %x\n", keyconf->cipher); break; } } @@ -266,7 +266,7 @@ static void il4965_tx_cmd_build_hwcrypto(struct il_priv *priv, /* * start REPLY_TX command process */ -int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) +int il4965_tx_skb(struct il_priv *il, struct sk_buff *skb) { struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); @@ -277,7 +277,7 @@ int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) struct il_device_cmd *out_cmd; struct il_cmd_meta *out_meta; struct il_tx_cmd *tx_cmd; - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; int txq_id; dma_addr_t phys_addr; dma_addr_t txcmd_phys; @@ -296,9 +296,9 @@ int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) if (info->control.vif) ctx = il_rxon_ctx_from_vif(info->control.vif); - spin_lock_irqsave(&priv->lock, flags); - if (il_is_rfkill(priv)) { - IL_DEBUG_DROP(priv, "Dropping - RF KILL\n"); + spin_lock_irqsave(&il->lock, flags); + if (il_is_rfkill(il)) { + IL_DEBUG_DROP(il, "Dropping - RF KILL\n"); goto drop_unlock; } @@ -306,11 +306,11 @@ int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG if (ieee80211_is_auth(fc)) - IL_DEBUG_TX(priv, "Sending AUTH frame\n"); + IL_DEBUG_TX(il, "Sending AUTH frame\n"); else if (ieee80211_is_assoc_req(fc)) - IL_DEBUG_TX(priv, "Sending ASSOC frame\n"); + IL_DEBUG_TX(il, "Sending ASSOC frame\n"); else if (ieee80211_is_reassoc_req(fc)) - IL_DEBUG_TX(priv, "Sending REASSOC frame\n"); + IL_DEBUG_TX(il, "Sending REASSOC frame\n"); #endif hdr_len = ieee80211_hdrlen(fc); @@ -320,16 +320,16 @@ int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) sta_id = ctx->bcast_sta_id; else { /* Find index into station table for destination station */ - sta_id = il_sta_id_or_broadcast(priv, ctx, info->control.sta); + sta_id = il_sta_id_or_broadcast(il, ctx, info->control.sta); if (sta_id == IL_INVALID_STATION) { - IL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", + IL_DEBUG_DROP(il, "Dropping - INVALID STATION: %pM\n", hdr->addr1); goto drop_unlock; } } - IL_DEBUG_TX(priv, "station Id %d\n", sta_id); + IL_DEBUG_TX(il, "station Id %d\n", sta_id); if (sta) sta_priv = (void *)sta->drv_priv; @@ -345,7 +345,7 @@ int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) * For now set the counter to just 1 since we do not * support uAPSD yet. */ - il4965_sta_modify_sleep_tx_count(priv, sta_id, 1); + il4965_sta_modify_sleep_tx_count(il, sta_id, 1); } /* @@ -363,17 +363,17 @@ int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) } else txq_id = ctx->ac_to_queue[skb_get_queue_mapping(skb)]; - /* irqs already disabled/saved above when locking priv->lock */ - spin_lock(&priv->sta_lock); + /* irqs already disabled/saved above when locking il->lock */ + spin_lock(&il->sta_lock); if (ieee80211_is_data_qos(fc)) { qc = ieee80211_get_qos_ctl(hdr); tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; if (WARN_ON_ONCE(tid >= MAX_TID_COUNT)) { - spin_unlock(&priv->sta_lock); + spin_unlock(&il->sta_lock); goto drop_unlock; } - seq_number = priv->stations[sta_id].tid[tid].seq_number; + seq_number = il->stations[sta_id].tid[tid].seq_number; seq_number &= IEEE80211_SCTL_SEQ; hdr->seq_ctrl = hdr->seq_ctrl & cpu_to_le16(IEEE80211_SCTL_FRAG); @@ -381,27 +381,27 @@ int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) seq_number += 0x10; /* aggregation is on for this <sta,tid> */ if (info->flags & IEEE80211_TX_CTL_AMPDU && - priv->stations[sta_id].tid[tid].agg.state == IL_AGG_ON) { - txq_id = priv->stations[sta_id].tid[tid].agg.txq_id; + il->stations[sta_id].tid[tid].agg.state == IL_AGG_ON) { + txq_id = il->stations[sta_id].tid[tid].agg.txq_id; is_agg = true; } } - txq = &priv->txq[txq_id]; + txq = &il->txq[txq_id]; q = &txq->q; if (unlikely(il_queue_space(q) < q->high_mark)) { - spin_unlock(&priv->sta_lock); + spin_unlock(&il->sta_lock); goto drop_unlock; } if (ieee80211_is_data_qos(fc)) { - priv->stations[sta_id].tid[tid].tfds_in_queue++; + il->stations[sta_id].tid[tid].tfds_in_queue++; if (!ieee80211_has_morefrags(fc)) - priv->stations[sta_id].tid[tid].seq_number = seq_number; + il->stations[sta_id].tid[tid].seq_number = seq_number; } - spin_unlock(&priv->sta_lock); + spin_unlock(&il->sta_lock); /* Set up driver data for this TFD */ memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct il_tx_info)); @@ -434,15 +434,15 @@ int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) tx_cmd->len = cpu_to_le16(len); if (info->control.hw_key) - il4965_tx_cmd_build_hwcrypto(priv, info, tx_cmd, skb, sta_id); + il4965_tx_cmd_build_hwcrypto(il, info, tx_cmd, skb, sta_id); /* TODO need this for burst mode later on */ - il4965_tx_cmd_build_basic(priv, skb, tx_cmd, info, hdr, sta_id); - il_dbg_log_tx_data_frame(priv, len, hdr); + il4965_tx_cmd_build_basic(il, skb, tx_cmd, info, hdr, sta_id); + il_dbg_log_tx_data_frame(il, len, hdr); - il4965_tx_cmd_build_rate(priv, tx_cmd, info, fc); + il4965_tx_cmd_build_rate(il, tx_cmd, info, fc); - il_update_stats(priv, true, fc, len); + il_update_stats(il, true, fc, len); /* * Use the first empty entry in this queue's command buffer array * to contain the Tx command and MAC header concatenated together @@ -462,14 +462,14 @@ int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) /* Physical address of this Tx command's header (not MAC header!), * within command buffer array. */ - txcmd_phys = pci_map_single(priv->pci_dev, + txcmd_phys = pci_map_single(il->pci_dev, &out_cmd->hdr, firstlen, PCI_DMA_BIDIRECTIONAL); dma_unmap_addr_set(out_meta, mapping, txcmd_phys); dma_unmap_len_set(out_meta, len, firstlen); /* Add buffer containing Tx command and MAC(!) header to TFD's * first entry */ - priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq, + il->cfg->ops->lib->txq_attach_buf_to_tfd(il, txq, txcmd_phys, firstlen, 1, 0); if (!ieee80211_has_morefrags(hdr->frame_control)) { @@ -483,9 +483,9 @@ int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) * if any (802.11 null frames have no payload). */ secondlen = skb->len - hdr_len; if (secondlen > 0) { - phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len, + phys_addr = pci_map_single(il->pci_dev, skb->data + hdr_len, secondlen, PCI_DMA_TODEVICE); - priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq, + il->cfg->ops->lib->txq_attach_buf_to_tfd(il, txq, phys_addr, secondlen, 0, 0); } @@ -494,29 +494,29 @@ int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) offsetof(struct il_tx_cmd, scratch); /* take back ownership of DMA buffer to enable update */ - pci_dma_sync_single_for_cpu(priv->pci_dev, txcmd_phys, + pci_dma_sync_single_for_cpu(il->pci_dev, txcmd_phys, firstlen, PCI_DMA_BIDIRECTIONAL); tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys); tx_cmd->dram_msb_ptr = il_get_dma_hi_addr(scratch_phys); - IL_DEBUG_TX(priv, "sequence nr = 0X%x\n", + IL_DEBUG_TX(il, "sequence nr = 0X%x\n", le16_to_cpu(out_cmd->hdr.sequence)); - IL_DEBUG_TX(priv, "tx_flags = 0X%x\n", le32_to_cpu(tx_cmd->tx_flags)); - il_print_hex_dump(priv, IL_DL_TX, (u8 *)tx_cmd, sizeof(*tx_cmd)); - il_print_hex_dump(priv, IL_DL_TX, (u8 *)tx_cmd->hdr, hdr_len); + IL_DEBUG_TX(il, "tx_flags = 0X%x\n", le32_to_cpu(tx_cmd->tx_flags)); + il_print_hex_dump(il, IL_DL_TX, (u8 *)tx_cmd, sizeof(*tx_cmd)); + il_print_hex_dump(il, IL_DL_TX, (u8 *)tx_cmd->hdr, hdr_len); /* Set up entry for this TFD in Tx byte-count array */ if (info->flags & IEEE80211_TX_CTL_AMPDU) - priv->cfg->ops->lib->txq_update_byte_cnt_tbl(priv, txq, + il->cfg->ops->lib->txq_update_byte_cnt_tbl(il, txq, le16_to_cpu(tx_cmd->len)); - pci_dma_sync_single_for_device(priv->pci_dev, txcmd_phys, + pci_dma_sync_single_for_device(il->pci_dev, txcmd_phys, firstlen, PCI_DMA_BIDIRECTIONAL); /* Tell device the write index *just past* this latest filled TFD */ q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd); - il_txq_update_write_ptr(priv, txq); - spin_unlock_irqrestore(&priv->lock, flags); + il_txq_update_write_ptr(il, txq); + spin_unlock_irqrestore(&il->lock, flags); /* * At this point the frame is "transmitted" successfully @@ -536,28 +536,28 @@ int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) atomic_inc(&sta_priv->pending_frames); if ((il_queue_space(q) < q->high_mark) && - priv->mac80211_registered) { + il->mac80211_registered) { if (wait_write_ptr) { - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); txq->need_update = 1; - il_txq_update_write_ptr(priv, txq); - spin_unlock_irqrestore(&priv->lock, flags); + il_txq_update_write_ptr(il, txq); + spin_unlock_irqrestore(&il->lock, flags); } else { - il_stop_queue(priv, txq); + il_stop_queue(il, txq); } } return 0; drop_unlock: - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&il->lock, flags); return -1; } -static inline int il4965_alloc_dma_ptr(struct il_priv *priv, +static inline int il4965_alloc_dma_ptr(struct il_priv *il, struct il_dma_ptr *ptr, size_t size) { - ptr->addr = dma_alloc_coherent(&priv->pci_dev->dev, size, &ptr->dma, + ptr->addr = dma_alloc_coherent(&il->pci_dev->dev, size, &ptr->dma, GFP_KERNEL); if (!ptr->addr) return -ENOMEM; @@ -565,13 +565,13 @@ static inline int il4965_alloc_dma_ptr(struct il_priv *priv, return 0; } -static inline void il4965_free_dma_ptr(struct il_priv *priv, +static inline void il4965_free_dma_ptr(struct il_priv *il, struct il_dma_ptr *ptr) { if (unlikely(!ptr->addr)) return; - dma_free_coherent(&priv->pci_dev->dev, ptr->size, ptr->addr, ptr->dma); + dma_free_coherent(&il->pci_dev->dev, ptr->size, ptr->addr, ptr->dma); memset(ptr, 0, sizeof(*ptr)); } @@ -580,79 +580,79 @@ static inline void il4965_free_dma_ptr(struct il_priv *priv, * * Destroy all TX DMA queues and structures */ -void il4965_hw_txq_ctx_free(struct il_priv *priv) +void il4965_hw_txq_ctx_free(struct il_priv *il) { int txq_id; /* Tx queues */ - if (priv->txq) { - for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) - if (txq_id == priv->cmd_queue) - il_cmd_queue_free(priv); + if (il->txq) { + for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) + if (txq_id == il->cmd_queue) + il_cmd_queue_free(il); else - il_tx_queue_free(priv, txq_id); + il_tx_queue_free(il, txq_id); } - il4965_free_dma_ptr(priv, &priv->kw); + il4965_free_dma_ptr(il, &il->kw); - il4965_free_dma_ptr(priv, &priv->scd_bc_tbls); + il4965_free_dma_ptr(il, &il->scd_bc_tbls); /* free tx queue structure */ - il_txq_mem(priv); + il_txq_mem(il); } /** * il4965_txq_ctx_alloc - allocate TX queue context * Allocate all Tx DMA structures and initialize them * - * @param priv + * @param il * @return error code */ -int il4965_txq_ctx_alloc(struct il_priv *priv) +int il4965_txq_ctx_alloc(struct il_priv *il) { int ret; int txq_id, slots_num; unsigned long flags; /* Free all tx/cmd queues and keep-warm buffer */ - il4965_hw_txq_ctx_free(priv); + il4965_hw_txq_ctx_free(il); - ret = il4965_alloc_dma_ptr(priv, &priv->scd_bc_tbls, - priv->hw_params.scd_bc_tbls_size); + ret = il4965_alloc_dma_ptr(il, &il->scd_bc_tbls, + il->hw_params.scd_bc_tbls_size); if (ret) { - IL_ERR(priv, "Scheduler BC Table allocation failed\n"); + IL_ERR(il, "Scheduler BC Table allocation failed\n"); goto error_bc_tbls; } /* Alloc keep-warm buffer */ - ret = il4965_alloc_dma_ptr(priv, &priv->kw, IL_KW_SIZE); + ret = il4965_alloc_dma_ptr(il, &il->kw, IL_KW_SIZE); if (ret) { - IL_ERR(priv, "Keep Warm allocation failed\n"); + IL_ERR(il, "Keep Warm allocation failed\n"); goto error_kw; } /* allocate tx queue structure */ - ret = il_alloc_txq_mem(priv); + ret = il_alloc_txq_mem(il); if (ret) goto error; - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); /* Turn off all Tx DMA fifos */ - il4965_txq_set_sched(priv, 0); + il4965_txq_set_sched(il, 0); /* Tell NIC where to find the "keep warm" buffer */ - il_write_direct32(priv, FH_KW_MEM_ADDR_REG, priv->kw.dma >> 4); + il_write_direct32(il, FH_KW_MEM_ADDR_REG, il->kw.dma >> 4); - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&il->lock, flags); /* Alloc and init all Tx queues, including the command queue (#4/#9) */ - for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { - slots_num = (txq_id == priv->cmd_queue) ? + for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) { + slots_num = (txq_id == il->cmd_queue) ? TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; - ret = il_tx_queue_init(priv, - &priv->txq[txq_id], slots_num, + ret = il_tx_queue_init(il, + &il->txq[txq_id], slots_num, txq_id); if (ret) { - IL_ERR(priv, "Tx %d queue init failed\n", txq_id); + IL_ERR(il, "Tx %d queue init failed\n", txq_id); goto error; } } @@ -660,34 +660,34 @@ int il4965_txq_ctx_alloc(struct il_priv *priv) return ret; error: - il4965_hw_txq_ctx_free(priv); - il4965_free_dma_ptr(priv, &priv->kw); + il4965_hw_txq_ctx_free(il); + il4965_free_dma_ptr(il, &il->kw); error_kw: - il4965_free_dma_ptr(priv, &priv->scd_bc_tbls); + il4965_free_dma_ptr(il, &il->scd_bc_tbls); error_bc_tbls: return ret; } -void il4965_txq_ctx_reset(struct il_priv *priv) +void il4965_txq_ctx_reset(struct il_priv *il) { int txq_id, slots_num; unsigned long flags; - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); /* Turn off all Tx DMA fifos */ - il4965_txq_set_sched(priv, 0); + il4965_txq_set_sched(il, 0); /* Tell NIC where to find the "keep warm" buffer */ - il_write_direct32(priv, FH_KW_MEM_ADDR_REG, priv->kw.dma >> 4); + il_write_direct32(il, FH_KW_MEM_ADDR_REG, il->kw.dma >> 4); - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&il->lock, flags); /* Alloc and init all Tx queues, including the command queue (#4) */ - for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { - slots_num = txq_id == priv->cmd_queue ? + for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) { + slots_num = txq_id == il->cmd_queue ? TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; - il_tx_queue_reset(priv, &priv->txq[txq_id], + il_tx_queue_reset(il, &il->txq[txq_id], slots_num, txq_id); } } @@ -695,39 +695,39 @@ void il4965_txq_ctx_reset(struct il_priv *priv) /** * il4965_txq_ctx_stop - Stop all Tx DMA channels */ -void il4965_txq_ctx_stop(struct il_priv *priv) +void il4965_txq_ctx_stop(struct il_priv *il) { int ch, txq_id; unsigned long flags; /* Turn off all Tx DMA fifos */ - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); - il4965_txq_set_sched(priv, 0); + il4965_txq_set_sched(il, 0); /* Stop each Tx DMA channel, and wait for it to be idle */ - for (ch = 0; ch < priv->hw_params.dma_chnl_num; ch++) { - il_write_direct32(priv, + for (ch = 0; ch < il->hw_params.dma_chnl_num; ch++) { + il_write_direct32(il, FH_TCSR_CHNL_TX_CONFIG_REG(ch), 0x0); - if (il_poll_direct_bit(priv, FH_TSSR_TX_STATUS_REG, + if (il_poll_direct_bit(il, FH_TSSR_TX_STATUS_REG, FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(ch), 1000)) - IL_ERR(priv, "Failing on timeout while stopping" + IL_ERR(il, "Failing on timeout while stopping" " DMA channel %d [0x%08x]", ch, - il_read_direct32(priv, + il_read_direct32(il, FH_TSSR_TX_STATUS_REG)); } - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&il->lock, flags); - if (!priv->txq) + if (!il->txq) return; /* Unmap DMA from host system and free skb's */ - for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) - if (txq_id == priv->cmd_queue) - il_cmd_queue_unmap(priv); + for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) + if (txq_id == il->cmd_queue) + il_cmd_queue_unmap(il); else - il_tx_queue_unmap(priv, txq_id); + il_tx_queue_unmap(il, txq_id); } /* @@ -736,12 +736,12 @@ void il4965_txq_ctx_stop(struct il_priv *priv) * Should never return anything < 7, because they should already * be in use as EDCA AC (0-3), Command (4), reserved (5, 6) */ -static int il4965_txq_ctx_activate_free(struct il_priv *priv) +static int il4965_txq_ctx_activate_free(struct il_priv *il) { int txq_id; - for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) - if (!test_and_set_bit(txq_id, &priv->txq_ctx_active_msk)) + for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) + if (!test_and_set_bit(txq_id, &il->txq_ctx_active_msk)) return txq_id; return -1; } @@ -749,12 +749,12 @@ static int il4965_txq_ctx_activate_free(struct il_priv *priv) /** * il4965_tx_queue_stop_scheduler - Stop queue, but keep configuration */ -static void il4965_tx_queue_stop_scheduler(struct il_priv *priv, +static void il4965_tx_queue_stop_scheduler(struct il_priv *il, u16 txq_id) { /* Simply stop the queue, but don't change any configuration; * the SCD_ACT_EN bit is the write-enable mask for the ACTIVE bit. */ - il_write_prph(priv, + il_write_prph(il, IWL49_SCD_QUEUE_STATUS_BITS(txq_id), (0 << IWL49_SCD_QUEUE_STTS_REG_POS_ACTIVE)| (1 << IWL49_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN)); @@ -763,7 +763,7 @@ static void il4965_tx_queue_stop_scheduler(struct il_priv *priv, /** * il4965_tx_queue_set_q2ratid - Map unique receiver/tid combination to a queue */ -static int il4965_tx_queue_set_q2ratid(struct il_priv *priv, u16 ra_tid, +static int il4965_tx_queue_set_q2ratid(struct il_priv *il, u16 ra_tid, u16 txq_id) { u32 tbl_dw_addr; @@ -772,17 +772,17 @@ static int il4965_tx_queue_set_q2ratid(struct il_priv *priv, u16 ra_tid, scd_q2ratid = ra_tid & IL_SCD_QUEUE_RA_TID_MAP_RATID_MSK; - tbl_dw_addr = priv->scd_base_addr + + tbl_dw_addr = il->scd_base_addr + IWL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(txq_id); - tbl_dw = il_read_targ_mem(priv, tbl_dw_addr); + tbl_dw = il_read_targ_mem(il, tbl_dw_addr); if (txq_id & 0x1) tbl_dw = (scd_q2ratid << 16) | (tbl_dw & 0x0000FFFF); else tbl_dw = scd_q2ratid | (tbl_dw & 0xFFFF0000); - il_write_targ_mem(priv, tbl_dw_addr, tbl_dw); + il_write_targ_mem(il, tbl_dw_addr, tbl_dw); return 0; } @@ -793,7 +793,7 @@ static int il4965_tx_queue_set_q2ratid(struct il_priv *priv, u16 ra_tid, * NOTE: txq_id must be greater than IWL49_FIRST_AMPDU_QUEUE, * i.e. it must be one of the higher queues used for aggregation */ -static int il4965_txq_agg_enable(struct il_priv *priv, int txq_id, +static int il4965_txq_agg_enable(struct il_priv *il, int txq_id, int tx_fifo, int sta_id, int tid, u16 ssn_idx) { unsigned long flags; @@ -802,62 +802,62 @@ static int il4965_txq_agg_enable(struct il_priv *priv, int txq_id, if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) || (IWL49_FIRST_AMPDU_QUEUE + - priv->cfg->base_params->num_of_ampdu_queues <= txq_id)) { - IL_WARN(priv, + il->cfg->base_params->num_of_ampdu_queues <= txq_id)) { + IL_WARN(il, "queue number out of range: %d, must be %d to %d\n", txq_id, IWL49_FIRST_AMPDU_QUEUE, IWL49_FIRST_AMPDU_QUEUE + - priv->cfg->base_params->num_of_ampdu_queues - 1); + il->cfg->base_params->num_of_ampdu_queues - 1); return -EINVAL; } ra_tid = BUILD_RAxTID(sta_id, tid); /* Modify device's station table to Tx this TID */ - ret = il4965_sta_tx_modify_enable_tid(priv, sta_id, tid); + ret = il4965_sta_tx_modify_enable_tid(il, sta_id, tid); if (ret) return ret; - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); /* Stop this Tx queue before configuring it */ - il4965_tx_queue_stop_scheduler(priv, txq_id); + il4965_tx_queue_stop_scheduler(il, txq_id); /* Map receiver-address / traffic-ID to this queue */ - il4965_tx_queue_set_q2ratid(priv, ra_tid, txq_id); + il4965_tx_queue_set_q2ratid(il, ra_tid, txq_id); /* Set this queue as a chain-building queue */ - il_set_bits_prph(priv, IWL49_SCD_QUEUECHAIN_SEL, (1 << txq_id)); + il_set_bits_prph(il, IWL49_SCD_QUEUECHAIN_SEL, (1 << txq_id)); /* Place first TFD at index corresponding to start sequence number. * Assumes that ssn_idx is valid (!= 0xFFF) */ - priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); - priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); - il4965_set_wr_ptrs(priv, txq_id, ssn_idx); + il->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); + il->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); + il4965_set_wr_ptrs(il, txq_id, ssn_idx); /* Set up Tx window size and frame limit for this queue */ - il_write_targ_mem(priv, - priv->scd_base_addr + IWL49_SCD_CONTEXT_QUEUE_OFFSET(txq_id), + il_write_targ_mem(il, + il->scd_base_addr + IWL49_SCD_CONTEXT_QUEUE_OFFSET(txq_id), (SCD_WIN_SIZE << IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK); - il_write_targ_mem(priv, priv->scd_base_addr + + il_write_targ_mem(il, il->scd_base_addr + IWL49_SCD_CONTEXT_QUEUE_OFFSET(txq_id) + sizeof(u32), (SCD_FRAME_LIMIT << IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) & IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); - il_set_bits_prph(priv, IWL49_SCD_INTERRUPT_MASK, (1 << txq_id)); + il_set_bits_prph(il, IWL49_SCD_INTERRUPT_MASK, (1 << txq_id)); /* Set up Status area in SRAM, map to Tx DMA/FIFO, activate the queue */ - il4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 1); + il4965_tx_queue_set_status(il, &il->txq[txq_id], tx_fifo, 1); - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&il->lock, flags); return 0; } -int il4965_tx_agg_start(struct il_priv *priv, struct ieee80211_vif *vif, +int il4965_tx_agg_start(struct il_priv *il, struct ieee80211_vif *vif, struct ieee80211_sta *sta, u16 tid, u16 *ssn) { int sta_id; @@ -871,94 +871,94 @@ int il4965_tx_agg_start(struct il_priv *priv, struct ieee80211_vif *vif, if (unlikely(tx_fifo < 0)) return tx_fifo; - IL_WARN(priv, "%s on ra = %pM tid = %d\n", + IL_WARN(il, "%s on ra = %pM tid = %d\n", __func__, sta->addr, tid); sta_id = il_sta_id(sta); if (sta_id == IL_INVALID_STATION) { - IL_ERR(priv, "Start AGG on invalid station\n"); + IL_ERR(il, "Start AGG on invalid station\n"); return -ENXIO; } if (unlikely(tid >= MAX_TID_COUNT)) return -EINVAL; - if (priv->stations[sta_id].tid[tid].agg.state != IL_AGG_OFF) { - IL_ERR(priv, "Start AGG when state is not IL_AGG_OFF !\n"); + if (il->stations[sta_id].tid[tid].agg.state != IL_AGG_OFF) { + IL_ERR(il, "Start AGG when state is not IL_AGG_OFF !\n"); return -ENXIO; } - txq_id = il4965_txq_ctx_activate_free(priv); + txq_id = il4965_txq_ctx_activate_free(il); if (txq_id == -1) { - IL_ERR(priv, "No free aggregation queue available\n"); + IL_ERR(il, "No free aggregation queue available\n"); return -ENXIO; } - spin_lock_irqsave(&priv->sta_lock, flags); - tid_data = &priv->stations[sta_id].tid[tid]; + spin_lock_irqsave(&il->sta_lock, flags); + tid_data = &il->stations[sta_id].tid[tid]; *ssn = SEQ_TO_SN(tid_data->seq_number); tid_data->agg.txq_id = txq_id; - il_set_swq_id(&priv->txq[txq_id], + il_set_swq_id(&il->txq[txq_id], il4965_get_ac_from_tid(tid), txq_id); - spin_unlock_irqrestore(&priv->sta_lock, flags); + spin_unlock_irqrestore(&il->sta_lock, flags); - ret = il4965_txq_agg_enable(priv, txq_id, tx_fifo, + ret = il4965_txq_agg_enable(il, txq_id, tx_fifo, sta_id, tid, *ssn); if (ret) return ret; - spin_lock_irqsave(&priv->sta_lock, flags); - tid_data = &priv->stations[sta_id].tid[tid]; + spin_lock_irqsave(&il->sta_lock, flags); + tid_data = &il->stations[sta_id].tid[tid]; if (tid_data->tfds_in_queue == 0) { - IL_DEBUG_HT(priv, "HW queue is empty\n"); + IL_DEBUG_HT(il, "HW queue is empty\n"); tid_data->agg.state = IL_AGG_ON; ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); } else { - IL_DEBUG_HT(priv, + IL_DEBUG_HT(il, "HW queue is NOT empty: %d packets in HW queue\n", tid_data->tfds_in_queue); tid_data->agg.state = IL_EMPTYING_HW_QUEUE_ADDBA; } - spin_unlock_irqrestore(&priv->sta_lock, flags); + spin_unlock_irqrestore(&il->sta_lock, flags); return ret; } /** * txq_id must be greater than IWL49_FIRST_AMPDU_QUEUE - * priv->lock must be held by the caller + * il->lock must be held by the caller */ -static int il4965_txq_agg_disable(struct il_priv *priv, u16 txq_id, +static int il4965_txq_agg_disable(struct il_priv *il, u16 txq_id, u16 ssn_idx, u8 tx_fifo) { if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) || (IWL49_FIRST_AMPDU_QUEUE + - priv->cfg->base_params->num_of_ampdu_queues <= txq_id)) { - IL_WARN(priv, + il->cfg->base_params->num_of_ampdu_queues <= txq_id)) { + IL_WARN(il, "queue number out of range: %d, must be %d to %d\n", txq_id, IWL49_FIRST_AMPDU_QUEUE, IWL49_FIRST_AMPDU_QUEUE + - priv->cfg->base_params->num_of_ampdu_queues - 1); + il->cfg->base_params->num_of_ampdu_queues - 1); return -EINVAL; } - il4965_tx_queue_stop_scheduler(priv, txq_id); + il4965_tx_queue_stop_scheduler(il, txq_id); - il_clear_bits_prph(priv, + il_clear_bits_prph(il, IWL49_SCD_QUEUECHAIN_SEL, (1 << txq_id)); - priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); - priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); + il->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); + il->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); /* supposes that ssn_idx is valid (!= 0xFFF) */ - il4965_set_wr_ptrs(priv, txq_id, ssn_idx); + il4965_set_wr_ptrs(il, txq_id, ssn_idx); - il_clear_bits_prph(priv, + il_clear_bits_prph(il, IWL49_SCD_INTERRUPT_MASK, (1 << txq_id)); - il_txq_ctx_deactivate(priv, txq_id); - il4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 0); + il_txq_ctx_deactivate(il, txq_id); + il4965_tx_queue_set_status(il, &il->txq[txq_id], tx_fifo, 0); return 0; } -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 tx_fifo_id, txq_id, sta_id, ssn; @@ -973,17 +973,17 @@ int il4965_tx_agg_stop(struct il_priv *priv, struct ieee80211_vif *vif, 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); + spin_lock_irqsave(&il->sta_lock, flags); - tid_data = &priv->stations[sta_id].tid[tid]; + tid_data = &il->stations[sta_id].tid[tid]; ssn = (tid_data->seq_number & IEEE80211_SCTL_SEQ) >> 4; txq_id = tid_data->agg.txq_id; - switch (priv->stations[sta_id].tid[tid].agg.state) { + switch (il->stations[sta_id].tid[tid].agg.state) { case IL_EMPTYING_HW_QUEUE_ADDBA: /* * This can happen if the peer stops aggregation @@ -991,33 +991,33 @@ int il4965_tx_agg_stop(struct il_priv *priv, struct ieee80211_vif *vif, * queue we selected previously, i.e. before the * session was really started completely. */ - IL_DEBUG_HT(priv, "AGG stop before setup done\n"); + IL_DEBUG_HT(il, "AGG stop before setup done\n"); goto turn_off; case IL_AGG_ON: break; default: - IL_WARN(priv, "Stopping AGG while state not ON or starting\n"); + IL_WARN(il, "Stopping AGG while state not ON or starting\n"); } - write_ptr = priv->txq[txq_id].q.write_ptr; - read_ptr = priv->txq[txq_id].q.read_ptr; + write_ptr = il->txq[txq_id].q.write_ptr; + read_ptr = il->txq[txq_id].q.read_ptr; /* The queue is not empty */ if (write_ptr != read_ptr) { - IL_DEBUG_HT(priv, "Stopping a non empty AGG HW QUEUE\n"); - priv->stations[sta_id].tid[tid].agg.state = + IL_DEBUG_HT(il, "Stopping a non empty AGG HW QUEUE\n"); + il->stations[sta_id].tid[tid].agg.state = IL_EMPTYING_HW_QUEUE_DELBA; - spin_unlock_irqrestore(&priv->sta_lock, flags); + spin_unlock_irqrestore(&il->sta_lock, flags); return 0; } - IL_DEBUG_HT(priv, "HW queue is empty\n"); + IL_DEBUG_HT(il, "HW queue is empty\n"); turn_off: - priv->stations[sta_id].tid[tid].agg.state = IL_AGG_OFF; + il->stations[sta_id].tid[tid].agg.state = IL_AGG_OFF; /* do not restore/save irqs */ - spin_unlock(&priv->sta_lock); - spin_lock(&priv->lock); + spin_unlock(&il->sta_lock); + spin_lock(&il->lock); /* * the only reason this call can fail is queue number out of range, @@ -1026,27 +1026,27 @@ int il4965_tx_agg_stop(struct il_priv *priv, struct ieee80211_vif *vif, * to deactivate the uCode queue, just return "success" to allow * mac80211 to clean up it own data. */ - il4965_txq_agg_disable(priv, txq_id, ssn, tx_fifo_id); - spin_unlock_irqrestore(&priv->lock, flags); + il4965_txq_agg_disable(il, txq_id, ssn, tx_fifo_id); + spin_unlock_irqrestore(&il->lock, flags); ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); return 0; } -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) { - struct il_queue *q = &priv->txq[txq_id].q; - u8 *addr = priv->stations[sta_id].sta.sta.addr; - struct il_tid_data *tid_data = &priv->stations[sta_id].tid[tid]; + struct il_queue *q = &il->txq[txq_id].q; + u8 *addr = il->stations[sta_id].sta.sta.addr; + struct il_tid_data *tid_data = &il->stations[sta_id].tid[tid]; struct il_rxon_context *ctx; - ctx = &priv->contexts[priv->stations[sta_id].ctxid]; + ctx = &il->contexts[il->stations[sta_id].ctxid]; - lockdep_assert_held(&priv->sta_lock); + lockdep_assert_held(&il->sta_lock); - switch (priv->stations[sta_id].tid[tid].agg.state) { + switch (il->stations[sta_id].tid[tid].agg.state) { case IL_EMPTYING_HW_QUEUE_DELBA: /* We are reclaiming the last packet of the */ /* aggregated HW queue */ @@ -1054,9 +1054,9 @@ int il4965_txq_check_empty(struct il_priv *priv, (q->read_ptr == q->write_ptr)) { u16 ssn = SEQ_TO_SN(tid_data->seq_number); int tx_fifo = il4965_get_fifo_from_tid(ctx, tid); - IL_DEBUG_HT(priv, + IL_DEBUG_HT(il, "HW queue empty: continue DELBA flow\n"); - il4965_txq_agg_disable(priv, txq_id, ssn, tx_fifo); + il4965_txq_agg_disable(il, txq_id, ssn, tx_fifo); tid_data->agg.state = IL_AGG_OFF; ieee80211_stop_tx_ba_cb_irqsafe(ctx->vif, addr, tid); } @@ -1064,7 +1064,7 @@ int il4965_txq_check_empty(struct il_priv *priv, case IL_EMPTYING_HW_QUEUE_ADDBA: /* We are reclaiming the last packet of the queue */ if (tid_data->tfds_in_queue == 0) { - IL_DEBUG_HT(priv, + IL_DEBUG_HT(il, "HW queue empty: continue ADDBA flow\n"); tid_data->agg.state = IL_AGG_ON; ieee80211_start_tx_ba_cb_irqsafe(ctx->vif, addr, tid); @@ -1075,7 +1075,7 @@ int il4965_txq_check_empty(struct il_priv *priv, return 0; } -static void il4965_non_agg_tx_status(struct il_priv *priv, +static void il4965_non_agg_tx_status(struct il_priv *il, struct il_rxon_context *ctx, const u8 *addr1) { @@ -1089,33 +1089,33 @@ static void il4965_non_agg_tx_status(struct il_priv *priv, /* avoid atomic ops if this isn't a client */ if (sta_priv->client && atomic_dec_return(&sta_priv->pending_frames) == 0) - ieee80211_sta_block_awake(priv->hw, sta, false); + ieee80211_sta_block_awake(il->hw, sta, false); } rcu_read_unlock(); } static void -il4965_tx_status(struct il_priv *priv, struct il_tx_info *tx_info, +il4965_tx_status(struct il_priv *il, struct il_tx_info *tx_info, bool is_agg) { struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx_info->skb->data; if (!is_agg) - il4965_non_agg_tx_status(priv, tx_info->ctx, hdr->addr1); + il4965_non_agg_tx_status(il, tx_info->ctx, hdr->addr1); - ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb); + ieee80211_tx_status_irqsafe(il->hw, tx_info->skb); } -int il4965_tx_queue_reclaim(struct il_priv *priv, int txq_id, int index) +int il4965_tx_queue_reclaim(struct il_priv *il, int txq_id, int index) { - struct il_tx_queue *txq = &priv->txq[txq_id]; + struct il_tx_queue *txq = &il->txq[txq_id]; struct il_queue *q = &txq->q; struct il_tx_info *tx_info; int nfreed = 0; struct ieee80211_hdr *hdr; if ((index >= q->n_bd) || (il_queue_used(q, index) == 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, index, q->n_bd, q->write_ptr, q->read_ptr); return 0; @@ -1134,11 +1134,11 @@ int il4965_tx_queue_reclaim(struct il_priv *priv, int txq_id, int index) if (ieee80211_is_data_qos(hdr->frame_control)) nfreed++; - il4965_tx_status(priv, tx_info, + il4965_tx_status(il, tx_info, txq_id >= IWL4965_FIRST_AMPDU_QUEUE); tx_info->skb = NULL; - priv->cfg->ops->lib->txq_free_tfd(priv, txq); + il->cfg->ops->lib->txq_free_tfd(il, txq); } return nfreed; } @@ -1149,7 +1149,7 @@ int il4965_tx_queue_reclaim(struct il_priv *priv, int txq_id, int index) * Go through block-ack's bitmap of ACK'd frames, update driver's record of * ACK vs. not. This gets sent to mac80211, then to rate scaling algo. */ -static int il4965_tx_status_reply_compressed_ba(struct il_priv *priv, +static int il4965_tx_status_reply_compressed_ba(struct il_priv *il, struct il_ht_agg *agg, struct il_compressed_ba_resp *ba_resp) @@ -1163,13 +1163,13 @@ static int il4965_tx_status_reply_compressed_ba(struct il_priv *priv, if (unlikely(!agg->wait_for_ba)) { if (unlikely(ba_resp->bitmap)) - IL_ERR(priv, "Received BA when not expected\n"); + IL_ERR(il, "Received BA when not expected\n"); return -EINVAL; } /* Mark that the expected block-ack response arrived */ agg->wait_for_ba = 0; - IL_DEBUG_TX_REPLY(priv, "BA %d %d\n", agg->start_idx, + IL_DEBUG_TX_REPLY(il, "BA %d %d\n", agg->start_idx, ba_resp->seq_ctl); /* Calculate shift to align block-ack bits with our Tx window bits */ @@ -1178,7 +1178,7 @@ static int il4965_tx_status_reply_compressed_ba(struct il_priv *priv, sh += 0x100; if (agg->frame_count > (64 - sh)) { - IL_DEBUG_TX_REPLY(priv, "more frames than bitmap size"); + IL_DEBUG_TX_REPLY(il, "more frames than bitmap size"); return -1; } @@ -1195,7 +1195,7 @@ static int il4965_tx_status_reply_compressed_ba(struct il_priv *priv, while (sent_bitmap) { ack = sent_bitmap & 1ULL; successes += ack; - IL_DEBUG_TX_REPLY(priv, "%s ON i=%d idx=%d raw=%d\n", + IL_DEBUG_TX_REPLY(il, "%s ON i=%d idx=%d raw=%d\n", ack ? "ACK" : "NACK", i, (agg->start_idx + i) & 0xff, agg->start_idx + i); @@ -1203,16 +1203,16 @@ static int il4965_tx_status_reply_compressed_ba(struct il_priv *priv, ++i; } - IL_DEBUG_TX_REPLY(priv, "Bitmap %llx\n", + IL_DEBUG_TX_REPLY(il, "Bitmap %llx\n", (unsigned long long)bitmap); - info = IEEE80211_SKB_CB(priv->txq[scd_flow].txb[agg->start_idx].skb); + info = IEEE80211_SKB_CB(il->txq[scd_flow].txb[agg->start_idx].skb); memset(&info->status, 0, sizeof(info->status)); info->flags |= IEEE80211_TX_STAT_ACK; info->flags |= IEEE80211_TX_STAT_AMPDU; info->status.ampdu_ack_len = successes; info->status.ampdu_len = agg->frame_count; - il4965_hwrate_to_tx_control(priv, agg->rate_n_flags, info); + il4965_hwrate_to_tx_control(il, agg->rate_n_flags, info); return 0; } @@ -1220,7 +1220,7 @@ static int il4965_tx_status_reply_compressed_ba(struct il_priv *priv, /** * translate ucode response to mac80211 tx status control values */ -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) { struct ieee80211_tx_rate *r = &info->control.rates[0]; @@ -1246,7 +1246,7 @@ void il4965_hwrate_to_tx_control(struct il_priv *priv, u32 rate_n_flags, * Handles block-acknowledge notification from device, which reports success * of frames sent via aggregation. */ -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) { struct il_rx_packet *pkt = rxb_addr(rxb); @@ -1265,16 +1265,16 @@ void il4965_rx_reply_compressed_ba(struct il_priv *priv, * (in Tx queue's circular buffer) of first TFD/frame in window */ u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn); - if (scd_flow >= priv->hw_params.max_txq_num) { - IL_ERR(priv, + if (scd_flow >= il->hw_params.max_txq_num) { + IL_ERR(il, "BUG_ON scd_flow is bigger than number of queues\n"); return; } - txq = &priv->txq[scd_flow]; + txq = &il->txq[scd_flow]; sta_id = ba_resp->sta_id; tid = ba_resp->tid; - agg = &priv->stations[sta_id].tid[tid].agg; + agg = &il->stations[sta_id].tid[tid].agg; if (unlikely(agg->txq_id != scd_flow)) { /* * FIXME: this is a uCode bug which need to be addressed, @@ -1282,7 +1282,7 @@ void il4965_rx_reply_compressed_ba(struct il_priv *priv, * since it is possible happen very often and in order * not to fill the syslog, don't enable the logging by default */ - IL_DEBUG_TX_REPLY(priv, + IL_DEBUG_TX_REPLY(il, "BA scd_flow %d does not match txq_id %d\n", scd_flow, agg->txq_id); return; @@ -1291,14 +1291,14 @@ void il4965_rx_reply_compressed_ba(struct il_priv *priv, /* Find index just before block-ack window */ index = il_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd); - spin_lock_irqsave(&priv->sta_lock, flags); + spin_lock_irqsave(&il->sta_lock, flags); - IL_DEBUG_TX_REPLY(priv, "REPLY_COMPRESSED_BA [%d] Received from %pM, " + IL_DEBUG_TX_REPLY(il, "REPLY_COMPRESSED_BA [%d] Received from %pM, " "sta_id = %d\n", agg->wait_for_ba, (u8 *) &ba_resp->sta_addr_lo32, ba_resp->sta_id); - IL_DEBUG_TX_REPLY(priv, "TID = %d, SeqCtl = %d, bitmap = 0x%llx," + IL_DEBUG_TX_REPLY(il, "TID = %d, SeqCtl = %d, bitmap = 0x%llx," "scd_flow = " "%d, scd_ssn = %d\n", ba_resp->tid, @@ -1306,30 +1306,30 @@ void il4965_rx_reply_compressed_ba(struct il_priv *priv, (unsigned long long)le64_to_cpu(ba_resp->bitmap), ba_resp->scd_flow, ba_resp->scd_ssn); - IL_DEBUG_TX_REPLY(priv, "DAT start_idx = %d, bitmap = 0x%llx\n", + IL_DEBUG_TX_REPLY(il, "DAT start_idx = %d, bitmap = 0x%llx\n", agg->start_idx, (unsigned long long)agg->bitmap); /* Update driver's record of ACK vs. not for each frame in window */ - il4965_tx_status_reply_compressed_ba(priv, agg, ba_resp); + il4965_tx_status_reply_compressed_ba(il, agg, ba_resp); /* Release all TFDs before the SSN, i.e. all TFDs in front of * block-ack window (we assume that they've been successfully * transmitted ... if not, it's too late anyway). */ if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) { /* calculate mac80211 ampdu sw queue to wake */ - int freed = il4965_tx_queue_reclaim(priv, scd_flow, index); - il4965_free_tfds_in_queue(priv, sta_id, tid, freed); + int freed = il4965_tx_queue_reclaim(il, scd_flow, index); + il4965_free_tfds_in_queue(il, sta_id, tid, freed); if ((il_queue_space(&txq->q) > txq->q.low_mark) && - priv->mac80211_registered && + il->mac80211_registered && (agg->state != IL_EMPTYING_HW_QUEUE_DELBA)) - il_wake_queue(priv, txq); + il_wake_queue(il, txq); - il4965_txq_check_empty(priv, sta_id, tid, scd_flow); + il4965_txq_check_empty(il, sta_id, tid, scd_flow); } - spin_unlock_irqrestore(&priv->sta_lock, flags); + spin_unlock_irqrestore(&il->sta_lock, flags); } #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-ucode.c b/drivers/net/wireless/iwlegacy/iwl-4965-ucode.c index 3c9df1bb5afe..d4dc597452ea 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-ucode.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-ucode.c @@ -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; } diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.c b/drivers/net/wireless/iwlegacy/iwl-4965.c index 0f2bc5f767da..d3c818354ca5 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965.c @@ -48,8 +48,8 @@ #include "iwl-4965.h" #include "iwl-4965-debugfs.h" -static int il4965_send_tx_power(struct il_priv *priv); -static int il4965_hw_get_temperature(struct il_priv *priv); +static int il4965_send_tx_power(struct il_priv *il); +static int il4965_hw_get_temperature(struct il_priv *il); /* Highest firmware API version supported */ #define IWL4965_UCODE_API_MAX 2 @@ -62,23 +62,23 @@ static int il4965_hw_get_temperature(struct il_priv *priv); #define IWL4965_MODULE_FIRMWARE(api) _IWL4965_MODULE_FIRMWARE(api) /* check contents of special bootstrap uCode SRAM */ -static int il4965_verify_bsm(struct il_priv *priv) +static int il4965_verify_bsm(struct il_priv *il) { - __le32 *image = priv->ucode_boot.v_addr; - u32 len = priv->ucode_boot.len; + __le32 *image = il->ucode_boot.v_addr; + u32 len = il->ucode_boot.len; u32 reg; u32 val; - IL_DEBUG_INFO(priv, "Begin verify bsm\n"); + IL_DEBUG_INFO(il, "Begin verify bsm\n"); /* verify BSM SRAM contents */ - val = il_read_prph(priv, BSM_WR_DWCOUNT_REG); + val = il_read_prph(il, BSM_WR_DWCOUNT_REG); for (reg = BSM_SRAM_LOWER_BOUND; reg < BSM_SRAM_LOWER_BOUND + len; reg += sizeof(u32), image++) { - val = il_read_prph(priv, reg); + val = il_read_prph(il, reg); if (val != le32_to_cpu(*image)) { - IL_ERR(priv, "BSM uCode verification failed at " + IL_ERR(il, "BSM uCode verification failed at " "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n", BSM_SRAM_LOWER_BOUND, reg - BSM_SRAM_LOWER_BOUND, len, @@ -87,7 +87,7 @@ static int il4965_verify_bsm(struct il_priv *priv) } } - IL_DEBUG_INFO(priv, "BSM bootstrap uCode image OK\n"); + IL_DEBUG_INFO(il, "BSM bootstrap uCode image OK\n"); return 0; } @@ -124,10 +124,10 @@ static int il4965_verify_bsm(struct il_priv *priv) * the runtime uCode instructions and the backup data cache into SRAM, * and re-launches the runtime uCode from where it left off. */ -static int il4965_load_bsm(struct il_priv *priv) +static int il4965_load_bsm(struct il_priv *il) { - __le32 *image = priv->ucode_boot.v_addr; - u32 len = priv->ucode_boot.len; + __le32 *image = il->ucode_boot.v_addr; + u32 len = il->ucode_boot.len; dma_addr_t pinst; dma_addr_t pdata; u32 inst_len; @@ -137,9 +137,9 @@ static int il4965_load_bsm(struct il_priv *priv) u32 reg_offset; int ret; - IL_DEBUG_INFO(priv, "Begin load bsm\n"); + IL_DEBUG_INFO(il, "Begin load bsm\n"); - priv->ucode_type = UCODE_RT; + il->ucode_type = UCODE_RT; /* make sure bootstrap program is no larger than BSM's SRAM size */ if (len > IWL49_MAX_BSM_SIZE) @@ -151,53 +151,53 @@ static int il4965_load_bsm(struct il_priv *priv) * after the "initialize" uCode has run, to point to * runtime/protocol instructions and backup data cache. */ - pinst = priv->ucode_init.p_addr >> 4; - pdata = priv->ucode_init_data.p_addr >> 4; - inst_len = priv->ucode_init.len; - data_len = priv->ucode_init_data.len; + pinst = il->ucode_init.p_addr >> 4; + pdata = il->ucode_init_data.p_addr >> 4; + inst_len = il->ucode_init.len; + data_len = il->ucode_init_data.len; - il_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); - il_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); - il_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); - il_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); + il_write_prph(il, BSM_DRAM_INST_PTR_REG, pinst); + il_write_prph(il, BSM_DRAM_DATA_PTR_REG, pdata); + il_write_prph(il, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); + il_write_prph(il, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); /* Fill BSM memory with bootstrap instructions */ for (reg_offset = BSM_SRAM_LOWER_BOUND; reg_offset < BSM_SRAM_LOWER_BOUND + len; reg_offset += sizeof(u32), image++) - _il_write_prph(priv, reg_offset, le32_to_cpu(*image)); + _il_write_prph(il, reg_offset, le32_to_cpu(*image)); - ret = il4965_verify_bsm(priv); + ret = il4965_verify_bsm(il); if (ret) return ret; /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */ - il_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0); - il_write_prph(priv, + il_write_prph(il, BSM_WR_MEM_SRC_REG, 0x0); + il_write_prph(il, BSM_WR_MEM_DST_REG, IWL49_RTC_INST_LOWER_BOUND); - il_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); + il_write_prph(il, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); /* Load bootstrap code into instruction SRAM now, * to prepare to load "initialize" uCode */ - il_write_prph(priv, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START); + il_write_prph(il, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START); /* Wait for load of bootstrap uCode to finish */ for (i = 0; i < 100; i++) { - done = il_read_prph(priv, BSM_WR_CTRL_REG); + done = il_read_prph(il, BSM_WR_CTRL_REG); if (!(done & BSM_WR_CTRL_REG_BIT_START)) break; udelay(10); } if (i < 100) - IL_DEBUG_INFO(priv, "BSM write complete, poll %d iterations\n", i); + IL_DEBUG_INFO(il, "BSM write complete, poll %d iterations\n", i); else { - IL_ERR(priv, "BSM write did not complete!\n"); + IL_ERR(il, "BSM write did not complete!\n"); return -EIO; } /* Enable future boot loads whenever power management unit triggers it * (e.g. when powering back up after power-save shutdown) */ - il_write_prph(priv, + il_write_prph(il, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START_EN); @@ -213,27 +213,27 @@ static int il4965_load_bsm(struct il_priv *priv) * We need to replace them to load runtime uCode inst and data, * and to save runtime data when powering down. */ -static int il4965_set_ucode_ptrs(struct il_priv *priv) +static int il4965_set_ucode_ptrs(struct il_priv *il) { dma_addr_t pinst; dma_addr_t pdata; int ret = 0; /* bits 35:4 for 4965 */ - pinst = priv->ucode_code.p_addr >> 4; - pdata = priv->ucode_data_backup.p_addr >> 4; + pinst = il->ucode_code.p_addr >> 4; + pdata = il->ucode_data_backup.p_addr >> 4; /* Tell bootstrap uCode where to find image to load */ - il_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); - il_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); - il_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, - priv->ucode_data.len); + il_write_prph(il, BSM_DRAM_INST_PTR_REG, pinst); + il_write_prph(il, BSM_DRAM_DATA_PTR_REG, pdata); + il_write_prph(il, BSM_DRAM_DATA_BYTECOUNT_REG, + il->ucode_data.len); /* Inst byte count must be last to set up, bit 31 signals uCode * that all new ptr/size info is in place */ - il_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, - priv->ucode_code.len | BSM_DRAM_INST_LOAD); - IL_DEBUG_INFO(priv, "Runtime uCode pointers are set.\n"); + il_write_prph(il, BSM_DRAM_INST_BYTECOUNT_REG, + il->ucode_code.len | BSM_DRAM_INST_LOAD); + IL_DEBUG_INFO(il, "Runtime uCode pointers are set.\n"); return ret; } @@ -244,40 +244,40 @@ static int il4965_set_ucode_ptrs(struct il_priv *priv) * Called after REPLY_ALIVE notification received from "initialize" uCode. * * The 4965 "initialize" ALIVE reply contains calibration data for: - * Voltage, temperature, and MIMO tx gain correction, now stored in priv + * Voltage, temperature, and MIMO tx gain correction, now stored in il * (3945 does not contain this data). * * Tell "initialize" uCode to go ahead and load the runtime uCode. */ -static void il4965_init_alive_start(struct il_priv *priv) +static void il4965_init_alive_start(struct il_priv *il) { /* Bootstrap uCode has loaded initialize uCode ... verify inst image. * This is a paranoid check, because we would not have gotten the * "initialize" alive if code weren't properly loaded. */ - if (il4965_verify_ucode(priv)) { + if (il4965_verify_ucode(il)) { /* Runtime instruction load was bad; * take it all the way back down so we can try again */ - IL_DEBUG_INFO(priv, "Bad \"initialize\" uCode load.\n"); + IL_DEBUG_INFO(il, "Bad \"initialize\" uCode load.\n"); goto restart; } /* Calculate temperature */ - priv->temperature = il4965_hw_get_temperature(priv); + il->temperature = il4965_hw_get_temperature(il); /* Send pointers to protocol/runtime uCode image ... init code will * load and launch runtime uCode, which will send us another "Alive" * notification. */ - IL_DEBUG_INFO(priv, "Initialization Alive received.\n"); - if (il4965_set_ucode_ptrs(priv)) { + IL_DEBUG_INFO(il, "Initialization Alive received.\n"); + if (il4965_set_ucode_ptrs(il)) { /* Runtime instruction load won't happen; * take it all the way back down so we can try again */ - IL_DEBUG_INFO(priv, "Couldn't set up uCode pointers.\n"); + IL_DEBUG_INFO(il, "Couldn't set up uCode pointers.\n"); goto restart; } return; restart: - queue_work(priv->workqueue, &priv->restart); + queue_work(il->workqueue, &il->restart); } static bool iw4965_is_ht40_channel(__le32 rxon_flags) @@ -288,43 +288,43 @@ static bool iw4965_is_ht40_channel(__le32 rxon_flags) (chan_mod == CHANNEL_MODE_MIXED)); } -static void il4965_nic_config(struct il_priv *priv) +static void il4965_nic_config(struct il_priv *il) { unsigned long flags; u16 radio_cfg; - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); - radio_cfg = il_eeprom_query16(priv, EEPROM_RADIO_CONFIG); + radio_cfg = il_eeprom_query16(il, EEPROM_RADIO_CONFIG); /* write radio config values to register */ if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) == EEPROM_4965_RF_CFG_TYPE_MAX) - il_set_bit(priv, CSR_HW_IF_CONFIG_REG, + il_set_bit(il, CSR_HW_IF_CONFIG_REG, EEPROM_RF_CFG_TYPE_MSK(radio_cfg) | EEPROM_RF_CFG_STEP_MSK(radio_cfg) | EEPROM_RF_CFG_DASH_MSK(radio_cfg)); /* set CSR_HW_CONFIG_REG for uCode use */ - il_set_bit(priv, CSR_HW_IF_CONFIG_REG, + il_set_bit(il, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); - priv->calib_info = (struct il_eeprom_calib_info *) - il_eeprom_query_addr(priv, + il->calib_info = (struct il_eeprom_calib_info *) + il_eeprom_query_addr(il, EEPROM_4965_CALIB_TXPOWER_OFFSET); - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&il->lock, flags); } /* Reset differential Rx gains in NIC to prepare for chain noise calibration. * Called after every association, but this runs only once! * ... once chain noise is calibrated the first time, it's good forever. */ -static void il4965_chain_noise_reset(struct il_priv *priv) +static void il4965_chain_noise_reset(struct il_priv *il) { - struct il_chain_noise_data *data = &(priv->chain_noise_data); + struct il_chain_noise_data *data = &(il->chain_noise_data); if ((data->state == IL_CHAIN_NOISE_ALIVE) && - il_is_any_associated(priv)) { + il_is_any_associated(il)) { struct il_calib_diff_gain_cmd cmd; /* clear data for chain noise calibration algorithm */ @@ -341,12 +341,12 @@ static void il4965_chain_noise_reset(struct il_priv *priv) cmd.diff_gain_a = 0; cmd.diff_gain_b = 0; cmd.diff_gain_c = 0; - if (il_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, + if (il_send_cmd_pdu(il, REPLY_PHY_CALIBRATION_CMD, sizeof(cmd), &cmd)) - IL_ERR(priv, + IL_ERR(il, "Could not send REPLY_PHY_CALIBRATION_CMD\n"); data->state = IL_CHAIN_NOISE_ACCUMULATE; - IL_DEBUG_CALIB(priv, "Run chain_noise_calibrate\n"); + IL_DEBUG_CALIB(il, "Run chain_noise_calibrate\n"); } } @@ -377,10 +377,10 @@ static struct il_sensitivity_ranges il4965_sensitivity = { .nrg_th_cca = 62, }; -static void il4965_set_ct_threshold(struct il_priv *priv) +static void il4965_set_ct_threshold(struct il_priv *il) { /* want Kelvin */ - priv->hw_params.ct_kill_threshold = + il->hw_params.ct_kill_threshold = CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD_LEGACY); } @@ -389,37 +389,37 @@ static void il4965_set_ct_threshold(struct il_priv *priv) * * Called when initializing driver */ -static int il4965_hw_set_hw_params(struct il_priv *priv) +static int il4965_hw_set_hw_params(struct il_priv *il) { - if (priv->cfg->mod_params->num_of_queues >= IL_MIN_NUM_QUEUES && - priv->cfg->mod_params->num_of_queues <= IWL49_NUM_QUEUES) - priv->cfg->base_params->num_of_queues = - priv->cfg->mod_params->num_of_queues; - - priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues; - priv->hw_params.dma_chnl_num = FH49_TCSR_CHNL_NUM; - priv->hw_params.scd_bc_tbls_size = - priv->cfg->base_params->num_of_queues * + if (il->cfg->mod_params->num_of_queues >= IL_MIN_NUM_QUEUES && + il->cfg->mod_params->num_of_queues <= IWL49_NUM_QUEUES) + il->cfg->base_params->num_of_queues = + il->cfg->mod_params->num_of_queues; + + il->hw_params.max_txq_num = il->cfg->base_params->num_of_queues; + il->hw_params.dma_chnl_num = FH49_TCSR_CHNL_NUM; + il->hw_params.scd_bc_tbls_size = + il->cfg->base_params->num_of_queues * sizeof(struct il4965_scd_bc_tbl); - priv->hw_params.tfd_size = sizeof(struct il_tfd); - priv->hw_params.max_stations = IWL4965_STATION_COUNT; - priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id = IWL4965_BROADCAST_ID; - priv->hw_params.max_data_size = IWL49_RTC_DATA_SIZE; - priv->hw_params.max_inst_size = IWL49_RTC_INST_SIZE; - priv->hw_params.max_bsm_size = BSM_SRAM_SIZE; - priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_5GHZ); + il->hw_params.tfd_size = sizeof(struct il_tfd); + il->hw_params.max_stations = IWL4965_STATION_COUNT; + il->contexts[IL_RXON_CTX_BSS].bcast_sta_id = IWL4965_BROADCAST_ID; + il->hw_params.max_data_size = IWL49_RTC_DATA_SIZE; + il->hw_params.max_inst_size = IWL49_RTC_INST_SIZE; + il->hw_params.max_bsm_size = BSM_SRAM_SIZE; + il->hw_params.ht40_channel = BIT(IEEE80211_BAND_5GHZ); - priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR; + il->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR; - priv->hw_params.tx_chains_num = il4965_num_of_ant(priv->cfg->valid_tx_ant); - priv->hw_params.rx_chains_num = il4965_num_of_ant(priv->cfg->valid_rx_ant); - priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant; - priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant; + il->hw_params.tx_chains_num = il4965_num_of_ant(il->cfg->valid_tx_ant); + il->hw_params.rx_chains_num = il4965_num_of_ant(il->cfg->valid_rx_ant); + il->hw_params.valid_tx_ant = il->cfg->valid_tx_ant; + il->hw_params.valid_rx_ant = il->cfg->valid_rx_ant; - il4965_set_ct_threshold(priv); + il4965_set_ct_threshold(il); - priv->hw_params.sens = &il4965_sensitivity; - priv->hw_params.beacon_time_tsf_bits = IWL4965_EXT_BEACON_TIME_POS; + il->hw_params.sens = &il4965_sensitivity; + il->hw_params.beacon_time_tsf_bits = IWL4965_EXT_BEACON_TIME_POS; return 0; } @@ -498,16 +498,16 @@ static s32 il4965_get_tx_atten_grp(u16 channel) return -EINVAL; } -static u32 il4965_get_sub_band(const struct il_priv *priv, u32 channel) +static u32 il4965_get_sub_band(const struct il_priv *il, u32 channel) { s32 b = -1; for (b = 0; b < EEPROM_TX_POWER_BANDS; b++) { - if (priv->calib_info->band_info[b].ch_from == 0) + if (il->calib_info->band_info[b].ch_from == 0) continue; - if ((channel >= priv->calib_info->band_info[b].ch_from) - && (channel <= priv->calib_info->band_info[b].ch_to)) + if ((channel >= il->calib_info->band_info[b].ch_from) + && (channel <= il->calib_info->band_info[b].ch_to)) break; } @@ -534,7 +534,7 @@ static s32 il4965_interpolate_value(s32 x, s32 x1, s32 y1, s32 x2, s32 y2) * differences in channel frequencies, which is proportional to differences * in channel number. */ -static int il4965_interpolate_chan(struct il_priv *priv, u32 channel, +static int il4965_interpolate_chan(struct il_priv *il, u32 channel, struct il_eeprom_calib_ch_info *chan_info) { s32 s = -1; @@ -546,24 +546,24 @@ static int il4965_interpolate_chan(struct il_priv *priv, u32 channel, u32 ch_i1; u32 ch_i2; - s = il4965_get_sub_band(priv, channel); + s = il4965_get_sub_band(il, channel); if (s >= EEPROM_TX_POWER_BANDS) { - IL_ERR(priv, "Tx Power can not find channel %d\n", channel); + IL_ERR(il, "Tx Power can not find channel %d\n", channel); return -1; } - ch_i1 = priv->calib_info->band_info[s].ch1.ch_num; - ch_i2 = priv->calib_info->band_info[s].ch2.ch_num; + ch_i1 = il->calib_info->band_info[s].ch1.ch_num; + ch_i2 = il->calib_info->band_info[s].ch2.ch_num; chan_info->ch_num = (u8) channel; - IL_DEBUG_TXPOWER(priv, "channel %d subband %d factory cal ch %d & %d\n", + IL_DEBUG_TXPOWER(il, "channel %d subband %d factory cal ch %d & %d\n", channel, s, ch_i1, ch_i2); for (c = 0; c < EEPROM_TX_POWER_TX_CHAINS; c++) { for (m = 0; m < EEPROM_TX_POWER_MEASUREMENTS; m++) { - m1 = &(priv->calib_info->band_info[s].ch1. + m1 = &(il->calib_info->band_info[s].ch1. measurements[c][m]); - m2 = &(priv->calib_info->band_info[s].ch2. + m2 = &(il->calib_info->band_info[s].ch2. measurements[c][m]); omeas = &(chan_info->measurements[c][m]); @@ -586,16 +586,16 @@ static int il4965_interpolate_chan(struct il_priv *priv, u32 channel, m1->pa_det, ch_i2, m2->pa_det); - IL_DEBUG_TXPOWER(priv, + IL_DEBUG_TXPOWER(il, "chain %d meas %d AP1=%d AP2=%d AP=%d\n", c, m, m1->actual_pow, m2->actual_pow, omeas->actual_pow); - IL_DEBUG_TXPOWER(priv, + IL_DEBUG_TXPOWER(il, "chain %d meas %d NI1=%d NI2=%d NI=%d\n", c, m, m1->gain_idx, m2->gain_idx, omeas->gain_idx); - IL_DEBUG_TXPOWER(priv, + IL_DEBUG_TXPOWER(il, "chain %d meas %d PA1=%d PA2=%d PA=%d\n", c, m, m1->pa_det, m2->pa_det, omeas->pa_det); - IL_DEBUG_TXPOWER(priv, + IL_DEBUG_TXPOWER(il, "chain %d meas %d T1=%d T2=%d T=%d\n", c, m, m1->temperature, m2->temperature, omeas->temperature); @@ -867,7 +867,7 @@ static const struct gain_entry gain_table[2][108] = { } }; -static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, +static int il4965_fill_txpower_tbl(struct il_priv *il, u8 band, u16 channel, u8 is_ht40, u8 ctrl_chan_high, struct il4965_tx_power_db *tx_power_tbl) { @@ -897,13 +897,13 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, /* tx_power_user_lmt is in dBm, convert to half-dBm (half-dB units * are used for indexing into txpower table) */ - user_target_power = 2 * priv->tx_power_user_lmt; + user_target_power = 2 * il->tx_power_user_lmt; /* Get current (RXON) channel, band, width */ - IL_DEBUG_TXPOWER(priv, "chan %d band %d is_ht40 %d\n", channel, band, + IL_DEBUG_TXPOWER(il, "chan %d band %d is_ht40 %d\n", channel, band, is_ht40); - ch_info = il_get_channel_info(priv, priv->band, channel); + ch_info = il_get_channel_info(il, il->band, channel); if (!il_is_channel_valid(ch_info)) return -EINVAL; @@ -912,12 +912,12 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, * and 2) mimo txpower balance between Tx chains. */ txatten_grp = il4965_get_tx_atten_grp(channel); if (txatten_grp < 0) { - IL_ERR(priv, "Can't find txatten group for channel %d.\n", + IL_ERR(il, "Can't find txatten group for channel %d.\n", channel); return txatten_grp; } - IL_DEBUG_TXPOWER(priv, "channel %d belongs to txatten group %d\n", + IL_DEBUG_TXPOWER(il, "channel %d belongs to txatten group %d\n", channel, txatten_grp); if (is_ht40) { @@ -930,9 +930,9 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, /* hardware txpower limits ... * saturation (clipping distortion) txpowers are in half-dBm */ if (band) - saturation_power = priv->calib_info->saturation_power24; + saturation_power = il->calib_info->saturation_power24; else - saturation_power = priv->calib_info->saturation_power52; + saturation_power = il->calib_info->saturation_power52; if (saturation_power < IL_TX_POWER_SATURATION_MIN || saturation_power > IL_TX_POWER_SATURATION_MAX) { @@ -959,21 +959,21 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, /* Interpolate txpower calibration values for this channel, * based on factory calibration tests on spaced channels. */ - il4965_interpolate_chan(priv, channel, &ch_eeprom_info); + il4965_interpolate_chan(il, channel, &ch_eeprom_info); /* calculate tx gain adjustment based on power supply voltage */ - voltage = le16_to_cpu(priv->calib_info->voltage); - init_voltage = (s32)le32_to_cpu(priv->card_alive_init.voltage); + voltage = le16_to_cpu(il->calib_info->voltage); + init_voltage = (s32)le32_to_cpu(il->card_alive_init.voltage); voltage_compensation = il4965_get_voltage_compensation(voltage, init_voltage); - IL_DEBUG_TXPOWER(priv, "curr volt %d eeprom volt %d volt comp %d\n", + IL_DEBUG_TXPOWER(il, "curr volt %d eeprom volt %d volt comp %d\n", init_voltage, voltage, voltage_compensation); /* get current temperature (Celsius) */ - current_temp = max(priv->temperature, IL_TX_POWER_TEMPERATURE_MIN); - current_temp = min(priv->temperature, IL_TX_POWER_TEMPERATURE_MAX); + current_temp = max(il->temperature, IL_TX_POWER_TEMPERATURE_MIN); + current_temp = min(il->temperature, IL_TX_POWER_TEMPERATURE_MAX); current_temp = KELVIN_TO_CELSIUS(current_temp); /* select thermal txpower adjustment params, based on channel group @@ -998,13 +998,13 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, factory_gain_index[c] = measurement->gain_idx; factory_actual_pwr[c] = measurement->actual_pow; - IL_DEBUG_TXPOWER(priv, "chain = %d\n", c); - IL_DEBUG_TXPOWER(priv, "fctry tmp %d, " + IL_DEBUG_TXPOWER(il, "chain = %d\n", c); + IL_DEBUG_TXPOWER(il, "fctry tmp %d, " "curr tmp %d, comp %d steps\n", factory_temp, current_temp, temperature_comp[c]); - IL_DEBUG_TXPOWER(priv, "fctry idx %d, fctry pwr %d\n", + IL_DEBUG_TXPOWER(il, "fctry idx %d, fctry pwr %d\n", factory_gain_index[c], factory_actual_pwr[c]); } @@ -1037,7 +1037,7 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, if (target_power > power_limit) target_power = power_limit; - IL_DEBUG_TXPOWER(priv, "rate %d sat %d reg %d usr %d tgt %d\n", + IL_DEBUG_TXPOWER(il, "rate %d sat %d reg %d usr %d tgt %d\n", i, saturation_power - back_off_table[i], current_regulatory, user_target_power, target_power); @@ -1048,7 +1048,7 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, if (is_mimo_rate) atten_value = - (s32)le32_to_cpu(priv->card_alive_init. + (s32)le32_to_cpu(il->card_alive_init. tx_atten[txatten_grp][c]); else atten_value = 0; @@ -1061,7 +1061,7 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, voltage_compensation + atten_value); -/* IL_DEBUG_TXPOWER(priv, "calculated txpower index %d\n", +/* IL_DEBUG_TXPOWER(il, "calculated txpower index %d\n", power_index); */ if (power_index < get_min_power_index(i, band)) @@ -1078,12 +1078,12 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, /* stay within the table! */ if (power_index > 107) { - IL_WARN(priv, "txpower index %d > 107\n", + IL_WARN(il, "txpower index %d > 107\n", power_index); power_index = 107; } if (power_index < 0) { - IL_WARN(priv, "txpower index %d < 0\n", + IL_WARN(il, "txpower index %d < 0\n", power_index); power_index = 0; } @@ -1094,7 +1094,7 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, tx_power.s.dsp_predis_atten[c] = gain_table[band][power_index].dsp; - IL_DEBUG_TXPOWER(priv, "chain %d mimo %d index %d " + IL_DEBUG_TXPOWER(il, "chain %d mimo %d index %d " "gain 0x%02x dsp %d\n", c, atten_value, power_index, tx_power.s.radio_tx_gain[c], @@ -1112,22 +1112,22 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, * il4965_send_tx_power - Configure the TXPOWER level user limit * * Uses the active RXON for channel, band, and characteristics (ht40, high) - * The power limit is taken from priv->tx_power_user_lmt. + * The power limit is taken from il->tx_power_user_lmt. */ -static int il4965_send_tx_power(struct il_priv *priv) +static int il4965_send_tx_power(struct il_priv *il) { struct il4965_txpowertable_cmd cmd = { 0 }; int ret; u8 band = 0; bool is_ht40 = false; u8 ctrl_chan_high = 0; - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; - if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &priv->status), + if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &il->status), "TX Power requested while scanning!\n")) return -EAGAIN; - band = priv->band == IEEE80211_BAND_2GHZ; + band = il->band == IEEE80211_BAND_2GHZ; is_ht40 = iw4965_is_ht40_channel(ctx->active.flags); @@ -1137,20 +1137,20 @@ static int il4965_send_tx_power(struct il_priv *priv) cmd.band = band; cmd.channel = ctx->active.channel; - ret = il4965_fill_txpower_tbl(priv, band, + ret = il4965_fill_txpower_tbl(il, band, le16_to_cpu(ctx->active.channel), is_ht40, ctrl_chan_high, &cmd.tx_power); if (ret) goto out; - ret = il_send_cmd_pdu(priv, + ret = il_send_cmd_pdu(il, REPLY_TX_PWR_TABLE_CMD, sizeof(cmd), &cmd); out: return ret; } -static int il4965_send_rxon_assoc(struct il_priv *priv, +static int il4965_send_rxon_assoc(struct il_priv *il, struct il_rxon_context *ctx) { int ret = 0; @@ -1167,7 +1167,7 @@ static int il4965_send_rxon_assoc(struct il_priv *priv, rxon2->ofdm_ht_dual_stream_basic_rates) && (rxon1->rx_chain == rxon2->rx_chain) && (rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates)) { - IL_DEBUG_INFO(priv, "Using current RXON_ASSOC. Not resending.\n"); + IL_DEBUG_INFO(il, "Using current RXON_ASSOC. Not resending.\n"); return 0; } @@ -1182,13 +1182,13 @@ static int il4965_send_rxon_assoc(struct il_priv *priv, ctx->staging.ofdm_ht_dual_stream_basic_rates; rxon_assoc.rx_chain_select_flags = ctx->staging.rx_chain; - ret = il_send_cmd_pdu_async(priv, REPLY_RXON_ASSOC, + ret = il_send_cmd_pdu_async(il, REPLY_RXON_ASSOC, sizeof(rxon_assoc), &rxon_assoc, NULL); return ret; } -static int il4965_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) +static int il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx) { /* cast away the const for active_rxon in this function */ struct il_rxon_cmd *active_rxon = (void *)&ctx->active; @@ -1196,7 +1196,7 @@ static int il4965_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) bool new_assoc = !!(ctx->staging.filter_flags & RXON_FILTER_ASSOC_MSK); - if (!il_is_alive(priv)) + if (!il_is_alive(il)) return -EBUSY; if (!ctx->is_active) @@ -1205,9 +1205,9 @@ static int il4965_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) /* always get timestamp with Rx frame */ ctx->staging.flags |= RXON_FLG_TSF2HOST_MSK; - ret = il_check_rxon_cmd(priv, ctx); + ret = il_check_rxon_cmd(il, ctx); if (ret) { - IL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); + IL_ERR(il, "Invalid RXON configuration. Not committing.\n"); return -EINVAL; } @@ -1215,30 +1215,30 @@ static int il4965_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) * receive commit_rxon request * abort any previous channel switch if still in process */ - if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status) && - (priv->switch_channel != ctx->staging.channel)) { - IL_DEBUG_11H(priv, "abort channel switch on %d\n", - le16_to_cpu(priv->switch_channel)); - il_chswitch_done(priv, false); + if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &il->status) && + (il->switch_channel != ctx->staging.channel)) { + IL_DEBUG_11H(il, "abort channel switch on %d\n", + le16_to_cpu(il->switch_channel)); + il_chswitch_done(il, false); } /* If we don't need to send a full RXON, we can use * il_rxon_assoc_cmd which is used to reconfigure filter * and other flags for the current radio configuration. */ - if (!il_full_rxon_required(priv, ctx)) { - ret = il_send_rxon_assoc(priv, ctx); + if (!il_full_rxon_required(il, ctx)) { + ret = il_send_rxon_assoc(il, ctx); if (ret) { - IL_ERR(priv, "Error setting RXON_ASSOC (%d)\n", ret); + IL_ERR(il, "Error setting RXON_ASSOC (%d)\n", ret); return ret; } memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); - il_print_rx_config_cmd(priv, ctx); + il_print_rx_config_cmd(il, ctx); /* * We do not commit tx power settings while channel changing, * do it now if tx power changed. */ - il_set_tx_power(priv, priv->tx_power_next, false); + il_set_tx_power(il, il->tx_power_next, false); return 0; } @@ -1247,10 +1247,10 @@ static int il4965_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) * we must clear the associated from the active configuration * before we apply the new config */ if (il_is_associated_ctx(ctx) && new_assoc) { - IL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n"); + IL_DEBUG_INFO(il, "Toggling associated bit on current RXON\n"); active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; - ret = il_send_cmd_pdu(priv, ctx->rxon_cmd, + ret = il_send_cmd_pdu(il, ctx->rxon_cmd, sizeof(struct il_rxon_cmd), active_rxon); @@ -1258,19 +1258,19 @@ static int il4965_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) * active_rxon back to what it was previously */ if (ret) { active_rxon->filter_flags |= RXON_FILTER_ASSOC_MSK; - IL_ERR(priv, "Error clearing ASSOC_MSK (%d)\n", ret); + IL_ERR(il, "Error clearing ASSOC_MSK (%d)\n", ret); return ret; } - il_clear_ucode_stations(priv, ctx); - il_restore_stations(priv, ctx); - ret = il4965_restore_default_wep_keys(priv, ctx); + il_clear_ucode_stations(il, ctx); + il_restore_stations(il, ctx); + ret = il4965_restore_default_wep_keys(il, ctx); if (ret) { - IL_ERR(priv, "Failed to restore WEP keys (%d)\n", ret); + IL_ERR(il, "Failed to restore WEP keys (%d)\n", ret); return ret; } } - IL_DEBUG_INFO(priv, "Sending RXON\n" + IL_DEBUG_INFO(il, "Sending RXON\n" "* with%s RXON_FILTER_ASSOC_MSK\n" "* channel = %d\n" "* bssid = %pM\n", @@ -1278,62 +1278,62 @@ static int il4965_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) le16_to_cpu(ctx->staging.channel), ctx->staging.bssid_addr); - il_set_rxon_hwcrypto(priv, ctx, - !priv->cfg->mod_params->sw_crypto); + il_set_rxon_hwcrypto(il, ctx, + !il->cfg->mod_params->sw_crypto); /* Apply the new configuration * RXON unassoc clears the station table in uCode so restoration of * stations is needed after it (the RXON command) completes */ if (!new_assoc) { - ret = il_send_cmd_pdu(priv, ctx->rxon_cmd, + ret = il_send_cmd_pdu(il, ctx->rxon_cmd, sizeof(struct il_rxon_cmd), &ctx->staging); if (ret) { - IL_ERR(priv, "Error setting new RXON (%d)\n", ret); + IL_ERR(il, "Error setting new RXON (%d)\n", ret); return ret; } - IL_DEBUG_INFO(priv, "Return from !new_assoc RXON.\n"); + IL_DEBUG_INFO(il, "Return from !new_assoc RXON.\n"); memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); - il_clear_ucode_stations(priv, ctx); - il_restore_stations(priv, ctx); - ret = il4965_restore_default_wep_keys(priv, ctx); + il_clear_ucode_stations(il, ctx); + il_restore_stations(il, ctx); + ret = il4965_restore_default_wep_keys(il, ctx); if (ret) { - IL_ERR(priv, "Failed to restore WEP keys (%d)\n", ret); + IL_ERR(il, "Failed to restore WEP keys (%d)\n", ret); return ret; } } if (new_assoc) { - priv->start_calib = 0; + il->start_calib = 0; /* Apply the new configuration * RXON assoc doesn't clear the station table in uCode, */ - ret = il_send_cmd_pdu(priv, ctx->rxon_cmd, + ret = il_send_cmd_pdu(il, ctx->rxon_cmd, sizeof(struct il_rxon_cmd), &ctx->staging); if (ret) { - IL_ERR(priv, "Error setting new RXON (%d)\n", ret); + IL_ERR(il, "Error setting new RXON (%d)\n", ret); return ret; } memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); } - il_print_rx_config_cmd(priv, ctx); + il_print_rx_config_cmd(il, ctx); - il4965_init_sensitivity(priv); + il4965_init_sensitivity(il); /* If we issue a new RXON command which required a tune then we must * send a new TXPOWER command or we won't be able to Tx any frames */ - ret = il_set_tx_power(priv, priv->tx_power_next, true); + ret = il_set_tx_power(il, il->tx_power_next, true); if (ret) { - IL_ERR(priv, "Error sending TX power (%d)\n", ret); + IL_ERR(il, "Error sending TX power (%d)\n", ret); return ret; } return 0; } -static int il4965_hw_channel_switch(struct il_priv *priv, +static int il4965_hw_channel_switch(struct il_priv *il, struct ieee80211_channel_switch *ch_switch) { - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; int rc; u8 band = 0; bool is_ht40 = false; @@ -1346,7 +1346,7 @@ static int il4965_hw_channel_switch(struct il_priv *priv, u8 switch_count; u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval); struct ieee80211_vif *vif = ctx->vif; - band = priv->band == IEEE80211_BAND_2GHZ; + band = il->band == IEEE80211_BAND_2GHZ; is_ht40 = iw4965_is_ht40_channel(ctx->staging.flags); @@ -1366,57 +1366,57 @@ static int il4965_hw_channel_switch(struct il_priv *priv, * calculate the ucode channel switch time * adding TSF as one of the factor for when to switch */ - if ((priv->ucode_beacon_time > tsf_low) && beacon_interval) { - if (switch_count > ((priv->ucode_beacon_time - tsf_low) / + if ((il->ucode_beacon_time > tsf_low) && beacon_interval) { + if (switch_count > ((il->ucode_beacon_time - tsf_low) / beacon_interval)) { - switch_count -= (priv->ucode_beacon_time - + switch_count -= (il->ucode_beacon_time - tsf_low) / beacon_interval; } else switch_count = 0; } if (switch_count <= 1) - cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time); + cmd.switch_time = cpu_to_le32(il->ucode_beacon_time); else { switch_time_in_usec = vif->bss_conf.beacon_int * switch_count * TIME_UNIT; - ucode_switch_time = il_usecs_to_beacons(priv, + ucode_switch_time = il_usecs_to_beacons(il, switch_time_in_usec, beacon_interval); - cmd.switch_time = il_add_beacon_time(priv, - priv->ucode_beacon_time, + cmd.switch_time = il_add_beacon_time(il, + il->ucode_beacon_time, ucode_switch_time, beacon_interval); } - IL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n", + IL_DEBUG_11H(il, "uCode time for the switch is 0x%x\n", cmd.switch_time); - ch_info = il_get_channel_info(priv, priv->band, ch); + ch_info = il_get_channel_info(il, il->band, ch); if (ch_info) cmd.expect_beacon = il_is_channel_radar(ch_info); else { - IL_ERR(priv, "invalid channel switch from %u to %u\n", + IL_ERR(il, "invalid channel switch from %u to %u\n", ctx->active.channel, ch); return -EFAULT; } - rc = il4965_fill_txpower_tbl(priv, band, ch, is_ht40, + rc = il4965_fill_txpower_tbl(il, band, ch, is_ht40, ctrl_chan_high, &cmd.tx_power); if (rc) { - IL_DEBUG_11H(priv, "error:%d fill txpower_tbl\n", rc); + IL_DEBUG_11H(il, "error:%d fill txpower_tbl\n", rc); return rc; } - return il_send_cmd_pdu(priv, + return il_send_cmd_pdu(il, REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd); } /** * il4965_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array */ -static void il4965_txq_update_byte_cnt_tbl(struct il_priv *priv, +static void il4965_txq_update_byte_cnt_tbl(struct il_priv *il, struct il_tx_queue *txq, u16 byte_cnt) { - struct il4965_scd_bc_tbl *scd_bc_tbl = priv->scd_bc_tbls.addr; + struct il4965_scd_bc_tbl *scd_bc_tbl = il->scd_bc_tbls.addr; int txq_id = txq->q.id; int write_ptr = txq->q.write_ptr; int len = byte_cnt + IL_TX_CRC_SIZE + IL_TX_DELIMITER_SIZE; @@ -1440,27 +1440,27 @@ static void il4965_txq_update_byte_cnt_tbl(struct il_priv *priv, * * A return of <0 indicates bogus data in the statistics */ -static int il4965_hw_get_temperature(struct il_priv *priv) +static int il4965_hw_get_temperature(struct il_priv *il) { s32 temperature; s32 vt; s32 R1, R2, R3; u32 R4; - if (test_bit(STATUS_TEMPERATURE, &priv->status) && - (priv->_4965.statistics.flag & + if (test_bit(STATUS_TEMPERATURE, &il->status) && + (il->_4965.statistics.flag & STATISTICS_REPLY_FLG_HT40_MODE_MSK)) { - IL_DEBUG_TEMP(priv, "Running HT40 temperature calibration\n"); - R1 = (s32)le32_to_cpu(priv->card_alive_init.therm_r1[1]); - R2 = (s32)le32_to_cpu(priv->card_alive_init.therm_r2[1]); - R3 = (s32)le32_to_cpu(priv->card_alive_init.therm_r3[1]); - R4 = le32_to_cpu(priv->card_alive_init.therm_r4[1]); + IL_DEBUG_TEMP(il, "Running HT40 temperature calibration\n"); + R1 = (s32)le32_to_cpu(il->card_alive_init.therm_r1[1]); + R2 = (s32)le32_to_cpu(il->card_alive_init.therm_r2[1]); + R3 = (s32)le32_to_cpu(il->card_alive_init.therm_r3[1]); + R4 = le32_to_cpu(il->card_alive_init.therm_r4[1]); } else { - IL_DEBUG_TEMP(priv, "Running temperature calibration\n"); - R1 = (s32)le32_to_cpu(priv->card_alive_init.therm_r1[0]); - R2 = (s32)le32_to_cpu(priv->card_alive_init.therm_r2[0]); - R3 = (s32)le32_to_cpu(priv->card_alive_init.therm_r3[0]); - R4 = le32_to_cpu(priv->card_alive_init.therm_r4[0]); + IL_DEBUG_TEMP(il, "Running temperature calibration\n"); + R1 = (s32)le32_to_cpu(il->card_alive_init.therm_r1[0]); + R2 = (s32)le32_to_cpu(il->card_alive_init.therm_r2[0]); + R3 = (s32)le32_to_cpu(il->card_alive_init.therm_r3[0]); + R4 = le32_to_cpu(il->card_alive_init.therm_r4[0]); } /* @@ -1470,16 +1470,16 @@ static int il4965_hw_get_temperature(struct il_priv *priv) * with an updated temperature, use R4 provided to us in the * "initialize" ALIVE response. */ - if (!test_bit(STATUS_TEMPERATURE, &priv->status)) + if (!test_bit(STATUS_TEMPERATURE, &il->status)) vt = sign_extend32(R4, 23); else - vt = sign_extend32(le32_to_cpu(priv->_4965.statistics. + vt = sign_extend32(le32_to_cpu(il->_4965.statistics. general.common.temperature), 23); - IL_DEBUG_TEMP(priv, "Calib values R[1-3]: %d %d %d R4: %d\n", R1, R2, R3, vt); + IL_DEBUG_TEMP(il, "Calib values R[1-3]: %d %d %d R4: %d\n", R1, R2, R3, vt); if (R3 == R1) { - IL_ERR(priv, "Calibration conflict R1 == R3\n"); + IL_ERR(il, "Calibration conflict R1 == R3\n"); return -1; } @@ -1489,7 +1489,7 @@ static int il4965_hw_get_temperature(struct il_priv *priv) temperature /= (R3 - R1); temperature = (temperature * 97) / 100 + TEMPERATURE_CALIB_KELVIN_OFFSET; - IL_DEBUG_TEMP(priv, "Calibrated temperature: %dK, %dC\n", + IL_DEBUG_TEMP(il, "Calibrated temperature: %dK, %dC\n", temperature, KELVIN_TO_CELSIUS(temperature)); return temperature; @@ -1504,66 +1504,66 @@ static int il4965_hw_get_temperature(struct il_priv *priv) * If the temperature changed has changed sufficiently, then a recalibration * is needed. * - * Assumes caller will replace priv->last_temperature once calibration + * Assumes caller will replace il->last_temperature once calibration * executed. */ -static int il4965_is_temp_calib_needed(struct il_priv *priv) +static int il4965_is_temp_calib_needed(struct il_priv *il) { int temp_diff; - if (!test_bit(STATUS_STATISTICS, &priv->status)) { - IL_DEBUG_TEMP(priv, "Temperature not updated -- no statistics.\n"); + if (!test_bit(STATUS_STATISTICS, &il->status)) { + IL_DEBUG_TEMP(il, "Temperature not updated -- no statistics.\n"); return 0; } - temp_diff = priv->temperature - priv->last_temperature; + temp_diff = il->temperature - il->last_temperature; /* get absolute value */ if (temp_diff < 0) { - IL_DEBUG_POWER(priv, "Getting cooler, delta %d\n", temp_diff); + IL_DEBUG_POWER(il, "Getting cooler, delta %d\n", temp_diff); temp_diff = -temp_diff; } else if (temp_diff == 0) - IL_DEBUG_POWER(priv, "Temperature unchanged\n"); + IL_DEBUG_POWER(il, "Temperature unchanged\n"); else - IL_DEBUG_POWER(priv, "Getting warmer, delta %d\n", temp_diff); + IL_DEBUG_POWER(il, "Getting warmer, delta %d\n", temp_diff); if (temp_diff < IL_TEMPERATURE_THRESHOLD) { - IL_DEBUG_POWER(priv, " => thermal txpower calib not needed\n"); + IL_DEBUG_POWER(il, " => thermal txpower calib not needed\n"); return 0; } - IL_DEBUG_POWER(priv, " => thermal txpower calib needed\n"); + IL_DEBUG_POWER(il, " => thermal txpower calib needed\n"); return 1; } -static void il4965_temperature_calib(struct il_priv *priv) +static void il4965_temperature_calib(struct il_priv *il) { s32 temp; - temp = il4965_hw_get_temperature(priv); + temp = il4965_hw_get_temperature(il); if (IL_TX_POWER_TEMPERATURE_OUT_OF_RANGE(temp)) return; - if (priv->temperature != temp) { - if (priv->temperature) - IL_DEBUG_TEMP(priv, "Temperature changed " + if (il->temperature != temp) { + if (il->temperature) + IL_DEBUG_TEMP(il, "Temperature changed " "from %dC to %dC\n", - KELVIN_TO_CELSIUS(priv->temperature), + KELVIN_TO_CELSIUS(il->temperature), KELVIN_TO_CELSIUS(temp)); else - IL_DEBUG_TEMP(priv, "Temperature " + IL_DEBUG_TEMP(il, "Temperature " "initialized to %dC\n", KELVIN_TO_CELSIUS(temp)); } - priv->temperature = temp; - set_bit(STATUS_TEMPERATURE, &priv->status); + il->temperature = temp; + set_bit(STATUS_TEMPERATURE, &il->status); - if (!priv->disable_tx_power_cal && - unlikely(!test_bit(STATUS_SCANNING, &priv->status)) && - il4965_is_temp_calib_needed(priv)) - queue_work(priv->workqueue, &priv->txpower_work); + if (!il->disable_tx_power_cal && + unlikely(!test_bit(STATUS_SCANNING, &il->status)) && + il4965_is_temp_calib_needed(il)) + queue_work(il->workqueue, &il->txpower_work); } static u16 il4965_get_hcmd_size(u8 cmd_id, u16 len) @@ -1604,7 +1604,7 @@ static inline u32 il4965_get_scd_ssn(struct il4965_tx_resp *tx_resp) /** * il4965_tx_status_reply_tx - Handle Tx response for frames in aggregation queue */ -static int il4965_tx_status_reply_tx(struct il_priv *priv, +static int il4965_tx_status_reply_tx(struct il_priv *il, struct il_ht_agg *agg, struct il4965_tx_resp *tx_resp, int txq_id, u16 start_idx) @@ -1617,7 +1617,7 @@ static int il4965_tx_status_reply_tx(struct il_priv *priv, int i, sh, idx; u16 seq; if (agg->wait_for_ba) - IL_DEBUG_TX_REPLY(priv, "got tx response w/o block-ack\n"); + IL_DEBUG_TX_REPLY(il, "got tx response w/o block-ack\n"); agg->frame_count = tx_resp->frame_count; agg->start_idx = start_idx; @@ -1630,18 +1630,18 @@ static int il4965_tx_status_reply_tx(struct il_priv *priv, status = le16_to_cpu(frame_status[0].status); idx = start_idx; - IL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, StartIdx=%d idx=%d\n", + IL_DEBUG_TX_REPLY(il, "FrameCnt = %d, StartIdx=%d idx=%d\n", agg->frame_count, agg->start_idx, idx); - info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb); + info = IEEE80211_SKB_CB(il->txq[txq_id].txb[idx].skb); info->status.rates[0].count = tx_resp->failure_frame + 1; info->flags &= ~IEEE80211_TX_CTL_AMPDU; info->flags |= il4965_tx_status_to_mac80211(status); - il4965_hwrate_to_tx_control(priv, rate_n_flags, info); + il4965_hwrate_to_tx_control(il, rate_n_flags, info); - IL_DEBUG_TX_REPLY(priv, "1 Frame 0x%x failure :%d\n", + IL_DEBUG_TX_REPLY(il, "1 Frame 0x%x failure :%d\n", status & 0xff, tx_resp->failure_frame); - IL_DEBUG_TX_REPLY(priv, "Rate Info rate_n_flags=%x\n", rate_n_flags); + IL_DEBUG_TX_REPLY(il, "Rate Info rate_n_flags=%x\n", rate_n_flags); agg->wait_for_ba = 0; } else { @@ -1661,12 +1661,12 @@ static int il4965_tx_status_reply_tx(struct il_priv *priv, AGG_TX_STATE_ABORT_MSK)) continue; - IL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, txq_id=%d idx=%d\n", + IL_DEBUG_TX_REPLY(il, "FrameCnt = %d, txq_id=%d idx=%d\n", agg->frame_count, txq_id, idx); - hdr = il_tx_queue_get_hdr(priv, txq_id, idx); + hdr = il_tx_queue_get_hdr(il, txq_id, idx); if (!hdr) { - IL_ERR(priv, + IL_ERR(il, "BUG_ON idx doesn't point to valid skb" " idx=%d, txq_id=%d\n", idx, txq_id); return -1; @@ -1674,14 +1674,14 @@ static int il4965_tx_status_reply_tx(struct il_priv *priv, sc = le16_to_cpu(hdr->seq_ctrl); if (idx != (SEQ_TO_SN(sc) & 0xff)) { - IL_ERR(priv, + IL_ERR(il, "BUG_ON idx doesn't match seq control" " idx=%d, seq_idx=%d, seq=%d\n", idx, SEQ_TO_SN(sc), hdr->seq_ctrl); return -1; } - IL_DEBUG_TX_REPLY(priv, "AGG Frame i=%d idx %d seq=%d\n", + IL_DEBUG_TX_REPLY(il, "AGG Frame i=%d idx %d seq=%d\n", i, idx, SEQ_TO_SN(sc)); sh = idx - start; @@ -1699,13 +1699,13 @@ static int il4965_tx_status_reply_tx(struct il_priv *priv, sh = 0; } bitmap |= 1ULL << sh; - IL_DEBUG_TX_REPLY(priv, "start=%d bitmap=0x%llx\n", + IL_DEBUG_TX_REPLY(il, "start=%d bitmap=0x%llx\n", start, (unsigned long long)bitmap); } agg->bitmap = bitmap; agg->start_idx = start; - IL_DEBUG_TX_REPLY(priv, "Frames %d start_idx=%d bitmap=0x%llx\n", + IL_DEBUG_TX_REPLY(il, "Frames %d start_idx=%d bitmap=0x%llx\n", agg->frame_count, agg->start_idx, (unsigned long long)agg->bitmap); @@ -1715,30 +1715,30 @@ static int il4965_tx_status_reply_tx(struct il_priv *priv, return 0; } -static u8 il4965_find_station(struct il_priv *priv, const u8 *addr) +static u8 il4965_find_station(struct il_priv *il, const u8 *addr) { int i; int start = 0; int ret = IL_INVALID_STATION; unsigned long flags; - if ((priv->iw_mode == NL80211_IFTYPE_ADHOC)) + if ((il->iw_mode == NL80211_IFTYPE_ADHOC)) start = IL_STA_ID; if (is_broadcast_ether_addr(addr)) - return priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id; + return il->contexts[IL_RXON_CTX_BSS].bcast_sta_id; - spin_lock_irqsave(&priv->sta_lock, flags); - for (i = start; i < priv->hw_params.max_stations; i++) - if (priv->stations[i].used && - (!compare_ether_addr(priv->stations[i].sta.sta.addr, + spin_lock_irqsave(&il->sta_lock, flags); + for (i = start; i < il->hw_params.max_stations; i++) + if (il->stations[i].used && + (!compare_ether_addr(il->stations[i].sta.sta.addr, addr))) { ret = i; goto out; } - IL_DEBUG_ASSOC_LIMIT(priv, "can not find STA %pM total %d\n", - addr, priv->num_stations); + IL_DEBUG_ASSOC_LIMIT(il, "can not find STA %pM total %d\n", + addr, il->num_stations); out: /* @@ -1747,38 +1747,38 @@ static u8 il4965_find_station(struct il_priv *priv, const u8 *addr) * station */ if (ret != IL_INVALID_STATION && - (!(priv->stations[ret].used & IL_STA_UCODE_ACTIVE) || - ((priv->stations[ret].used & IL_STA_UCODE_ACTIVE) && - (priv->stations[ret].used & IL_STA_UCODE_INPROGRESS)))) { - IL_ERR(priv, "Requested station info for sta %d before ready.\n", + (!(il->stations[ret].used & IL_STA_UCODE_ACTIVE) || + ((il->stations[ret].used & IL_STA_UCODE_ACTIVE) && + (il->stations[ret].used & IL_STA_UCODE_INPROGRESS)))) { + IL_ERR(il, "Requested station info for sta %d before ready.\n", ret); ret = IL_INVALID_STATION; } - spin_unlock_irqrestore(&priv->sta_lock, flags); + spin_unlock_irqrestore(&il->sta_lock, flags); return ret; } -static int il4965_get_ra_sta_id(struct il_priv *priv, struct ieee80211_hdr *hdr) +static int il4965_get_ra_sta_id(struct il_priv *il, struct ieee80211_hdr *hdr) { - if (priv->iw_mode == NL80211_IFTYPE_STATION) { + if (il->iw_mode == NL80211_IFTYPE_STATION) { return IL_AP_ID; } else { u8 *da = ieee80211_get_DA(hdr); - return il4965_find_station(priv, da); + return il4965_find_station(il, da); } } /** * il4965_rx_reply_tx - Handle standard (non-aggregation) Tx response */ -static void il4965_rx_reply_tx(struct il_priv *priv, +static void il4965_rx_reply_tx(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); int txq_id = SEQ_TO_QUEUE(sequence); int index = SEQ_TO_INDEX(sequence); - struct il_tx_queue *txq = &priv->txq[txq_id]; + struct il_tx_queue *txq = &il->txq[txq_id]; struct ieee80211_hdr *hdr; struct ieee80211_tx_info *info; struct il4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; @@ -1790,7 +1790,7 @@ static void il4965_rx_reply_tx(struct il_priv *priv, unsigned long flags; if ((index >= txq->q.n_bd) || (il_queue_used(&txq->q, index) == 0)) { - IL_ERR(priv, "Read index for DMA queue txq_id (%d) index %d " + IL_ERR(il, "Read index for DMA queue txq_id (%d) index %d " "is out of range [0-%d] %d %d\n", txq_id, index, txq->q.n_bd, txq->q.write_ptr, txq->q.read_ptr); @@ -1801,27 +1801,27 @@ static void il4965_rx_reply_tx(struct il_priv *priv, info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb); memset(&info->status, 0, sizeof(info->status)); - hdr = il_tx_queue_get_hdr(priv, txq_id, index); + hdr = il_tx_queue_get_hdr(il, txq_id, index); if (ieee80211_is_data_qos(hdr->frame_control)) { qc = ieee80211_get_qos_ctl(hdr); tid = qc[0] & 0xf; } - sta_id = il4965_get_ra_sta_id(priv, hdr); + sta_id = il4965_get_ra_sta_id(il, hdr); if (txq->sched_retry && unlikely(sta_id == IL_INVALID_STATION)) { - IL_ERR(priv, "Station not known\n"); + IL_ERR(il, "Station not known\n"); return; } - spin_lock_irqsave(&priv->sta_lock, flags); + spin_lock_irqsave(&il->sta_lock, flags); if (txq->sched_retry) { const u32 scd_ssn = il4965_get_scd_ssn(tx_resp); struct il_ht_agg *agg = NULL; WARN_ON(!qc); - agg = &priv->stations[sta_id].tid[tid].agg; + agg = &il->stations[sta_id].tid[tid].agg; - il4965_tx_status_reply_tx(priv, agg, tx_resp, txq_id, index); + il4965_tx_status_reply_tx(il, agg, tx_resp, txq_id, index); /* check if BAR is needed */ if ((tx_resp->frame_count == 1) && !il4965_is_tx_success(status)) @@ -1830,51 +1830,51 @@ static void il4965_rx_reply_tx(struct il_priv *priv, if (txq->q.read_ptr != (scd_ssn & 0xff)) { index = il_queue_dec_wrap(scd_ssn & 0xff, txq->q.n_bd); - IL_DEBUG_TX_REPLY(priv, "Retry scheduler reclaim scd_ssn " + IL_DEBUG_TX_REPLY(il, "Retry scheduler reclaim scd_ssn " "%d index %d\n", scd_ssn , index); - freed = il4965_tx_queue_reclaim(priv, txq_id, index); + freed = il4965_tx_queue_reclaim(il, txq_id, index); if (qc) - il4965_free_tfds_in_queue(priv, sta_id, + il4965_free_tfds_in_queue(il, sta_id, tid, freed); - if (priv->mac80211_registered && + if (il->mac80211_registered && (il_queue_space(&txq->q) > txq->q.low_mark) && (agg->state != IL_EMPTYING_HW_QUEUE_DELBA)) - il_wake_queue(priv, txq); + il_wake_queue(il, txq); } } else { info->status.rates[0].count = tx_resp->failure_frame + 1; info->flags |= il4965_tx_status_to_mac80211(status); - il4965_hwrate_to_tx_control(priv, + il4965_hwrate_to_tx_control(il, le32_to_cpu(tx_resp->rate_n_flags), info); - IL_DEBUG_TX_REPLY(priv, "TXQ %d status %s (0x%08x) " + IL_DEBUG_TX_REPLY(il, "TXQ %d status %s (0x%08x) " "rate_n_flags 0x%x retries %d\n", txq_id, il4965_get_tx_fail_reason(status), status, le32_to_cpu(tx_resp->rate_n_flags), tx_resp->failure_frame); - freed = il4965_tx_queue_reclaim(priv, txq_id, index); + freed = il4965_tx_queue_reclaim(il, txq_id, index); if (qc && likely(sta_id != IL_INVALID_STATION)) - il4965_free_tfds_in_queue(priv, sta_id, tid, freed); + il4965_free_tfds_in_queue(il, sta_id, tid, freed); else if (sta_id == IL_INVALID_STATION) - IL_DEBUG_TX_REPLY(priv, "Station not known\n"); + IL_DEBUG_TX_REPLY(il, "Station not known\n"); - if (priv->mac80211_registered && + if (il->mac80211_registered && (il_queue_space(&txq->q) > txq->q.low_mark)) - il_wake_queue(priv, txq); + il_wake_queue(il, txq); } if (qc && likely(sta_id != IL_INVALID_STATION)) - il4965_txq_check_empty(priv, sta_id, tid, txq_id); + il4965_txq_check_empty(il, sta_id, tid, txq_id); - il4965_check_abort_status(priv, tx_resp->frame_count, status); + il4965_check_abort_status(il, tx_resp->frame_count, status); - spin_unlock_irqrestore(&priv->sta_lock, flags); + spin_unlock_irqrestore(&il->sta_lock, flags); } -static void il4965_rx_beacon_notif(struct il_priv *priv, +static void il4965_rx_beacon_notif(struct il_priv *il, struct il_rx_mem_buffer *rxb) { struct il_rx_packet *pkt = rxb_addr(rxb); @@ -1882,7 +1882,7 @@ static void il4965_rx_beacon_notif(struct il_priv *priv, u8 rate __maybe_unused = il4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); - IL_DEBUG_RX(priv, "beacon status %#x, retries:%d ibssmgr:%d " + IL_DEBUG_RX(il, "beacon status %#x, retries:%d ibssmgr:%d " "tsf:0x%.8x%.8x rate:%d\n", le32_to_cpu(beacon->beacon_notify_hdr.u.status) & TX_STATUS_MSK, beacon->beacon_notify_hdr.failure_frame, @@ -1890,17 +1890,17 @@ static void il4965_rx_beacon_notif(struct il_priv *priv, le32_to_cpu(beacon->high_tsf), le32_to_cpu(beacon->low_tsf), rate); - priv->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status); + il->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status); } /* Set up 4965-specific Rx frame reply handlers */ -static void il4965_rx_handler_setup(struct il_priv *priv) +static void il4965_rx_handler_setup(struct il_priv *il) { /* Legacy Rx frames */ - priv->rx_handlers[REPLY_RX] = il4965_rx_reply_rx; + il->rx_handlers[REPLY_RX] = il4965_rx_reply_rx; /* Tx response */ - priv->rx_handlers[REPLY_TX] = il4965_rx_reply_tx; - priv->rx_handlers[BEACON_NOTIFICATION] = il4965_rx_beacon_notif; + il->rx_handlers[REPLY_TX] = il4965_rx_reply_tx; + il->rx_handlers[BEACON_NOTIFICATION] = il4965_rx_beacon_notif; } static struct il_hcmd_ops il4965_hcmd = { @@ -1909,53 +1909,53 @@ static struct il_hcmd_ops il4965_hcmd = { .set_rxon_chain = il4965_set_rxon_chain, }; -static void il4965_post_scan(struct il_priv *priv) +static void il4965_post_scan(struct il_priv *il) { - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; /* * Since setting the RXON may have been deferred while * performing the scan, fire one off if needed */ if (memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging))) - il_commit_rxon(priv, ctx); + il_commit_rxon(il, ctx); } -static void il4965_post_associate(struct il_priv *priv) +static void il4965_post_associate(struct il_priv *il) { - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; struct ieee80211_vif *vif = ctx->vif; struct ieee80211_conf *conf = NULL; int ret = 0; - if (!vif || !priv->is_open) + if (!vif || !il->is_open) return; - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) + if (test_bit(STATUS_EXIT_PENDING, &il->status)) return; - il_scan_cancel_timeout(priv, 200); + il_scan_cancel_timeout(il, 200); - conf = il_ieee80211_get_hw_conf(priv->hw); + conf = il_ieee80211_get_hw_conf(il->hw); ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - il_commit_rxon(priv, ctx); + il_commit_rxon(il, ctx); - ret = il_send_rxon_timing(priv, ctx); + ret = il_send_rxon_timing(il, ctx); if (ret) - IL_WARN(priv, "RXON timing - " + IL_WARN(il, "RXON timing - " "Attempting to continue.\n"); ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; - il_set_rxon_ht(priv, &priv->current_ht_config); + il_set_rxon_ht(il, &il->current_ht_config); - if (priv->cfg->ops->hcmd->set_rxon_chain) - priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); + if (il->cfg->ops->hcmd->set_rxon_chain) + il->cfg->ops->hcmd->set_rxon_chain(il, ctx); ctx->staging.assoc_id = cpu_to_le16(vif->bss_conf.aid); - IL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", + IL_DEBUG_ASSOC(il, "assoc id %d beacon interval %d\n", vif->bss_conf.aid, vif->bss_conf.beacon_int); if (vif->bss_conf.use_short_preamble) @@ -1970,19 +1970,19 @@ static void il4965_post_associate(struct il_priv *priv) ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; } - il_commit_rxon(priv, ctx); + il_commit_rxon(il, ctx); - IL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", + IL_DEBUG_ASSOC(il, "Associated as %d to: %pM\n", vif->bss_conf.aid, ctx->active.bssid_addr); switch (vif->type) { case NL80211_IFTYPE_STATION: break; case NL80211_IFTYPE_ADHOC: - il4965_send_beacon_cmd(priv); + il4965_send_beacon_cmd(il); break; default: - IL_ERR(priv, "%s Should not be called in %d mode\n", + IL_ERR(il, "%s Should not be called in %d mode\n", __func__, vif->type); break; } @@ -1990,23 +1990,23 @@ static void il4965_post_associate(struct il_priv *priv) /* the chain noise calibration will enabled PM upon completion * If chain noise has already been run, then we need to enable * power management here */ - if (priv->chain_noise_data.state == IL_CHAIN_NOISE_DONE) - il_power_update_mode(priv, false); + if (il->chain_noise_data.state == IL_CHAIN_NOISE_DONE) + il_power_update_mode(il, false); /* Enable Rx differential gain and sensitivity calibrations */ - il4965_chain_noise_reset(priv); - priv->start_calib = 1; + il4965_chain_noise_reset(il); + il->start_calib = 1; } -static void il4965_config_ap(struct il_priv *priv) +static void il4965_config_ap(struct il_priv *il) { - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; struct ieee80211_vif *vif = ctx->vif; int ret = 0; - lockdep_assert_held(&priv->mutex); + lockdep_assert_held(&il->mutex); - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) + if (test_bit(STATUS_EXIT_PENDING, &il->status)) return; /* The following should be done only at AP bring up */ @@ -2014,20 +2014,20 @@ static void il4965_config_ap(struct il_priv *priv) /* RXON - unassoc (to set timing command) */ ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - il_commit_rxon(priv, ctx); + il_commit_rxon(il, ctx); /* RXON Timing */ - ret = il_send_rxon_timing(priv, ctx); + ret = il_send_rxon_timing(il, ctx); if (ret) - IL_WARN(priv, "RXON timing failed - " + IL_WARN(il, "RXON timing failed - " "Attempting to continue.\n"); /* AP has all antennas */ - priv->chain_noise_data.active_chains = - priv->hw_params.valid_rx_ant; - il_set_rxon_ht(priv, &priv->current_ht_config); - if (priv->cfg->ops->hcmd->set_rxon_chain) - priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); + il->chain_noise_data.active_chains = + il->hw_params.valid_rx_ant; + il_set_rxon_ht(il, &il->current_ht_config); + if (il->cfg->ops->hcmd->set_rxon_chain) + il->cfg->ops->hcmd->set_rxon_chain(il, ctx); ctx->staging.assoc_id = 0; @@ -2047,12 +2047,12 @@ static void il4965_config_ap(struct il_priv *priv) ~RXON_FLG_SHORT_SLOT_MSK; } /* need to send beacon cmd before committing assoc RXON! */ - il4965_send_beacon_cmd(priv); + il4965_send_beacon_cmd(il); /* restore RXON assoc */ ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; - il_commit_rxon(priv, ctx); + il_commit_rxon(il, ctx); } - il4965_send_beacon_cmd(priv); + il4965_send_beacon_cmd(il); } static struct il_hcmd_utils_ops il4965_hcmd_utils = { diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.h b/drivers/net/wireless/iwlegacy/iwl-4965.h index 7b322168bfc5..ea2a98e3a4a2 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965.h +++ b/drivers/net/wireless/iwlegacy/iwl-4965.h @@ -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); diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c index 7eae279e4c69..80ec543dd894 100644 --- a/drivers/net/wireless/iwlegacy/iwl-core.c +++ b/drivers/net/wireless/iwlegacy/iwl-core.c @@ -75,12 +75,12 @@ const u8 iwlegacy_bcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; EXPORT_SYMBOL(iwlegacy_bcast_addr); -/* This function both allocates and initializes hw and priv. */ +/* This function both allocates and initializes hw and il. */ struct ieee80211_hw *il_alloc_all(struct il_cfg *cfg) { - struct il_priv *priv; + struct il_priv *il; /* mac80211 allocates memory for this device instance, including - * space for this driver's private structure */ + * space for this driver's ilate structure */ struct ieee80211_hw *hw; hw = ieee80211_alloc_hw(sizeof(struct il_priv), @@ -91,8 +91,8 @@ struct ieee80211_hw *il_alloc_all(struct il_cfg *cfg) goto out; } - priv = hw->priv; - priv->hw = hw; + il = hw->priv; + il->hw = hw; out: return hw; @@ -101,13 +101,13 @@ EXPORT_SYMBOL(il_alloc_all); #define MAX_BIT_RATE_40_MHZ 150 /* Mbps */ #define MAX_BIT_RATE_20_MHZ 72 /* Mbps */ -static void il_init_ht_hw_capab(const struct il_priv *priv, +static void il_init_ht_hw_capab(const struct il_priv *il, struct ieee80211_sta_ht_cap *ht_info, enum ieee80211_band band) { u16 max_bit_rate = 0; - u8 rx_chains_num = priv->hw_params.rx_chains_num; - u8 tx_chains_num = priv->hw_params.tx_chains_num; + u8 rx_chains_num = il->hw_params.rx_chains_num; + u8 tx_chains_num = il->hw_params.tx_chains_num; ht_info->cap = 0; memset(&ht_info->mcs, 0, sizeof(ht_info->mcs)); @@ -116,14 +116,14 @@ static void il_init_ht_hw_capab(const struct il_priv *priv, ht_info->cap |= IEEE80211_HT_CAP_SGI_20; max_bit_rate = MAX_BIT_RATE_20_MHZ; - if (priv->hw_params.ht40_channel & BIT(band)) { + if (il->hw_params.ht40_channel & BIT(band)) { ht_info->cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; ht_info->cap |= IEEE80211_HT_CAP_SGI_40; ht_info->mcs.rx_mask[4] = 0x01; max_bit_rate = MAX_BIT_RATE_40_MHZ; } - if (priv->cfg->mod_params->amsdu_size_8K) + if (il->cfg->mod_params->amsdu_size_8K) ht_info->cap |= IEEE80211_HT_CAP_MAX_AMSDU; ht_info->ampdu_factor = CFG_HT_RX_AMPDU_FACTOR_DEF; @@ -152,7 +152,7 @@ static void il_init_ht_hw_capab(const struct il_priv *priv, /** * il_init_geos - Initialize mac80211's geo/channel info based from eeprom */ -int il_init_geos(struct il_priv *priv) +int il_init_geos(struct il_priv *il) { struct il_channel_info *ch; struct ieee80211_supported_band *sband; @@ -162,15 +162,15 @@ int il_init_geos(struct il_priv *priv) int i = 0; s8 max_tx_power = 0; - if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates || - priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) { - IL_DEBUG_INFO(priv, "Geography modes already initialized.\n"); - set_bit(STATUS_GEO_CONFIGURED, &priv->status); + if (il->bands[IEEE80211_BAND_2GHZ].n_bitrates || + il->bands[IEEE80211_BAND_5GHZ].n_bitrates) { + IL_DEBUG_INFO(il, "Geography modes already initialized.\n"); + set_bit(STATUS_GEO_CONFIGURED, &il->status); return 0; } channels = kzalloc(sizeof(struct ieee80211_channel) * - priv->channel_count, GFP_KERNEL); + il->channel_count, GFP_KERNEL); if (!channels) return -ENOMEM; @@ -182,36 +182,36 @@ int il_init_geos(struct il_priv *priv) } /* 5.2GHz channels start after the 2.4GHz channels */ - sband = &priv->bands[IEEE80211_BAND_5GHZ]; + sband = &il->bands[IEEE80211_BAND_5GHZ]; sband->channels = &channels[ARRAY_SIZE(iwlegacy_eeprom_band_1)]; /* just OFDM */ sband->bitrates = &rates[IL_FIRST_OFDM_RATE]; sband->n_bitrates = IL_RATE_COUNT_LEGACY - IL_FIRST_OFDM_RATE; - if (priv->cfg->sku & IL_SKU_N) - il_init_ht_hw_capab(priv, &sband->ht_cap, + if (il->cfg->sku & IL_SKU_N) + il_init_ht_hw_capab(il, &sband->ht_cap, IEEE80211_BAND_5GHZ); - sband = &priv->bands[IEEE80211_BAND_2GHZ]; + sband = &il->bands[IEEE80211_BAND_2GHZ]; sband->channels = channels; /* OFDM & CCK */ sband->bitrates = rates; sband->n_bitrates = IL_RATE_COUNT_LEGACY; - if (priv->cfg->sku & IL_SKU_N) - il_init_ht_hw_capab(priv, &sband->ht_cap, + if (il->cfg->sku & IL_SKU_N) + il_init_ht_hw_capab(il, &sband->ht_cap, IEEE80211_BAND_2GHZ); - priv->ieee_channels = channels; - priv->ieee_rates = rates; + il->ieee_channels = channels; + il->ieee_rates = rates; - for (i = 0; i < priv->channel_count; i++) { - ch = &priv->channel_info[i]; + for (i = 0; i < il->channel_count; i++) { + ch = &il->channel_info[i]; if (!il_is_channel_valid(ch)) continue; - sband = &priv->bands[ch->band]; + sband = &il->bands[ch->band]; geo_ch = &sband->channels[sband->n_channels++]; @@ -239,7 +239,7 @@ int il_init_geos(struct il_priv *priv) geo_ch->flags |= IEEE80211_CHAN_DISABLED; } - IL_DEBUG_INFO(priv, "Channel %d Freq=%d[%sGHz] %s flag=0x%X\n", + IL_DEBUG_INFO(il, "Channel %d Freq=%d[%sGHz] %s flag=0x%X\n", ch->channel, geo_ch->center_freq, il_is_channel_a_band(ch) ? "5.2" : "2.4", geo_ch->flags & IEEE80211_CHAN_DISABLED ? @@ -247,24 +247,24 @@ int il_init_geos(struct il_priv *priv) geo_ch->flags); } - priv->tx_power_device_lmt = max_tx_power; - priv->tx_power_user_lmt = max_tx_power; - priv->tx_power_next = max_tx_power; + il->tx_power_device_lmt = max_tx_power; + il->tx_power_user_lmt = max_tx_power; + il->tx_power_next = max_tx_power; - if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) && - priv->cfg->sku & IL_SKU_A) { - IL_INFO(priv, "Incorrectly detected BG card as ABG. " + if ((il->bands[IEEE80211_BAND_5GHZ].n_channels == 0) && + il->cfg->sku & IL_SKU_A) { + IL_INFO(il, "Incorrectly detected BG card as ABG. " "Please send your PCI ID 0x%04X:0x%04X to maintainer.\n", - priv->pci_dev->device, - priv->pci_dev->subsystem_device); - priv->cfg->sku &= ~IL_SKU_A; + il->pci_dev->device, + il->pci_dev->subsystem_device); + il->cfg->sku &= ~IL_SKU_A; } - IL_INFO(priv, "Tunable channels: %d 802.11bg, %d 802.11a channels\n", - priv->bands[IEEE80211_BAND_2GHZ].n_channels, - priv->bands[IEEE80211_BAND_5GHZ].n_channels); + IL_INFO(il, "Tunable channels: %d 802.11bg, %d 802.11a channels\n", + il->bands[IEEE80211_BAND_2GHZ].n_channels, + il->bands[IEEE80211_BAND_5GHZ].n_channels); - set_bit(STATUS_GEO_CONFIGURED, &priv->status); + set_bit(STATUS_GEO_CONFIGURED, &il->status); return 0; } @@ -273,21 +273,21 @@ EXPORT_SYMBOL(il_init_geos); /* * il_free_geos - undo allocations in il_init_geos */ -void il_free_geos(struct il_priv *priv) +void il_free_geos(struct il_priv *il) { - kfree(priv->ieee_channels); - kfree(priv->ieee_rates); - clear_bit(STATUS_GEO_CONFIGURED, &priv->status); + kfree(il->ieee_channels); + kfree(il->ieee_rates); + clear_bit(STATUS_GEO_CONFIGURED, &il->status); } EXPORT_SYMBOL(il_free_geos); -static bool il_is_channel_extension(struct il_priv *priv, +static bool il_is_channel_extension(struct il_priv *il, enum ieee80211_band band, u16 channel, u8 extension_chan_offset) { const struct il_channel_info *ch_info; - 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)) return false; @@ -301,7 +301,7 @@ static bool il_is_channel_extension(struct il_priv *priv, return false; } -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) { @@ -316,11 +316,11 @@ bool il_is_ht40_tx_allowed(struct il_priv *priv, return false; #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS - if (priv->disable_ht40) + if (il->disable_ht40) return false; #endif - return il_is_channel_extension(priv, priv->band, + return il_is_channel_extension(il, il->band, le16_to_cpu(ctx->staging.channel), ctx->ht.extension_chan_offset); } @@ -360,7 +360,7 @@ static u16 il_adjust_beacon_interval(u16 beacon_val, u16 max_beacon_val) } int -il_send_rxon_timing(struct il_priv *priv, struct il_rxon_context *ctx) +il_send_rxon_timing(struct il_priv *il, struct il_rxon_context *ctx) { u64 tsf; s32 interval_tm, rem; @@ -368,13 +368,13 @@ il_send_rxon_timing(struct il_priv *priv, struct il_rxon_context *ctx) u16 beacon_int; struct ieee80211_vif *vif = ctx->vif; - conf = il_ieee80211_get_hw_conf(priv->hw); + conf = il_ieee80211_get_hw_conf(il->hw); - lockdep_assert_held(&priv->mutex); + lockdep_assert_held(&il->mutex); memset(&ctx->timing, 0, sizeof(struct il_rxon_time_cmd)); - ctx->timing.timestamp = cpu_to_le64(priv->timestamp); + ctx->timing.timestamp = cpu_to_le64(il->timestamp); ctx->timing.listen_interval = cpu_to_le16(conf->listen_interval); beacon_int = vif ? vif->bss_conf.beacon_int : 0; @@ -386,29 +386,29 @@ il_send_rxon_timing(struct il_priv *priv, struct il_rxon_context *ctx) ctx->timing.atim_window = 0; beacon_int = il_adjust_beacon_interval(beacon_int, - priv->hw_params.max_beacon_itrvl * TIME_UNIT); + il->hw_params.max_beacon_itrvl * TIME_UNIT); ctx->timing.beacon_interval = cpu_to_le16(beacon_int); - tsf = priv->timestamp; /* tsf is modifed by do_div: copy it */ + tsf = il->timestamp; /* tsf is modifed by do_div: copy it */ interval_tm = beacon_int * TIME_UNIT; rem = do_div(tsf, interval_tm); ctx->timing.beacon_init_val = cpu_to_le32(interval_tm - rem); ctx->timing.dtim_period = vif ? (vif->bss_conf.dtim_period ?: 1) : 1; - IL_DEBUG_ASSOC(priv, + IL_DEBUG_ASSOC(il, "beacon interval %d beacon timer %d beacon tim %d\n", le16_to_cpu(ctx->timing.beacon_interval), le32_to_cpu(ctx->timing.beacon_init_val), le16_to_cpu(ctx->timing.atim_window)); - return il_send_cmd_pdu(priv, ctx->rxon_timing_cmd, + return il_send_cmd_pdu(il, ctx->rxon_timing_cmd, sizeof(ctx->timing), &ctx->timing); } EXPORT_SYMBOL(il_send_rxon_timing); void -il_set_rxon_hwcrypto(struct il_priv *priv, +il_set_rxon_hwcrypto(struct il_priv *il, struct il_rxon_context *ctx, int hw_decrypt) { @@ -424,72 +424,72 @@ EXPORT_SYMBOL(il_set_rxon_hwcrypto); /* validate RXON structure is valid */ int -il_check_rxon_cmd(struct il_priv *priv, struct il_rxon_context *ctx) +il_check_rxon_cmd(struct il_priv *il, struct il_rxon_context *ctx) { struct il_rxon_cmd *rxon = &ctx->staging; bool error = false; if (rxon->flags & RXON_FLG_BAND_24G_MSK) { if (rxon->flags & RXON_FLG_TGJ_NARROW_BAND_MSK) { - IL_WARN(priv, "check 2.4G: wrong narrow\n"); + IL_WARN(il, "check 2.4G: wrong narrow\n"); error = true; } if (rxon->flags & RXON_FLG_RADAR_DETECT_MSK) { - IL_WARN(priv, "check 2.4G: wrong radar\n"); + IL_WARN(il, "check 2.4G: wrong radar\n"); error = true; } } else { if (!(rxon->flags & RXON_FLG_SHORT_SLOT_MSK)) { - IL_WARN(priv, "check 5.2G: not short slot!\n"); + IL_WARN(il, "check 5.2G: not short slot!\n"); error = true; } if (rxon->flags & RXON_FLG_CCK_MSK) { - IL_WARN(priv, "check 5.2G: CCK!\n"); + IL_WARN(il, "check 5.2G: CCK!\n"); error = true; } } if ((rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1) { - IL_WARN(priv, "mac/bssid mcast!\n"); + IL_WARN(il, "mac/bssid mcast!\n"); error = true; } /* make sure basic rates 6Mbps and 1Mbps are supported */ if ((rxon->ofdm_basic_rates & IL_RATE_6M_MASK) == 0 && (rxon->cck_basic_rates & IL_RATE_1M_MASK) == 0) { - IL_WARN(priv, "neither 1 nor 6 are basic\n"); + IL_WARN(il, "neither 1 nor 6 are basic\n"); error = true; } if (le16_to_cpu(rxon->assoc_id) > 2007) { - IL_WARN(priv, "aid > 2007\n"); + IL_WARN(il, "aid > 2007\n"); error = true; } if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)) == (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)) { - IL_WARN(priv, "CCK and short slot\n"); + IL_WARN(il, "CCK and short slot\n"); error = true; } if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) { - IL_WARN(priv, "CCK and auto detect"); + IL_WARN(il, "CCK and auto detect"); error = true; } if ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK)) == RXON_FLG_TGG_PROTECT_MSK) { - IL_WARN(priv, "TGg but no auto-detect\n"); + IL_WARN(il, "TGg but no auto-detect\n"); error = true; } if (error) - IL_WARN(priv, "Tuning to channel %d\n", + IL_WARN(il, "Tuning to channel %d\n", le16_to_cpu(rxon->channel)); if (error) { - IL_ERR(priv, "Invalid RXON\n"); + IL_ERR(il, "Invalid RXON\n"); return -EINVAL; } return 0; @@ -498,13 +498,13 @@ EXPORT_SYMBOL(il_check_rxon_cmd); /** * il_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed - * @priv: staging_rxon is compared to active_rxon + * @il: staging_rxon is compared to active_rxon * * If the RXON structure is changing enough to require a new tune, * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required. */ -int il_full_rxon_required(struct il_priv *priv, +int il_full_rxon_required(struct il_priv *il, struct il_rxon_context *ctx) { const struct il_rxon_cmd *staging = &ctx->staging; @@ -512,13 +512,13 @@ int il_full_rxon_required(struct il_priv *priv, #define CHK(cond) \ if ((cond)) { \ - IL_DEBUG_INFO(priv, "need full RXON - " #cond "\n"); \ + IL_DEBUG_INFO(il, "need full RXON - " #cond "\n"); \ return 1; \ } #define CHK_NEQ(c1, c2) \ if ((c1) != (c2)) { \ - IL_DEBUG_INFO(priv, "need full RXON - " \ + IL_DEBUG_INFO(il, "need full RXON - " \ #c1 " != " #c2 " - %d != %d\n", \ (c1), (c2)); \ return 1; \ @@ -558,7 +558,7 @@ int il_full_rxon_required(struct il_priv *priv, } EXPORT_SYMBOL(il_full_rxon_required); -u8 il_get_lowest_plcp(struct il_priv *priv, +u8 il_get_lowest_plcp(struct il_priv *il, struct il_rxon_context *ctx) { /* @@ -572,7 +572,7 @@ u8 il_get_lowest_plcp(struct il_priv *priv, } EXPORT_SYMBOL(il_get_lowest_plcp); -static void _il_set_rxon_ht(struct il_priv *priv, +static void _il_set_rxon_ht(struct il_priv *il, struct il_ht_config *ht_conf, struct il_rxon_context *ctx) { @@ -594,7 +594,7 @@ static void _il_set_rxon_ht(struct il_priv *priv, /* clear the HT channel mode before set the mode */ rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MSK | RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); - if (il_is_ht40_tx_allowed(priv, ctx, NULL)) { + if (il_is_ht40_tx_allowed(il, ctx, NULL)) { /* pure ht40 */ if (ctx->ht.protection == IEEE80211_HT_OP_MODE_PROTECTION_20MHZ) { @@ -626,7 +626,7 @@ static void _il_set_rxon_ht(struct il_priv *priv, case IEEE80211_HT_PARAM_CHA_SEC_NONE: default: /* channel location only valid if in Mixed mode */ - IL_ERR(priv, + IL_ERR(il, "invalid extension channel offset\n"); break; } @@ -635,26 +635,26 @@ static void _il_set_rxon_ht(struct il_priv *priv, rxon->flags |= RXON_FLG_CHANNEL_MODE_LEGACY; } - if (priv->cfg->ops->hcmd->set_rxon_chain) - priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); + if (il->cfg->ops->hcmd->set_rxon_chain) + il->cfg->ops->hcmd->set_rxon_chain(il, ctx); - IL_DEBUG_ASSOC(priv, "rxon flags 0x%X operation mode :0x%X " + IL_DEBUG_ASSOC(il, "rxon flags 0x%X operation mode :0x%X " "extension channel offset 0x%x\n", le32_to_cpu(rxon->flags), ctx->ht.protection, ctx->ht.extension_chan_offset); } -void il_set_rxon_ht(struct il_priv *priv, struct il_ht_config *ht_conf) +void il_set_rxon_ht(struct il_priv *il, struct il_ht_config *ht_conf) { struct il_rxon_context *ctx; - for_each_context(priv, ctx) - _il_set_rxon_ht(priv, ht_conf, ctx); + for_each_context(il, ctx) + _il_set_rxon_ht(il, ht_conf, ctx); } EXPORT_SYMBOL(il_set_rxon_ht); /* Return valid, unused, channel for a passive scan to reset the RF */ -u8 il_get_single_channel_number(struct il_priv *priv, +u8 il_get_single_channel_number(struct il_priv *il, enum ieee80211_band band) { const struct il_channel_info *ch_info; @@ -665,7 +665,7 @@ u8 il_get_single_channel_number(struct il_priv *priv, if (band == IEEE80211_BAND_5GHZ) { min = 14; - max = priv->channel_count; + max = il->channel_count; } else { min = 0; max = 14; @@ -674,8 +674,8 @@ u8 il_get_single_channel_number(struct il_priv *priv, for (i = min; i < max; i++) { bool busy = false; - for_each_context(priv, ctx) { - busy = priv->channel_info[i].channel == + for_each_context(il, ctx) { + busy = il->channel_info[i].channel == le16_to_cpu(ctx->staging.channel); if (busy) break; @@ -684,8 +684,8 @@ u8 il_get_single_channel_number(struct il_priv *priv, if (busy) continue; - channel = priv->channel_info[i].channel; - ch_info = il_get_channel_info(priv, band, channel); + channel = il->channel_info[i].channel; + ch_info = il_get_channel_info(il, band, channel); if (il_is_channel_valid(ch_info)) break; } @@ -702,14 +702,14 @@ EXPORT_SYMBOL(il_get_single_channel_number); * in the staging RXON flag structure based on the ch->band */ int -il_set_rxon_channel(struct il_priv *priv, struct ieee80211_channel *ch, +il_set_rxon_channel(struct il_priv *il, struct ieee80211_channel *ch, struct il_rxon_context *ctx) { enum ieee80211_band band = ch->band; u16 channel = ch->hw_value; if ((le16_to_cpu(ctx->staging.channel) == channel) && - (priv->band == band)) + (il->band == band)) return 0; ctx->staging.channel = cpu_to_le16(channel); @@ -718,15 +718,15 @@ il_set_rxon_channel(struct il_priv *priv, struct ieee80211_channel *ch, else ctx->staging.flags |= RXON_FLG_BAND_24G_MSK; - priv->band = band; + il->band = band; - IL_DEBUG_INFO(priv, "Staging channel set to %d [%d]\n", channel, band); + IL_DEBUG_INFO(il, "Staging channel set to %d [%d]\n", channel, band); return 0; } EXPORT_SYMBOL(il_set_rxon_channel); -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) @@ -753,7 +753,7 @@ EXPORT_SYMBOL(il_set_flags_for_band); /* * initialize rxon structure with default values from eeprom */ -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) { const struct il_channel_info *ch_info; @@ -778,7 +778,7 @@ void il_connection_init_rx_config(struct il_priv *priv, break; default: - IL_ERR(priv, "Unsupported interface type %d\n", + IL_ERR(il, "Unsupported interface type %d\n", ctx->vif->type); break; } @@ -786,22 +786,22 @@ void il_connection_init_rx_config(struct il_priv *priv, #if 0 /* TODO: Figure out when short_preamble would be set and cache from * that */ - if (!hw_to_local(priv->hw)->short_preamble) + if (!hw_to_local(il->hw)->short_preamble) ctx->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; else ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; #endif - ch_info = il_get_channel_info(priv, priv->band, + ch_info = il_get_channel_info(il, il->band, le16_to_cpu(ctx->active.channel)); if (!ch_info) - ch_info = &priv->channel_info[0]; + ch_info = &il->channel_info[0]; ctx->staging.channel = cpu_to_le16(ch_info->channel); - priv->band = ch_info->band; + il->band = ch_info->band; - il_set_flags_for_band(priv, ctx, priv->band, ctx->vif); + il_set_flags_for_band(il, ctx, il->band, ctx->vif); ctx->staging.ofdm_basic_rates = (IL_OFDM_RATES_MASK >> IL_FIRST_OFDM_RATE) & 0xFF; @@ -819,30 +819,30 @@ void il_connection_init_rx_config(struct il_priv *priv, } EXPORT_SYMBOL(il_connection_init_rx_config); -void il_set_rate(struct il_priv *priv) +void il_set_rate(struct il_priv *il) { const struct ieee80211_supported_band *hw = NULL; struct ieee80211_rate *rate; struct il_rxon_context *ctx; int i; - hw = il_get_hw_mode(priv, priv->band); + hw = il_get_hw_mode(il, il->band); if (!hw) { - IL_ERR(priv, "Failed to set rate: unable to get hw mode\n"); + IL_ERR(il, "Failed to set rate: unable to get hw mode\n"); return; } - priv->active_rate = 0; + il->active_rate = 0; for (i = 0; i < hw->n_bitrates; i++) { rate = &(hw->bitrates[i]); if (rate->hw_value < IL_RATE_COUNT_LEGACY) - priv->active_rate |= (1 << rate->hw_value); + il->active_rate |= (1 << rate->hw_value); } - IL_DEBUG_RATE(priv, "Set active_rate = %0x\n", priv->active_rate); + IL_DEBUG_RATE(il, "Set active_rate = %0x\n", il->active_rate); - for_each_context(priv, ctx) { + for_each_context(il, ctx) { ctx->staging.cck_basic_rates = (IL_CCK_BASIC_RATES_MASK >> IL_FIRST_CCK_RATE) & 0xF; @@ -852,64 +852,64 @@ void il_set_rate(struct il_priv *priv) } EXPORT_SYMBOL(il_set_rate); -void il_chswitch_done(struct il_priv *priv, bool is_success) +void il_chswitch_done(struct il_priv *il, bool is_success) { - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) + if (test_bit(STATUS_EXIT_PENDING, &il->status)) return; - if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) + if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &il->status)) ieee80211_chswitch_done(ctx->vif, is_success); } EXPORT_SYMBOL(il_chswitch_done); -void il_rx_csa(struct il_priv *priv, struct il_rx_mem_buffer *rxb) +void il_rx_csa(struct il_priv *il, struct il_rx_mem_buffer *rxb) { struct il_rx_packet *pkt = rxb_addr(rxb); struct il_csa_notification *csa = &(pkt->u.csa_notif); - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; struct il_rxon_cmd *rxon = (void *)&ctx->active; - if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) + if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &il->status)) return; - if (!le32_to_cpu(csa->status) && csa->channel == priv->switch_channel) { + if (!le32_to_cpu(csa->status) && csa->channel == il->switch_channel) { rxon->channel = csa->channel; ctx->staging.channel = csa->channel; - IL_DEBUG_11H(priv, "CSA notif: channel %d\n", + IL_DEBUG_11H(il, "CSA notif: channel %d\n", le16_to_cpu(csa->channel)); - il_chswitch_done(priv, true); + il_chswitch_done(il, true); } else { - IL_ERR(priv, "CSA notif (fail) : channel %d\n", + IL_ERR(il, "CSA notif (fail) : channel %d\n", le16_to_cpu(csa->channel)); - il_chswitch_done(priv, false); + il_chswitch_done(il, false); } } EXPORT_SYMBOL(il_rx_csa); #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) { struct il_rxon_cmd *rxon = &ctx->staging; - IL_DEBUG_RADIO(priv, "RX CONFIG:\n"); - il_print_hex_dump(priv, IL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); - IL_DEBUG_RADIO(priv, "u16 channel: 0x%x\n", + IL_DEBUG_RADIO(il, "RX CONFIG:\n"); + il_print_hex_dump(il, IL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); + IL_DEBUG_RADIO(il, "u16 channel: 0x%x\n", le16_to_cpu(rxon->channel)); - IL_DEBUG_RADIO(priv, "u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags)); - IL_DEBUG_RADIO(priv, "u32 filter_flags: 0x%08x\n", + IL_DEBUG_RADIO(il, "u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags)); + IL_DEBUG_RADIO(il, "u32 filter_flags: 0x%08x\n", le32_to_cpu(rxon->filter_flags)); - IL_DEBUG_RADIO(priv, "u8 dev_type: 0x%x\n", rxon->dev_type); - IL_DEBUG_RADIO(priv, "u8 ofdm_basic_rates: 0x%02x\n", + IL_DEBUG_RADIO(il, "u8 dev_type: 0x%x\n", rxon->dev_type); + IL_DEBUG_RADIO(il, "u8 ofdm_basic_rates: 0x%02x\n", rxon->ofdm_basic_rates); - IL_DEBUG_RADIO(priv, "u8 cck_basic_rates: 0x%02x\n", + IL_DEBUG_RADIO(il, "u8 cck_basic_rates: 0x%02x\n", rxon->cck_basic_rates); - IL_DEBUG_RADIO(priv, "u8[6] node_addr: %pM\n", rxon->node_addr); - IL_DEBUG_RADIO(priv, "u8[6] bssid_addr: %pM\n", rxon->bssid_addr); - IL_DEBUG_RADIO(priv, "u16 assoc_id: 0x%x\n", + IL_DEBUG_RADIO(il, "u8[6] node_addr: %pM\n", rxon->node_addr); + IL_DEBUG_RADIO(il, "u8[6] bssid_addr: %pM\n", rxon->bssid_addr); + IL_DEBUG_RADIO(il, "u16 assoc_id: 0x%x\n", le16_to_cpu(rxon->assoc_id)); } EXPORT_SYMBOL(il_print_rx_config_cmd); @@ -917,68 +917,68 @@ EXPORT_SYMBOL(il_print_rx_config_cmd); /** * il_irq_handle_error - called for HW or SW error interrupt from card */ -void il_irq_handle_error(struct il_priv *priv) +void il_irq_handle_error(struct il_priv *il) { /* Set the FW error flag -- cleared on il_down */ - set_bit(STATUS_FW_ERROR, &priv->status); + set_bit(STATUS_FW_ERROR, &il->status); /* Cancel currently queued command. */ - clear_bit(STATUS_HCMD_ACTIVE, &priv->status); + clear_bit(STATUS_HCMD_ACTIVE, &il->status); - IL_ERR(priv, "Loaded firmware version: %s\n", - priv->hw->wiphy->fw_version); + IL_ERR(il, "Loaded firmware version: %s\n", + il->hw->wiphy->fw_version); - priv->cfg->ops->lib->dump_nic_error_log(priv); - if (priv->cfg->ops->lib->dump_fh) - priv->cfg->ops->lib->dump_fh(priv, NULL, false); + il->cfg->ops->lib->dump_nic_error_log(il); + if (il->cfg->ops->lib->dump_fh) + il->cfg->ops->lib->dump_fh(il, NULL, false); #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG - if (il_get_debug_level(priv) & IL_DL_FW_ERRORS) - il_print_rx_config_cmd(priv, - &priv->contexts[IL_RXON_CTX_BSS]); + if (il_get_debug_level(il) & IL_DL_FW_ERRORS) + il_print_rx_config_cmd(il, + &il->contexts[IL_RXON_CTX_BSS]); #endif - wake_up(&priv->wait_command_queue); + wake_up(&il->wait_command_queue); /* Keep the restart process from trying to send host * commands by clearing the INIT status bit */ - clear_bit(STATUS_READY, &priv->status); + clear_bit(STATUS_READY, &il->status); - if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) { - IL_DEBUG(priv, IL_DL_FW_ERRORS, + if (!test_bit(STATUS_EXIT_PENDING, &il->status)) { + IL_DEBUG(il, IL_DL_FW_ERRORS, "Restarting adapter due to uCode error.\n"); - if (priv->cfg->mod_params->restart_fw) - queue_work(priv->workqueue, &priv->restart); + if (il->cfg->mod_params->restart_fw) + queue_work(il->workqueue, &il->restart); } } EXPORT_SYMBOL(il_irq_handle_error); -static int il_apm_stop_master(struct il_priv *priv) +static int il_apm_stop_master(struct il_priv *il) { int ret = 0; /* stop device's busmaster DMA activity */ - il_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER); + il_set_bit(il, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER); - ret = il_poll_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_MASTER_DISABLED, + ret = il_poll_bit(il, CSR_RESET, CSR_RESET_REG_FLAG_MASTER_DISABLED, CSR_RESET_REG_FLAG_MASTER_DISABLED, 100); if (ret) - IL_WARN(priv, "Master Disable Timed Out, 100 usec\n"); + IL_WARN(il, "Master Disable Timed Out, 100 usec\n"); - IL_DEBUG_INFO(priv, "stop master\n"); + IL_DEBUG_INFO(il, "stop master\n"); return ret; } -void il_apm_stop(struct il_priv *priv) +void il_apm_stop(struct il_priv *il) { - IL_DEBUG_INFO(priv, "Stop card, put in low power state\n"); + IL_DEBUG_INFO(il, "Stop card, put in low power state\n"); /* Stop device's DMA activity */ - il_apm_stop_master(priv); + il_apm_stop_master(il); /* Reset the entire device */ - il_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); + il_set_bit(il, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); udelay(10); @@ -986,7 +986,7 @@ void il_apm_stop(struct il_priv *priv) * Clear "initialization complete" bit to move adapter from * D0A* (powered-up Active) --> D0U* (Uninitialized) state. */ - il_clear_bit(priv, CSR_GP_CNTRL, + il_clear_bit(il, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); } EXPORT_SYMBOL(il_apm_stop); @@ -997,12 +997,12 @@ EXPORT_SYMBOL(il_apm_stop); * (e.g. after platform boot, or shutdown via il_apm_stop()) * NOTE: This does not load uCode nor start the embedded processor */ -int il_apm_init(struct il_priv *priv) +int il_apm_init(struct il_priv *il) { int ret = 0; u16 lctl; - IL_DEBUG_INFO(priv, "Init card's basic functions\n"); + IL_DEBUG_INFO(il, "Init card's basic functions\n"); /* * Use "set_bit" below rather than "write", to preserve any hardware @@ -1010,18 +1010,18 @@ int il_apm_init(struct il_priv *priv) */ /* Disable L0S exit timer (platform NMI Work/Around) */ - il_set_bit(priv, CSR_GIO_CHICKEN_BITS, + il_set_bit(il, CSR_GIO_CHICKEN_BITS, CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER); /* * Disable L0s without affecting L1; * don't wait for ICH L0s (ICH bug W/A) */ - il_set_bit(priv, CSR_GIO_CHICKEN_BITS, + il_set_bit(il, CSR_GIO_CHICKEN_BITS, CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX); /* Set FH wait threshold to maximum (HW error during stress W/A) */ - il_set_bit(priv, CSR_DBG_HPET_MEM_REG, + il_set_bit(il, CSR_DBG_HPET_MEM_REG, CSR_DBG_HPET_MEM_REG_VAL); /* @@ -1029,7 +1029,7 @@ int il_apm_init(struct il_priv *priv) * wake device's PCI Express link L1a -> L0s * NOTE: This is no-op for 3945 (non-existent bit) */ - il_set_bit(priv, CSR_HW_IF_CONFIG_REG, + il_set_bit(il, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A); /* @@ -1040,43 +1040,43 @@ int il_apm_init(struct il_priv *priv) * If not (unlikely), enable L0S, so there is at least some * power savings, even without L1. */ - if (priv->cfg->base_params->set_l0s) { - lctl = il_pcie_link_ctl(priv); + if (il->cfg->base_params->set_l0s) { + lctl = il_pcie_link_ctl(il); if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) == PCI_CFG_LINK_CTRL_VAL_L1_EN) { /* L1-ASPM enabled; disable(!) L0S */ - il_set_bit(priv, CSR_GIO_REG, + il_set_bit(il, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); - IL_DEBUG_POWER(priv, "L1 Enabled; Disabling L0S\n"); + IL_DEBUG_POWER(il, "L1 Enabled; Disabling L0S\n"); } else { /* L1-ASPM disabled; enable(!) L0S */ - il_clear_bit(priv, CSR_GIO_REG, + il_clear_bit(il, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); - IL_DEBUG_POWER(priv, "L1 Disabled; Enabling L0S\n"); + IL_DEBUG_POWER(il, "L1 Disabled; Enabling L0S\n"); } } /* Configure analog phase-lock-loop before activating to D0A */ - if (priv->cfg->base_params->pll_cfg_val) - il_set_bit(priv, CSR_ANA_PLL_CFG, - priv->cfg->base_params->pll_cfg_val); + if (il->cfg->base_params->pll_cfg_val) + il_set_bit(il, CSR_ANA_PLL_CFG, + il->cfg->base_params->pll_cfg_val); /* * Set "initialization complete" bit to move adapter from * D0U* --> D0A* (powered-up active) state. */ - il_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); + il_set_bit(il, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); /* * Wait for clock stabilization; once stabilized, access to * device-internal resources is supported, e.g. il_write_prph() * and accesses to uCode SRAM. */ - ret = il_poll_bit(priv, CSR_GP_CNTRL, + ret = il_poll_bit(il, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); if (ret < 0) { - IL_DEBUG_INFO(priv, "Failed to init the card\n"); + IL_DEBUG_INFO(il, "Failed to init the card\n"); goto out; } @@ -1088,16 +1088,16 @@ int il_apm_init(struct il_priv *priv) * do not disable clocks. This preserves any hardware bits already * set by default in "CLK_CTRL_REG" after reset. */ - if (priv->cfg->base_params->use_bsm) - il_write_prph(priv, APMG_CLK_EN_REG, + if (il->cfg->base_params->use_bsm) + il_write_prph(il, APMG_CLK_EN_REG, APMG_CLK_VAL_DMA_CLK_RQT | APMG_CLK_VAL_BSM_CLK_RQT); else - il_write_prph(priv, APMG_CLK_EN_REG, + il_write_prph(il, APMG_CLK_EN_REG, APMG_CLK_VAL_DMA_CLK_RQT); udelay(20); /* Disable L1-Active */ - il_set_bits_prph(priv, APMG_PCIDEV_STT_REG, + il_set_bits_prph(il, APMG_PCIDEV_STT_REG, APMG_PCIDEV_STT_VAL_L1_ACT_DIS); out: @@ -1106,66 +1106,66 @@ out: EXPORT_SYMBOL(il_apm_init); -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) { int ret; s8 prev_tx_power; bool defer; - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; - lockdep_assert_held(&priv->mutex); + lockdep_assert_held(&il->mutex); - if (priv->tx_power_user_lmt == tx_power && !force) + if (il->tx_power_user_lmt == tx_power && !force) return 0; - if (!priv->cfg->ops->lib->send_tx_power) + if (!il->cfg->ops->lib->send_tx_power) return -EOPNOTSUPP; /* 0 dBm mean 1 milliwatt */ if (tx_power < 0) { - IL_WARN(priv, + IL_WARN(il, "Requested user TXPOWER %d below 1 mW.\n", tx_power); return -EINVAL; } - if (tx_power > priv->tx_power_device_lmt) { - IL_WARN(priv, + if (tx_power > il->tx_power_device_lmt) { + IL_WARN(il, "Requested user TXPOWER %d above upper limit %d.\n", - tx_power, priv->tx_power_device_lmt); + tx_power, il->tx_power_device_lmt); return -EINVAL; } - if (!il_is_ready_rf(priv)) + if (!il_is_ready_rf(il)) return -EIO; /* scan complete and commit_rxon use tx_power_next value, * it always need to be updated for newest request */ - priv->tx_power_next = tx_power; + il->tx_power_next = tx_power; /* do not set tx power when scanning or channel changing */ - defer = test_bit(STATUS_SCANNING, &priv->status) || + defer = test_bit(STATUS_SCANNING, &il->status) || memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging)); if (defer && !force) { - IL_DEBUG_INFO(priv, "Deferring tx power set\n"); + IL_DEBUG_INFO(il, "Deferring tx power set\n"); return 0; } - prev_tx_power = priv->tx_power_user_lmt; - priv->tx_power_user_lmt = tx_power; + prev_tx_power = il->tx_power_user_lmt; + il->tx_power_user_lmt = tx_power; - ret = priv->cfg->ops->lib->send_tx_power(priv); + ret = il->cfg->ops->lib->send_tx_power(il); /* if fail to set tx_power, restore the orig. tx power */ if (ret) { - priv->tx_power_user_lmt = prev_tx_power; - priv->tx_power_next = prev_tx_power; + il->tx_power_user_lmt = prev_tx_power; + il->tx_power_next = prev_tx_power; } return ret; } EXPORT_SYMBOL(il_set_tx_power); -void il_send_bt_config(struct il_priv *priv) +void il_send_bt_config(struct il_priv *il) { struct il_bt_cmd bt_cmd = { .lead_time = BT_LEAD_TIME_DEF, @@ -1179,16 +1179,16 @@ void il_send_bt_config(struct il_priv *priv) else bt_cmd.flags = BT_COEX_ENABLE; - IL_DEBUG_INFO(priv, "BT coex %s\n", + IL_DEBUG_INFO(il, "BT coex %s\n", (bt_cmd.flags == BT_COEX_DISABLE) ? "disable" : "active"); - if (il_send_cmd_pdu(priv, REPLY_BT_CONFIG, + if (il_send_cmd_pdu(il, REPLY_BT_CONFIG, sizeof(struct il_bt_cmd), &bt_cmd)) - IL_ERR(priv, "failed to send BT Coex Config\n"); + IL_ERR(il, "failed to send BT Coex Config\n"); } EXPORT_SYMBOL(il_send_bt_config); -int il_send_statistics_request(struct il_priv *priv, u8 flags, bool clear) +int il_send_statistics_request(struct il_priv *il, u8 flags, bool clear) { struct il_statistics_cmd statistics_cmd = { .configuration_flags = @@ -1196,46 +1196,46 @@ int il_send_statistics_request(struct il_priv *priv, u8 flags, bool clear) }; if (flags & CMD_ASYNC) - return il_send_cmd_pdu_async(priv, REPLY_STATISTICS_CMD, + return il_send_cmd_pdu_async(il, REPLY_STATISTICS_CMD, sizeof(struct il_statistics_cmd), &statistics_cmd, NULL); else - return il_send_cmd_pdu(priv, REPLY_STATISTICS_CMD, + return il_send_cmd_pdu(il, REPLY_STATISTICS_CMD, sizeof(struct il_statistics_cmd), &statistics_cmd); } EXPORT_SYMBOL(il_send_statistics_request); -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) { #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG struct il_rx_packet *pkt = rxb_addr(rxb); struct il_sleep_notification *sleep = &(pkt->u.sleep_notif); - IL_DEBUG_RX(priv, "sleep mode: %d, src: %d\n", + IL_DEBUG_RX(il, "sleep mode: %d, src: %d\n", sleep->pm_sleep_mode, sleep->pm_wakeup_src); #endif } EXPORT_SYMBOL(il_rx_pm_sleep_notif); -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) { struct il_rx_packet *pkt = rxb_addr(rxb); u32 len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; - IL_DEBUG_RADIO(priv, "Dumping %d bytes of unhandled " + IL_DEBUG_RADIO(il, "Dumping %d bytes of unhandled " "notification for %s:\n", len, il_get_cmd_string(pkt->hdr.cmd)); - il_print_hex_dump(priv, IL_DL_RADIO, pkt->u.raw, len); + il_print_hex_dump(il, IL_DL_RADIO, pkt->u.raw, len); } EXPORT_SYMBOL(il_rx_pm_debug_statistics_notif); -void il_rx_reply_error(struct il_priv *priv, +void il_rx_reply_error(struct il_priv *il, struct il_rx_mem_buffer *rxb) { struct il_rx_packet *pkt = rxb_addr(rxb); - IL_ERR(priv, "Error Reply type 0x%08X cmd %s (0x%02X) " + IL_ERR(il, "Error Reply type 0x%08X cmd %s (0x%02X) " "seq 0x%04X ser 0x%08X\n", le32_to_cpu(pkt->u.err_resp.error_type), il_get_cmd_string(pkt->u.err_resp.cmd_id), @@ -1245,37 +1245,37 @@ void il_rx_reply_error(struct il_priv *priv, } EXPORT_SYMBOL(il_rx_reply_error); -void il_clear_isr_stats(struct il_priv *priv) +void il_clear_isr_stats(struct il_priv *il) { - memset(&priv->isr_stats, 0, sizeof(priv->isr_stats)); + memset(&il->isr_stats, 0, sizeof(il->isr_stats)); } int il_mac_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue, const struct ieee80211_tx_queue_params *params) { - struct il_priv *priv = hw->priv; + struct il_priv *il = hw->priv; struct il_rxon_context *ctx; unsigned long flags; int q; - IL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(il, "enter\n"); - if (!il_is_ready_rf(priv)) { - IL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); + if (!il_is_ready_rf(il)) { + IL_DEBUG_MAC80211(il, "leave - RF not ready\n"); return -EIO; } if (queue >= AC_NUM) { - IL_DEBUG_MAC80211(priv, "leave - queue >= AC_NUM %d\n", queue); + IL_DEBUG_MAC80211(il, "leave - queue >= AC_NUM %d\n", queue); return 0; } q = AC_NUM - 1 - queue; - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); - for_each_context(priv, ctx) { + for_each_context(il, ctx) { ctx->qos_data.def_qos_parm.ac[q].cw_min = cpu_to_le16(params->cw_min); ctx->qos_data.def_qos_parm.ac[q].cw_max = @@ -1287,50 +1287,50 @@ int il_mac_conf_tx(struct ieee80211_hw *hw, ctx->qos_data.def_qos_parm.ac[q].reserved1 = 0; } - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&il->lock, flags); - IL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(il, "leave\n"); return 0; } EXPORT_SYMBOL(il_mac_conf_tx); int il_mac_tx_last_beacon(struct ieee80211_hw *hw) { - struct il_priv *priv = hw->priv; + struct il_priv *il = hw->priv; - return priv->ibss_manager == IL_IBSS_MANAGER; + return il->ibss_manager == IL_IBSS_MANAGER; } EXPORT_SYMBOL_GPL(il_mac_tx_last_beacon); static int -il_set_mode(struct il_priv *priv, struct il_rxon_context *ctx) +il_set_mode(struct il_priv *il, struct il_rxon_context *ctx) { - il_connection_init_rx_config(priv, ctx); + il_connection_init_rx_config(il, ctx); - if (priv->cfg->ops->hcmd->set_rxon_chain) - priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); + if (il->cfg->ops->hcmd->set_rxon_chain) + il->cfg->ops->hcmd->set_rxon_chain(il, ctx); - return il_commit_rxon(priv, ctx); + return il_commit_rxon(il, ctx); } -static int il_setup_interface(struct il_priv *priv, +static int il_setup_interface(struct il_priv *il, struct il_rxon_context *ctx) { struct ieee80211_vif *vif = ctx->vif; int err; - lockdep_assert_held(&priv->mutex); + lockdep_assert_held(&il->mutex); /* * This variable will be correct only when there's just * a single context, but all code using it is for hardware * that supports only one context. */ - priv->iw_mode = vif->type; + il->iw_mode = vif->type; ctx->is_active = true; - err = il_set_mode(priv, ctx); + err = il_set_mode(il, ctx); if (err) { if (!ctx->always_active) ctx->is_active = false; @@ -1343,23 +1343,23 @@ static int il_setup_interface(struct il_priv *priv, int il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { - struct il_priv *priv = hw->priv; + struct il_priv *il = hw->priv; struct il_vif_priv *vif_priv = (void *)vif->drv_priv; struct il_rxon_context *tmp, *ctx = NULL; int err; - IL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", + IL_DEBUG_MAC80211(il, "enter: type %d, addr %pM\n", vif->type, vif->addr); - mutex_lock(&priv->mutex); + mutex_lock(&il->mutex); - if (!il_is_ready_rf(priv)) { - IL_WARN(priv, "Try to add interface when device not ready\n"); + if (!il_is_ready_rf(il)) { + IL_WARN(il, "Try to add interface when device not ready\n"); err = -EINVAL; goto out; } - for_each_context(priv, tmp) { + for_each_context(il, tmp) { u32 possible_modes = tmp->interface_modes | tmp->exclusive_interface_modes; @@ -1389,35 +1389,35 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) vif_priv->ctx = ctx; ctx->vif = vif; - err = il_setup_interface(priv, ctx); + err = il_setup_interface(il, ctx); if (!err) goto out; ctx->vif = NULL; - priv->iw_mode = NL80211_IFTYPE_STATION; + il->iw_mode = NL80211_IFTYPE_STATION; out: - mutex_unlock(&priv->mutex); + mutex_unlock(&il->mutex); - IL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(il, "leave\n"); return err; } EXPORT_SYMBOL(il_mac_add_interface); -static void il_teardown_interface(struct il_priv *priv, +static void il_teardown_interface(struct il_priv *il, struct ieee80211_vif *vif, bool mode_change) { struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); - lockdep_assert_held(&priv->mutex); + lockdep_assert_held(&il->mutex); - if (priv->scan_vif == vif) { - il_scan_cancel_timeout(priv, 200); - il_force_scan_end(priv); + if (il->scan_vif == vif) { + il_scan_cancel_timeout(il, 200); + il_force_scan_end(il); } if (!mode_change) { - il_set_mode(priv, ctx); + il_set_mode(il, ctx); if (!ctx->always_active) ctx->is_active = false; } @@ -1426,45 +1426,45 @@ static void il_teardown_interface(struct il_priv *priv, void il_mac_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { - struct il_priv *priv = hw->priv; + struct il_priv *il = hw->priv; struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); - IL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(il, "enter\n"); - mutex_lock(&priv->mutex); + mutex_lock(&il->mutex); WARN_ON(ctx->vif != vif); ctx->vif = NULL; - il_teardown_interface(priv, vif, false); + il_teardown_interface(il, vif, false); - memset(priv->bssid, 0, ETH_ALEN); - mutex_unlock(&priv->mutex); + memset(il->bssid, 0, ETH_ALEN); + mutex_unlock(&il->mutex); - IL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(il, "leave\n"); } EXPORT_SYMBOL(il_mac_remove_interface); -int il_alloc_txq_mem(struct il_priv *priv) +int il_alloc_txq_mem(struct il_priv *il) { - if (!priv->txq) - priv->txq = kzalloc( + if (!il->txq) + il->txq = kzalloc( sizeof(struct il_tx_queue) * - priv->cfg->base_params->num_of_queues, + il->cfg->base_params->num_of_queues, GFP_KERNEL); - if (!priv->txq) { - IL_ERR(priv, "Not enough memory for txq\n"); + if (!il->txq) { + IL_ERR(il, "Not enough memory for txq\n"); return -ENOMEM; } return 0; } EXPORT_SYMBOL(il_alloc_txq_mem); -void il_txq_mem(struct il_priv *priv) +void il_txq_mem(struct il_priv *il) { - kfree(priv->txq); - priv->txq = NULL; + kfree(il->txq); + il->txq = NULL; } EXPORT_SYMBOL(il_txq_mem); @@ -1472,52 +1472,52 @@ EXPORT_SYMBOL(il_txq_mem); #define IL_TRAFFIC_DUMP_SIZE (IL_TRAFFIC_ENTRY_SIZE * IL_TRAFFIC_ENTRIES) -void il_reset_traffic_log(struct il_priv *priv) +void il_reset_traffic_log(struct il_priv *il) { - priv->tx_traffic_idx = 0; - priv->rx_traffic_idx = 0; - if (priv->tx_traffic) - memset(priv->tx_traffic, 0, IL_TRAFFIC_DUMP_SIZE); - if (priv->rx_traffic) - memset(priv->rx_traffic, 0, IL_TRAFFIC_DUMP_SIZE); + il->tx_traffic_idx = 0; + il->rx_traffic_idx = 0; + if (il->tx_traffic) + memset(il->tx_traffic, 0, IL_TRAFFIC_DUMP_SIZE); + if (il->rx_traffic) + memset(il->rx_traffic, 0, IL_TRAFFIC_DUMP_SIZE); } -int il_alloc_traffic_mem(struct il_priv *priv) +int il_alloc_traffic_mem(struct il_priv *il) { u32 traffic_size = IL_TRAFFIC_DUMP_SIZE; if (iwlegacy_debug_level & IL_DL_TX) { - if (!priv->tx_traffic) { - priv->tx_traffic = + if (!il->tx_traffic) { + il->tx_traffic = kzalloc(traffic_size, GFP_KERNEL); - if (!priv->tx_traffic) + if (!il->tx_traffic) return -ENOMEM; } } if (iwlegacy_debug_level & IL_DL_RX) { - if (!priv->rx_traffic) { - priv->rx_traffic = + if (!il->rx_traffic) { + il->rx_traffic = kzalloc(traffic_size, GFP_KERNEL); - if (!priv->rx_traffic) + if (!il->rx_traffic) return -ENOMEM; } } - il_reset_traffic_log(priv); + il_reset_traffic_log(il); return 0; } EXPORT_SYMBOL(il_alloc_traffic_mem); -void il_free_traffic_mem(struct il_priv *priv) +void il_free_traffic_mem(struct il_priv *il) { - kfree(priv->tx_traffic); - priv->tx_traffic = NULL; + kfree(il->tx_traffic); + il->tx_traffic = NULL; - kfree(priv->rx_traffic); - priv->rx_traffic = NULL; + kfree(il->rx_traffic); + il->rx_traffic = NULL; } EXPORT_SYMBOL(il_free_traffic_mem); -void il_dbg_log_tx_data_frame(struct il_priv *priv, +void il_dbg_log_tx_data_frame(struct il_priv *il, u16 length, struct ieee80211_hdr *header) { __le16 fc; @@ -1526,23 +1526,23 @@ void il_dbg_log_tx_data_frame(struct il_priv *priv, if (likely(!(iwlegacy_debug_level & IL_DL_TX))) return; - if (!priv->tx_traffic) + if (!il->tx_traffic) return; fc = header->frame_control; if (ieee80211_is_data(fc)) { len = (length > IL_TRAFFIC_ENTRY_SIZE) ? IL_TRAFFIC_ENTRY_SIZE : length; - memcpy((priv->tx_traffic + - (priv->tx_traffic_idx * IL_TRAFFIC_ENTRY_SIZE)), + memcpy((il->tx_traffic + + (il->tx_traffic_idx * IL_TRAFFIC_ENTRY_SIZE)), header, len); - priv->tx_traffic_idx = - (priv->tx_traffic_idx + 1) % IL_TRAFFIC_ENTRIES; + il->tx_traffic_idx = + (il->tx_traffic_idx + 1) % IL_TRAFFIC_ENTRIES; } } EXPORT_SYMBOL(il_dbg_log_tx_data_frame); -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) { __le16 fc; @@ -1551,18 +1551,18 @@ void il_dbg_log_rx_data_frame(struct il_priv *priv, if (likely(!(iwlegacy_debug_level & IL_DL_RX))) return; - if (!priv->rx_traffic) + if (!il->rx_traffic) return; fc = header->frame_control; if (ieee80211_is_data(fc)) { len = (length > IL_TRAFFIC_ENTRY_SIZE) ? IL_TRAFFIC_ENTRY_SIZE : length; - memcpy((priv->rx_traffic + - (priv->rx_traffic_idx * IL_TRAFFIC_ENTRY_SIZE)), + memcpy((il->rx_traffic + + (il->rx_traffic_idx * IL_TRAFFIC_ENTRY_SIZE)), header, len); - priv->rx_traffic_idx = - (priv->rx_traffic_idx + 1) % IL_TRAFFIC_ENTRIES; + il->rx_traffic_idx = + (il->rx_traffic_idx + 1) % IL_TRAFFIC_ENTRIES; } } EXPORT_SYMBOL(il_dbg_log_rx_data_frame); @@ -1605,10 +1605,10 @@ const char *il_get_ctrl_string(int cmd) } } -void il_clear_traffic_stats(struct il_priv *priv) +void il_clear_traffic_stats(struct il_priv *il) { - memset(&priv->tx_stats, 0, sizeof(struct traffic_stats)); - memset(&priv->rx_stats, 0, sizeof(struct traffic_stats)); + memset(&il->tx_stats, 0, sizeof(struct traffic_stats)); + memset(&il->rx_stats, 0, sizeof(struct traffic_stats)); } /* @@ -1623,14 +1623,14 @@ void il_clear_traffic_stats(struct il_priv *priv) * */ void -il_update_stats(struct il_priv *priv, bool is_tx, __le16 fc, u16 len) +il_update_stats(struct il_priv *il, bool is_tx, __le16 fc, u16 len) { struct traffic_stats *stats; if (is_tx) - stats = &priv->tx_stats; + stats = &il->tx_stats; else - stats = &priv->rx_stats; + stats = &il->rx_stats; if (ieee80211_is_mgmt(fc)) { switch (fc & cpu_to_le16(IEEE80211_FCTL_STYPE)) { @@ -1707,20 +1707,20 @@ il_update_stats(struct il_priv *priv, bool is_tx, __le16 fc, u16 len) EXPORT_SYMBOL(il_update_stats); #endif -int il_force_reset(struct il_priv *priv, bool external) +int il_force_reset(struct il_priv *il, bool external) { struct il_force_reset *force_reset; - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) + if (test_bit(STATUS_EXIT_PENDING, &il->status)) return -EINVAL; - force_reset = &priv->force_reset; + force_reset = &il->force_reset; force_reset->reset_request_count++; if (!external) { if (force_reset->last_force_reset_jiffies && time_after(force_reset->last_force_reset_jiffies + force_reset->reset_duration, jiffies)) { - IL_DEBUG_INFO(priv, "force reset rejected\n"); + IL_DEBUG_INFO(il, "force reset rejected\n"); force_reset->reset_reject_count++; return -EAGAIN; } @@ -1737,23 +1737,23 @@ int il_force_reset(struct il_priv *priv, bool external) * need to be check before performing firmware reload */ - if (!external && !priv->cfg->mod_params->restart_fw) { - IL_DEBUG_INFO(priv, "Cancel firmware reload based on " + if (!external && !il->cfg->mod_params->restart_fw) { + IL_DEBUG_INFO(il, "Cancel firmware reload based on " "module parameter setting\n"); return 0; } - IL_ERR(priv, "On demand firmware reload\n"); + IL_ERR(il, "On demand firmware reload\n"); /* Set the FW error flag -- cleared on il_down */ - set_bit(STATUS_FW_ERROR, &priv->status); - wake_up(&priv->wait_command_queue); + set_bit(STATUS_FW_ERROR, &il->status); + wake_up(&il->wait_command_queue); /* * Keep the restart process from trying to send host * commands by clearing the INIT status bit */ - clear_bit(STATUS_READY, &priv->status); - queue_work(priv->workqueue, &priv->restart); + clear_bit(STATUS_READY, &il->status); + queue_work(il->workqueue, &il->restart); return 0; } @@ -1763,7 +1763,7 @@ il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, enum nl80211_iftype newtype, bool newp2p) { - struct il_priv *priv = hw->priv; + struct il_priv *il = hw->priv; struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); struct il_rxon_context *tmp; u32 interface_modes; @@ -1771,9 +1771,9 @@ il_mac_change_interface(struct ieee80211_hw *hw, newtype = ieee80211_iftype_p2p(newtype, newp2p); - mutex_lock(&priv->mutex); + mutex_lock(&il->mutex); - if (!ctx->vif || !il_is_ready_rf(priv)) { + if (!ctx->vif || !il_is_ready_rf(il)) { /* * Huh? But wait ... this can maybe happen when * we're in the middle of a firmware restart! @@ -1790,7 +1790,7 @@ il_mac_change_interface(struct ieee80211_hw *hw, } if (ctx->exclusive_interface_modes & BIT(newtype)) { - for_each_context(priv, tmp) { + for_each_context(il, tmp) { if (ctx == tmp) continue; @@ -1807,10 +1807,10 @@ il_mac_change_interface(struct ieee80211_hw *hw, } /* success */ - il_teardown_interface(priv, vif, true); + il_teardown_interface(il, vif, true); vif->type = newtype; vif->p2p = newp2p; - err = il_setup_interface(priv, ctx); + err = il_setup_interface(il, ctx); WARN_ON(err); /* * We've switched internally, but submitting to the @@ -1822,7 +1822,7 @@ il_mac_change_interface(struct ieee80211_hw *hw, err = 0; out: - mutex_unlock(&priv->mutex); + mutex_unlock(&il->mutex); return err; } EXPORT_SYMBOL(il_mac_change_interface); @@ -1831,9 +1831,9 @@ EXPORT_SYMBOL(il_mac_change_interface); * On every watchdog tick we check (latest) time stamp. If it does not * change during timeout period and queue is not empty we reset firmware. */ -static int il_check_stuck_queue(struct il_priv *priv, int cnt) +static int il_check_stuck_queue(struct il_priv *il, int cnt) { - struct il_tx_queue *txq = &priv->txq[cnt]; + struct il_tx_queue *txq = &il->txq[cnt]; struct il_queue *q = &txq->q; unsigned long timeout; int ret; @@ -1844,12 +1844,12 @@ static int il_check_stuck_queue(struct il_priv *priv, int cnt) } timeout = txq->time_stamp + - msecs_to_jiffies(priv->cfg->base_params->wd_timeout); + msecs_to_jiffies(il->cfg->base_params->wd_timeout); if (time_after(jiffies, timeout)) { - IL_ERR(priv, "Queue %d stuck for %u ms.\n", - q->id, priv->cfg->base_params->wd_timeout); - ret = il_force_reset(priv, false); + IL_ERR(il, "Queue %d stuck for %u ms.\n", + q->id, il->cfg->base_params->wd_timeout); + ret = il_force_reset(il, false); return (ret == -EAGAIN) ? 0 : 1; } @@ -1868,46 +1868,46 @@ static int il_check_stuck_queue(struct il_priv *priv, int cnt) */ void il_bg_watchdog(unsigned long data) { - struct il_priv *priv = (struct il_priv *)data; + struct il_priv *il = (struct il_priv *)data; int cnt; unsigned long timeout; - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) + if (test_bit(STATUS_EXIT_PENDING, &il->status)) return; - timeout = priv->cfg->base_params->wd_timeout; + timeout = il->cfg->base_params->wd_timeout; if (timeout == 0) return; /* monitor and check for stuck cmd queue */ - if (il_check_stuck_queue(priv, priv->cmd_queue)) + if (il_check_stuck_queue(il, il->cmd_queue)) return; /* monitor and check for other stuck queues */ - if (il_is_any_associated(priv)) { - for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) { + if (il_is_any_associated(il)) { + for (cnt = 0; cnt < il->hw_params.max_txq_num; cnt++) { /* skip as we already checked the command queue */ - if (cnt == priv->cmd_queue) + if (cnt == il->cmd_queue) continue; - if (il_check_stuck_queue(priv, cnt)) + if (il_check_stuck_queue(il, cnt)) return; } } - mod_timer(&priv->watchdog, jiffies + + mod_timer(&il->watchdog, jiffies + msecs_to_jiffies(IL_WD_TICK(timeout))); } EXPORT_SYMBOL(il_bg_watchdog); -void il_setup_watchdog(struct il_priv *priv) +void il_setup_watchdog(struct il_priv *il) { - unsigned int timeout = priv->cfg->base_params->wd_timeout; + unsigned int timeout = il->cfg->base_params->wd_timeout; if (timeout) - mod_timer(&priv->watchdog, + mod_timer(&il->watchdog, jiffies + msecs_to_jiffies(IL_WD_TICK(timeout))); else - del_timer(&priv->watchdog); + del_timer(&il->watchdog); } EXPORT_SYMBOL(il_setup_watchdog); @@ -1918,7 +1918,7 @@ EXPORT_SYMBOL(il_setup_watchdog); * the internal part is the time in usec within one beacon interval */ u32 -il_usecs_to_beacons(struct il_priv *priv, +il_usecs_to_beacons(struct il_priv *il, u32 usec, u32 beacon_interval) { u32 quot; @@ -1929,39 +1929,39 @@ il_usecs_to_beacons(struct il_priv *priv, return 0; quot = (usec / interval) & - (il_beacon_time_mask_high(priv, - priv->hw_params.beacon_time_tsf_bits) >> - priv->hw_params.beacon_time_tsf_bits); - rem = (usec % interval) & il_beacon_time_mask_low(priv, - priv->hw_params.beacon_time_tsf_bits); + (il_beacon_time_mask_high(il, + il->hw_params.beacon_time_tsf_bits) >> + il->hw_params.beacon_time_tsf_bits); + rem = (usec % interval) & il_beacon_time_mask_low(il, + il->hw_params.beacon_time_tsf_bits); - return (quot << priv->hw_params.beacon_time_tsf_bits) + rem; + return (quot << il->hw_params.beacon_time_tsf_bits) + rem; } EXPORT_SYMBOL(il_usecs_to_beacons); /* base is usually what we get from ucode with each received frame, * the same as HW timer counter counting down */ -__le32 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) { - u32 base_low = base & il_beacon_time_mask_low(priv, - priv->hw_params.beacon_time_tsf_bits); - u32 addon_low = addon & il_beacon_time_mask_low(priv, - priv->hw_params.beacon_time_tsf_bits); + u32 base_low = base & il_beacon_time_mask_low(il, + il->hw_params.beacon_time_tsf_bits); + u32 addon_low = addon & il_beacon_time_mask_low(il, + il->hw_params.beacon_time_tsf_bits); u32 interval = beacon_interval * TIME_UNIT; - u32 res = (base & il_beacon_time_mask_high(priv, - priv->hw_params.beacon_time_tsf_bits)) + - (addon & il_beacon_time_mask_high(priv, - priv->hw_params.beacon_time_tsf_bits)); + u32 res = (base & il_beacon_time_mask_high(il, + il->hw_params.beacon_time_tsf_bits)) + + (addon & il_beacon_time_mask_high(il, + il->hw_params.beacon_time_tsf_bits)); if (base_low > addon_low) res += base_low - addon_low; else if (base_low < addon_low) { res += interval + base_low - addon_low; - res += (1 << priv->hw_params.beacon_time_tsf_bits); + res += (1 << il->hw_params.beacon_time_tsf_bits); } else - res += (1 << priv->hw_params.beacon_time_tsf_bits); + res += (1 << il->hw_params.beacon_time_tsf_bits); return cpu_to_le32(res); } @@ -1972,7 +1972,7 @@ EXPORT_SYMBOL(il_add_beacon_time); int il_pci_suspend(struct device *device) { struct pci_dev *pdev = to_pci_dev(device); - struct il_priv *priv = pci_get_drvdata(pdev); + struct il_priv *il = pci_get_drvdata(pdev); /* * This function is called when system goes into suspend state @@ -1981,7 +1981,7 @@ int il_pci_suspend(struct device *device) * it will not call apm_ops.stop() to stop the DMA operation. * Calling apm_ops.stop here to make sure we stop the DMA. */ - il_apm_stop(priv); + il_apm_stop(il); return 0; } @@ -1990,7 +1990,7 @@ EXPORT_SYMBOL(il_pci_suspend); int il_pci_resume(struct device *device) { struct pci_dev *pdev = to_pci_dev(device); - struct il_priv *priv = pci_get_drvdata(pdev); + struct il_priv *il = pci_get_drvdata(pdev); bool hw_rfkill = false; /* @@ -1999,18 +1999,18 @@ int il_pci_resume(struct device *device) */ pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); - il_enable_interrupts(priv); + il_enable_interrupts(il); - if (!(il_read32(priv, CSR_GP_CNTRL) & + if (!(il_read32(il, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) hw_rfkill = true; if (hw_rfkill) - set_bit(STATUS_RF_KILL_HW, &priv->status); + set_bit(STATUS_RF_KILL_HW, &il->status); else - clear_bit(STATUS_RF_KILL_HW, &priv->status); + clear_bit(STATUS_RF_KILL_HW, &il->status); - wiphy_rfkill_set_hw_state(priv->hw->wiphy, hw_rfkill); + wiphy_rfkill_set_hw_state(il->hw->wiphy, hw_rfkill); return 0; } @@ -2029,9 +2029,9 @@ EXPORT_SYMBOL(il_pm_ops); #endif /* CONFIG_PM */ static void -il_update_qos(struct il_priv *priv, struct il_rxon_context *ctx) +il_update_qos(struct il_priv *il, struct il_rxon_context *ctx) { - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) + if (test_bit(STATUS_EXIT_PENDING, &il->status)) return; if (!ctx->is_active) @@ -2046,11 +2046,11 @@ il_update_qos(struct il_priv *priv, struct il_rxon_context *ctx) if (ctx->ht.enabled) ctx->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TGN_MSK; - IL_DEBUG_QOS(priv, "send QoS cmd with Qos active=%d FLAGS=0x%X\n", + IL_DEBUG_QOS(il, "send QoS cmd with Qos active=%d FLAGS=0x%X\n", ctx->qos_data.qos_active, ctx->qos_data.def_qos_parm.qos_flags); - il_send_cmd_pdu_async(priv, ctx->qos_cmd, + il_send_cmd_pdu_async(il, ctx->qos_cmd, sizeof(struct il_qosparam_cmd), &ctx->qos_data.def_qos_parm, NULL); } @@ -2060,11 +2060,11 @@ il_update_qos(struct il_priv *priv, struct il_rxon_context *ctx) */ int il_mac_config(struct ieee80211_hw *hw, u32 changed) { - struct il_priv *priv = hw->priv; + struct il_priv *il = hw->priv; const struct il_channel_info *ch_info; struct ieee80211_conf *conf = &hw->conf; struct ieee80211_channel *channel = conf->channel; - struct il_ht_config *ht_conf = &priv->current_ht_config; + struct il_ht_config *ht_conf = &il->current_ht_config; struct il_rxon_context *ctx; unsigned long flags = 0; int ret = 0; @@ -2072,23 +2072,23 @@ int il_mac_config(struct ieee80211_hw *hw, u32 changed) int scan_active = 0; bool ht_changed[NUM_IL_RXON_CTX] = {}; - if (WARN_ON(!priv->cfg->ops->legacy)) + if (WARN_ON(!il->cfg->ops->legacy)) return -EOPNOTSUPP; - mutex_lock(&priv->mutex); + mutex_lock(&il->mutex); - IL_DEBUG_MAC80211(priv, "enter to channel %d changed 0x%X\n", + IL_DEBUG_MAC80211(il, "enter to channel %d changed 0x%X\n", channel->hw_value, changed); - if (unlikely(test_bit(STATUS_SCANNING, &priv->status))) { + if (unlikely(test_bit(STATUS_SCANNING, &il->status))) { scan_active = 1; - IL_DEBUG_MAC80211(priv, "scan active\n"); + IL_DEBUG_MAC80211(il, "scan active\n"); } if (changed & (IEEE80211_CONF_CHANGE_SMPS | IEEE80211_CONF_CHANGE_CHANNEL)) { /* mac80211 uses static for non-HT which is what we want */ - priv->current_ht_config.smps = conf->smps_mode; + il->current_ht_config.smps = conf->smps_mode; /* * Recalculate chain counts. @@ -2097,9 +2097,9 @@ int il_mac_config(struct ieee80211_hw *hw, u32 changed) * set up the SM PS mode to OFF if an HT channel is * configured. */ - if (priv->cfg->ops->hcmd->set_rxon_chain) - for_each_context(priv, ctx) - priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); + if (il->cfg->ops->hcmd->set_rxon_chain) + for_each_context(il, ctx) + il->cfg->ops->hcmd->set_rxon_chain(il, ctx); } /* during scanning mac80211 will delay channel setting until @@ -2110,23 +2110,23 @@ int il_mac_config(struct ieee80211_hw *hw, u32 changed) goto set_ch_out; ch = channel->hw_value; - ch_info = il_get_channel_info(priv, channel->band, ch); + ch_info = il_get_channel_info(il, channel->band, ch); if (!il_is_channel_valid(ch_info)) { - IL_DEBUG_MAC80211(priv, "leave - invalid channel\n"); + IL_DEBUG_MAC80211(il, "leave - invalid channel\n"); ret = -EINVAL; goto set_ch_out; } - if (priv->iw_mode == NL80211_IFTYPE_ADHOC && + if (il->iw_mode == NL80211_IFTYPE_ADHOC && !il_is_channel_ibss(ch_info)) { - IL_DEBUG_MAC80211(priv, "leave - not IBSS channel\n"); + IL_DEBUG_MAC80211(il, "leave - not IBSS channel\n"); ret = -EINVAL; goto set_ch_out; } - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); - for_each_context(priv, ctx) { + for_each_context(il, ctx) { /* Configure HT40 channels */ if (ctx->ht.enabled != conf_is_ht(conf)) { ctx->ht.enabled = conf_is_ht(conf); @@ -2162,61 +2162,61 @@ int il_mac_config(struct ieee80211_hw *hw, u32 changed) if ((le16_to_cpu(ctx->staging.channel) != ch)) ctx->staging.flags = 0; - il_set_rxon_channel(priv, channel, ctx); - il_set_rxon_ht(priv, ht_conf); + il_set_rxon_channel(il, channel, ctx); + il_set_rxon_ht(il, ht_conf); - il_set_flags_for_band(priv, ctx, channel->band, + il_set_flags_for_band(il, ctx, channel->band, ctx->vif); } - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&il->lock, flags); - if (priv->cfg->ops->legacy->update_bcast_stations) + if (il->cfg->ops->legacy->update_bcast_stations) ret = - priv->cfg->ops->legacy->update_bcast_stations(priv); + il->cfg->ops->legacy->update_bcast_stations(il); set_ch_out: /* The list of supported rates and rate mask can be different * for each band; since the band may have changed, reset * the rate mask to what mac80211 lists */ - il_set_rate(priv); + il_set_rate(il); } if (changed & (IEEE80211_CONF_CHANGE_PS | IEEE80211_CONF_CHANGE_IDLE)) { - ret = il_power_update_mode(priv, false); + ret = il_power_update_mode(il, false); if (ret) - IL_DEBUG_MAC80211(priv, "Error setting sleep level\n"); + IL_DEBUG_MAC80211(il, "Error setting sleep level\n"); } if (changed & IEEE80211_CONF_CHANGE_POWER) { - IL_DEBUG_MAC80211(priv, "TX Power old=%d new=%d\n", - priv->tx_power_user_lmt, conf->power_level); + IL_DEBUG_MAC80211(il, "TX Power old=%d new=%d\n", + il->tx_power_user_lmt, conf->power_level); - il_set_tx_power(priv, conf->power_level, false); + il_set_tx_power(il, conf->power_level, false); } - if (!il_is_ready(priv)) { - IL_DEBUG_MAC80211(priv, "leave - not ready\n"); + if (!il_is_ready(il)) { + IL_DEBUG_MAC80211(il, "leave - not ready\n"); goto out; } if (scan_active) goto out; - for_each_context(priv, ctx) { + for_each_context(il, ctx) { if (memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging))) - il_commit_rxon(priv, ctx); + il_commit_rxon(il, ctx); else - IL_DEBUG_INFO(priv, + IL_DEBUG_INFO(il, "Not re-sending same RXON configuration.\n"); if (ht_changed[ctx->ctxid]) - il_update_qos(priv, ctx); + il_update_qos(il, ctx); } out: - IL_DEBUG_MAC80211(priv, "leave\n"); - mutex_unlock(&priv->mutex); + IL_DEBUG_MAC80211(il, "leave\n"); + mutex_unlock(&il->mutex); return ret; } EXPORT_SYMBOL(il_mac_config); @@ -2224,37 +2224,37 @@ EXPORT_SYMBOL(il_mac_config); void il_mac_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { - struct il_priv *priv = hw->priv; + struct il_priv *il = hw->priv; unsigned long flags; /* IBSS can only be the IL_RXON_CTX_BSS context */ - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; - if (WARN_ON(!priv->cfg->ops->legacy)) + if (WARN_ON(!il->cfg->ops->legacy)) return; - mutex_lock(&priv->mutex); - IL_DEBUG_MAC80211(priv, "enter\n"); + mutex_lock(&il->mutex); + IL_DEBUG_MAC80211(il, "enter\n"); - spin_lock_irqsave(&priv->lock, flags); - memset(&priv->current_ht_config, 0, sizeof(struct il_ht_config)); - spin_unlock_irqrestore(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); + memset(&il->current_ht_config, 0, sizeof(struct il_ht_config)); + spin_unlock_irqrestore(&il->lock, flags); - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); /* new association get rid of ibss beacon skb */ - if (priv->beacon_skb) - dev_kfree_skb(priv->beacon_skb); + if (il->beacon_skb) + dev_kfree_skb(il->beacon_skb); - priv->beacon_skb = NULL; + il->beacon_skb = NULL; - priv->timestamp = 0; + il->timestamp = 0; - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&il->lock, flags); - il_scan_cancel_timeout(priv, 100); - if (!il_is_ready_rf(priv)) { - IL_DEBUG_MAC80211(priv, "leave - not ready\n"); - mutex_unlock(&priv->mutex); + il_scan_cancel_timeout(il, 100); + if (!il_is_ready_rf(il)) { + IL_DEBUG_MAC80211(il, "leave - not ready\n"); + mutex_unlock(&il->mutex); return; } @@ -2262,25 +2262,25 @@ void il_mac_reset_tsf(struct ieee80211_hw *hw, * clear RXON_FILTER_ASSOC_MSK bit */ ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - il_commit_rxon(priv, ctx); + il_commit_rxon(il, ctx); - il_set_rate(priv); + il_set_rate(il); - mutex_unlock(&priv->mutex); + mutex_unlock(&il->mutex); - IL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(il, "leave\n"); } EXPORT_SYMBOL(il_mac_reset_tsf); -static void il_ht_conf(struct il_priv *priv, +static void il_ht_conf(struct il_priv *il, struct ieee80211_vif *vif) { - struct il_ht_config *ht_conf = &priv->current_ht_config; + struct il_ht_config *ht_conf = &il->current_ht_config; struct ieee80211_sta *sta; struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); - IL_DEBUG_ASSOC(priv, "enter:\n"); + IL_DEBUG_ASSOC(il, "enter:\n"); if (!ctx->ht.enabled) return; @@ -2329,10 +2329,10 @@ static void il_ht_conf(struct il_priv *priv, break; } - IL_DEBUG_ASSOC(priv, "leave\n"); + IL_DEBUG_ASSOC(il, "leave\n"); } -static inline void il_set_no_assoc(struct il_priv *priv, +static inline void il_set_no_assoc(struct il_priv *il, struct ieee80211_vif *vif) { struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); @@ -2344,13 +2344,13 @@ static inline void il_set_no_assoc(struct il_priv *priv, */ ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; ctx->staging.assoc_id = 0; - il_commit_rxon(priv, ctx); + il_commit_rxon(il, ctx); } static void il_beacon_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { - struct il_priv *priv = hw->priv; + struct il_priv *il = hw->priv; unsigned long flags; __le64 timestamp; struct sk_buff *skb = ieee80211_beacon_get(hw, vif); @@ -2358,35 +2358,35 @@ static void il_beacon_update(struct ieee80211_hw *hw, if (!skb) return; - IL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(il, "enter\n"); - lockdep_assert_held(&priv->mutex); + lockdep_assert_held(&il->mutex); - if (!priv->beacon_ctx) { - IL_ERR(priv, "update beacon but no beacon context!\n"); + if (!il->beacon_ctx) { + IL_ERR(il, "update beacon but no beacon context!\n"); dev_kfree_skb(skb); return; } - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); - if (priv->beacon_skb) - dev_kfree_skb(priv->beacon_skb); + if (il->beacon_skb) + dev_kfree_skb(il->beacon_skb); - priv->beacon_skb = skb; + il->beacon_skb = skb; timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp; - priv->timestamp = le64_to_cpu(timestamp); + il->timestamp = le64_to_cpu(timestamp); - IL_DEBUG_MAC80211(priv, "leave\n"); - spin_unlock_irqrestore(&priv->lock, flags); + IL_DEBUG_MAC80211(il, "leave\n"); + spin_unlock_irqrestore(&il->lock, flags); - if (!il_is_ready_rf(priv)) { - IL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); + if (!il_is_ready_rf(il)) { + IL_DEBUG_MAC80211(il, "leave - RF not ready\n"); return; } - priv->cfg->ops->legacy->post_associate(priv); + il->cfg->ops->legacy->post_associate(il); } void il_mac_bss_info_changed(struct ieee80211_hw *hw, @@ -2394,29 +2394,29 @@ void il_mac_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_bss_conf *bss_conf, u32 changes) { - struct il_priv *priv = hw->priv; + struct il_priv *il = hw->priv; struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); int ret; - if (WARN_ON(!priv->cfg->ops->legacy)) + if (WARN_ON(!il->cfg->ops->legacy)) return; - IL_DEBUG_MAC80211(priv, "changes = 0x%X\n", changes); + IL_DEBUG_MAC80211(il, "changes = 0x%X\n", changes); - mutex_lock(&priv->mutex); + mutex_lock(&il->mutex); - if (!il_is_alive(priv)) { - mutex_unlock(&priv->mutex); + if (!il_is_alive(il)) { + mutex_unlock(&il->mutex); return; } if (changes & BSS_CHANGED_QOS) { unsigned long flags; - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); ctx->qos_data.qos_active = bss_conf->qos; - il_update_qos(priv, ctx); - spin_unlock_irqrestore(&priv->lock, flags); + il_update_qos(il, ctx); + spin_unlock_irqrestore(&il->lock, flags); } if (changes & BSS_CHANGED_BEACON_ENABLED) { @@ -2426,25 +2426,25 @@ void il_mac_bss_info_changed(struct ieee80211_hw *hw, * any time. */ if (vif->bss_conf.enable_beacon) - priv->beacon_ctx = ctx; + il->beacon_ctx = ctx; else - priv->beacon_ctx = NULL; + il->beacon_ctx = NULL; } if (changes & BSS_CHANGED_BSSID) { - IL_DEBUG_MAC80211(priv, "BSSID %pM\n", bss_conf->bssid); + IL_DEBUG_MAC80211(il, "BSSID %pM\n", bss_conf->bssid); /* * If there is currently a HW scan going on in the * background then we need to cancel it else the RXON * below/in post_associate will fail. */ - if (il_scan_cancel_timeout(priv, 100)) { - IL_WARN(priv, + if (il_scan_cancel_timeout(il, 100)) { + IL_WARN(il, "Aborted scan still in progress after 100ms\n"); - IL_DEBUG_MAC80211(priv, + IL_DEBUG_MAC80211(il, "leaving - scan abort failed.\n"); - mutex_unlock(&priv->mutex); + mutex_unlock(&il->mutex); return; } @@ -2454,7 +2454,7 @@ void il_mac_bss_info_changed(struct ieee80211_hw *hw, bss_conf->bssid, ETH_ALEN); /* currently needed in a few places */ - memcpy(priv->bssid, bss_conf->bssid, ETH_ALEN); + memcpy(il->bssid, bss_conf->bssid, ETH_ALEN); } else { ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; @@ -2471,7 +2471,7 @@ void il_mac_bss_info_changed(struct ieee80211_hw *hw, il_beacon_update(hw, vif); if (changes & BSS_CHANGED_ERP_PREAMBLE) { - IL_DEBUG_MAC80211(priv, "ERP_PREAMBLE %d\n", + IL_DEBUG_MAC80211(il, "ERP_PREAMBLE %d\n", bss_conf->use_short_preamble); if (bss_conf->use_short_preamble) ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; @@ -2480,10 +2480,10 @@ void il_mac_bss_info_changed(struct ieee80211_hw *hw, } if (changes & BSS_CHANGED_ERP_CTS_PROT) { - IL_DEBUG_MAC80211(priv, + IL_DEBUG_MAC80211(il, "ERP_CTS %d\n", bss_conf->use_cts_prot); if (bss_conf->use_cts_prot && - (priv->band != IEEE80211_BAND_5GHZ)) + (il->band != IEEE80211_BAND_5GHZ)) ctx->staging.flags |= RXON_FLG_TGG_PROTECT_MSK; else ctx->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK; @@ -2511,27 +2511,27 @@ void il_mac_bss_info_changed(struct ieee80211_hw *hw, } if (changes & BSS_CHANGED_HT) { - il_ht_conf(priv, vif); + il_ht_conf(il, vif); - if (priv->cfg->ops->hcmd->set_rxon_chain) - priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); + if (il->cfg->ops->hcmd->set_rxon_chain) + il->cfg->ops->hcmd->set_rxon_chain(il, ctx); } if (changes & BSS_CHANGED_ASSOC) { - IL_DEBUG_MAC80211(priv, "ASSOC %d\n", bss_conf->assoc); + IL_DEBUG_MAC80211(il, "ASSOC %d\n", bss_conf->assoc); if (bss_conf->assoc) { - priv->timestamp = bss_conf->timestamp; + il->timestamp = bss_conf->timestamp; - if (!il_is_rfkill(priv)) - priv->cfg->ops->legacy->post_associate(priv); + if (!il_is_rfkill(il)) + il->cfg->ops->legacy->post_associate(il); } else - il_set_no_assoc(priv, vif); + il_set_no_assoc(il, vif); } if (changes && il_is_associated_ctx(ctx) && bss_conf->aid) { - IL_DEBUG_MAC80211(priv, "Changes (%#x) while associated\n", + IL_DEBUG_MAC80211(il, "Changes (%#x) while associated\n", changes); - ret = il_send_rxon_assoc(priv, ctx); + ret = il_send_rxon_assoc(il, ctx); if (!ret) { /* Sync active_rxon with latest change. */ memcpy((void *)&ctx->active, @@ -2544,54 +2544,54 @@ void il_mac_bss_info_changed(struct ieee80211_hw *hw, if (vif->bss_conf.enable_beacon) { memcpy(ctx->staging.bssid_addr, bss_conf->bssid, ETH_ALEN); - memcpy(priv->bssid, bss_conf->bssid, ETH_ALEN); - priv->cfg->ops->legacy->config_ap(priv); + memcpy(il->bssid, bss_conf->bssid, ETH_ALEN); + il->cfg->ops->legacy->config_ap(il); } else - il_set_no_assoc(priv, vif); + il_set_no_assoc(il, vif); } if (changes & BSS_CHANGED_IBSS) { - ret = priv->cfg->ops->legacy->manage_ibss_station(priv, vif, + ret = il->cfg->ops->legacy->manage_ibss_station(il, vif, bss_conf->ibss_joined); if (ret) - IL_ERR(priv, "failed to %s IBSS station %pM\n", + IL_ERR(il, "failed to %s IBSS station %pM\n", bss_conf->ibss_joined ? "add" : "remove", bss_conf->bssid); } - mutex_unlock(&priv->mutex); + mutex_unlock(&il->mutex); - IL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(il, "leave\n"); } EXPORT_SYMBOL(il_mac_bss_info_changed); irqreturn_t il_isr(int irq, void *data) { - struct il_priv *priv = data; + struct il_priv *il = data; u32 inta, inta_mask; u32 inta_fh; unsigned long flags; - if (!priv) + if (!il) return IRQ_NONE; - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); /* Disable (but don't clear!) interrupts here to avoid * back-to-back ISRs and sporadic interrupts from our NIC. * If we have something to service, the tasklet will re-enable ints. * If we *don't* have something, we'll re-enable before leaving here. */ - inta_mask = il_read32(priv, CSR_INT_MASK); /* just for debug */ - il_write32(priv, CSR_INT_MASK, 0x00000000); + inta_mask = il_read32(il, CSR_INT_MASK); /* just for debug */ + il_write32(il, CSR_INT_MASK, 0x00000000); /* Discover which interrupts are active/pending */ - inta = il_read32(priv, CSR_INT); - inta_fh = il_read32(priv, CSR_FH_INT_STATUS); + inta = il_read32(il, CSR_INT); + inta_fh = il_read32(il, CSR_FH_INT_STATUS); /* Ignore interrupt if there's nothing in NIC to service. * This may be due to IRQ shared with another device, * or due to sporadic interrupts thrown from our NIC. */ if (!inta && !inta_fh) { - IL_DEBUG_ISR(priv, + IL_DEBUG_ISR(il, "Ignore interrupt, inta == 0, inta_fh == 0\n"); goto none; } @@ -2599,29 +2599,29 @@ irqreturn_t il_isr(int irq, void *data) if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) { /* Hardware disappeared. It might have already raised * an interrupt */ - IL_WARN(priv, "HARDWARE GONE?? INTA == 0x%08x\n", inta); + IL_WARN(il, "HARDWARE GONE?? INTA == 0x%08x\n", inta); goto unplugged; } - IL_DEBUG_ISR(priv, "ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", + IL_DEBUG_ISR(il, "ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", inta, inta_mask, inta_fh); inta &= ~CSR_INT_BIT_SCD; /* il_irq_tasklet() will service interrupts and re-enable them */ if (likely(inta || inta_fh)) - tasklet_schedule(&priv->irq_tasklet); + tasklet_schedule(&il->irq_tasklet); unplugged: - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&il->lock, flags); return IRQ_HANDLED; none: /* re-enable interrupts here since we don't have anything to service. */ /* only Re-enable if disabled by irq */ - if (test_bit(STATUS_INT_ENABLED, &priv->status)) - il_enable_interrupts(priv); - spin_unlock_irqrestore(&priv->lock, flags); + if (test_bit(STATUS_INT_ENABLED, &il->status)) + il_enable_interrupts(il); + spin_unlock_irqrestore(&il->lock, flags); return IRQ_NONE; } EXPORT_SYMBOL(il_isr); @@ -2630,7 +2630,7 @@ EXPORT_SYMBOL(il_isr); * il_tx_cmd_protection: Set rts/cts. 3945 and 4965 only share this * function. */ -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) { diff --git a/drivers/net/wireless/iwlegacy/iwl-core.h b/drivers/net/wireless/iwlegacy/iwl-core.h index 92f37c981797..1803954cbc5a 100644 --- a/drivers/net/wireless/iwlegacy/iwl-core.h +++ b/drivers/net/wireless/iwlegacy/iwl-core.h @@ -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); diff --git a/drivers/net/wireless/iwlegacy/iwl-debug.h b/drivers/net/wireless/iwlegacy/iwl-debug.h index 1bbad766aac7..657da25a2354 100644 --- a/drivers/net/wireless/iwlegacy/iwl-debug.h +++ b/drivers/net/wireless/iwlegacy/iwl-debug.h @@ -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 */ diff --git a/drivers/net/wireless/iwlegacy/iwl-debugfs.c b/drivers/net/wireless/iwlegacy/iwl-debugfs.c index 057dec5b178c..f2f2eba7d3ea 100644 --- a/drivers/net/wireless/iwlegacy/iwl-debugfs.c +++ b/drivers/net/wireless/iwlegacy/iwl-debugfs.c @@ -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); diff --git a/drivers/net/wireless/iwlegacy/iwl-dev.h b/drivers/net/wireless/iwlegacy/iwl-dev.h index 20c44f36ba77..824d1934a7a1 100644 --- a/drivers/net/wireless/iwlegacy/iwl-dev.h +++ b/drivers/net/wireless/iwlegacy/iwl-dev.h @@ -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__ */ diff --git a/drivers/net/wireless/iwlegacy/iwl-eeprom.c b/drivers/net/wireless/iwlegacy/iwl-eeprom.c index 1075f1d7f016..5edec73a505e 100644 --- a/drivers/net/wireless/iwlegacy/iwl-eeprom.c +++ b/drivers/net/wireless/iwlegacy/iwl-eeprom.c @@ -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(); diff --git a/drivers/net/wireless/iwlegacy/iwl-eeprom.h b/drivers/net/wireless/iwlegacy/iwl-eeprom.h index 9ad687161623..acb5ec17d70d 100644 --- a/drivers/net/wireless/iwlegacy/iwl-eeprom.h +++ b/drivers/net/wireless/iwlegacy/iwl-eeprom.h @@ -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__ */ diff --git a/drivers/net/wireless/iwlegacy/iwl-hcmd.c b/drivers/net/wireless/iwlegacy/iwl-hcmd.c index 515befc28001..f16e31109e06 100644 --- a/drivers/net/wireless/iwlegacy/iwl-hcmd.c +++ b/drivers/net/wireless/iwlegacy/iwl-hcmd.c @@ -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); diff --git a/drivers/net/wireless/iwlegacy/iwl-helpers.h b/drivers/net/wireless/iwlegacy/iwl-helpers.h index e4e63b570f57..e55f2ef1c57b 100644 --- a/drivers/net/wireless/iwlegacy/iwl-helpers.h +++ b/drivers/net/wireless/iwlegacy/iwl-helpers.h @@ -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; diff --git a/drivers/net/wireless/iwlegacy/iwl-io.h b/drivers/net/wireless/iwlegacy/iwl-io.h index ebeb6e2aa6e7..42d241fd6ac9 100644 --- a/drivers/net/wireless/iwlegacy/iwl-io.h +++ b/drivers/net/wireless/iwlegacy/iwl-io.h @@ -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 diff --git a/drivers/net/wireless/iwlegacy/iwl-led.c b/drivers/net/wireless/iwlegacy/iwl-led.c index 490b183b1347..13add43987b6 100644 --- a/drivers/net/wireless/iwlegacy/iwl-led.c +++ b/drivers/net/wireless/iwlegacy/iwl-led.c @@ -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); diff --git a/drivers/net/wireless/iwlegacy/iwl-led.h b/drivers/net/wireless/iwlegacy/iwl-led.h index ea7a8ea23a15..d3aba57feba7 100644 --- a/drivers/net/wireless/iwlegacy/iwl-led.h +++ b/drivers/net/wireless/iwlegacy/iwl-led.h @@ -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__ */ diff --git a/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h b/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h index 72ef91e9a799..4282ed553b92 100644 --- a/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h +++ b/drivers/net/wireless/iwlegacy/iwl-legacy-rs.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); /** diff --git a/drivers/net/wireless/iwlegacy/iwl-power.c b/drivers/net/wireless/iwlegacy/iwl-power.c index 7ccff257736e..63862464fcdb 100644 --- a/drivers/net/wireless/iwlegacy/iwl-power.c +++ b/drivers/net/wireless/iwlegacy/iwl-power.c @@ -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); diff --git a/drivers/net/wireless/iwlegacy/iwl-power.h b/drivers/net/wireless/iwlegacy/iwl-power.h index dba4ca9d30eb..e149f789063f 100644 --- a/drivers/net/wireless/iwlegacy/iwl-power.h +++ b/drivers/net/wireless/iwlegacy/iwl-power.h @@ -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__ */ diff --git a/drivers/net/wireless/iwlegacy/iwl-rx.c b/drivers/net/wireless/iwlegacy/iwl-rx.c index 9a2714c7f3e8..b6c5dd09bd8b 100644 --- a/drivers/net/wireless/iwlegacy/iwl-rx.c +++ b/drivers/net/wireless/iwlegacy/iwl-rx.c @@ -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; diff --git a/drivers/net/wireless/iwlegacy/iwl-scan.c b/drivers/net/wireless/iwlegacy/iwl-scan.c index 93e939cc9bc6..0184d5bf04e2 100644 --- a/drivers/net/wireless/iwlegacy/iwl-scan.c +++ b/drivers/net/wireless/iwlegacy/iwl-scan.c @@ -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); diff --git a/drivers/net/wireless/iwlegacy/iwl-sta.c b/drivers/net/wireless/iwlegacy/iwl-sta.c index 3773f7d64d2a..7d66e79f5d3e 100644 --- a/drivers/net/wireless/iwlegacy/iwl-sta.c +++ b/drivers/net/wireless/iwlegacy/iwl-sta.c @@ -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); diff --git a/drivers/net/wireless/iwlegacy/iwl-sta.h b/drivers/net/wireless/iwlegacy/iwl-sta.h index 555b0602cea0..77cdfd4a6674 100644 --- a/drivers/net/wireless/iwlegacy/iwl-sta.h +++ b/drivers/net/wireless/iwlegacy/iwl-sta.h @@ -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) { diff --git a/drivers/net/wireless/iwlegacy/iwl-tx.c b/drivers/net/wireless/iwlegacy/iwl-tx.c index 1c27c60c753a..af6ac4fe2670 100644 --- a/drivers/net/wireless/iwlegacy/iwl-tx.c +++ b/drivers/net/wireless/iwlegacy/iwl-tx.c @@ -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); diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c index d24937a0014a..2c336a701dc5 100644 --- a/drivers/net/wireless/iwlegacy/iwl3945-base.c +++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c @@ -98,18 +98,18 @@ struct il_mod_params il3945_mod_params = { /** * il3945_get_antenna_flags - Get antenna flags for RXON command - * @priv: eeprom and antenna fields are used to determine antenna flags + * @il: eeprom and antenna fields are used to determine antenna flags * - * priv->eeprom39 is used to determine if antenna AUX/MAIN are reversed + * il->eeprom39 is used to determine if antenna AUX/MAIN are reversed * il3945_mod_params.antenna specifies the antenna diversity mode: * * IL_ANTENNA_DIVERSITY - NIC selects best antenna by itself * IL_ANTENNA_MAIN - Force MAIN antenna * IL_ANTENNA_AUX - Force AUX antenna */ -__le32 il3945_get_antenna_flags(const struct il_priv *priv) +__le32 il3945_get_antenna_flags(const struct il_priv *il) { - struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; + struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; switch (il3945_mod_params.antenna) { case IL_ANTENNA_DIVERSITY: @@ -127,13 +127,13 @@ __le32 il3945_get_antenna_flags(const struct il_priv *priv) } /* bad antenna selector value */ - IL_ERR(priv, "Bad antenna selector value (0x%x)\n", + IL_ERR(il, "Bad antenna selector value (0x%x)\n", il3945_mod_params.antenna); return 0; /* "diversity" is default if error */ } -static int il3945_set_ccmp_dynamic_key_info(struct il_priv *priv, +static int il3945_set_ccmp_dynamic_key_info(struct il_priv *il, struct ieee80211_key_conf *keyconf, u8 sta_id) { @@ -144,80 +144,80 @@ static int il3945_set_ccmp_dynamic_key_info(struct il_priv *priv, key_flags |= (STA_KEY_FLG_CCMP | STA_KEY_FLG_MAP_KEY_MSK); key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); - if (sta_id == priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id) + if (sta_id == il->contexts[IL_RXON_CTX_BSS].bcast_sta_id) key_flags |= STA_KEY_MULTICAST_MSK; keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; keyconf->hw_key_idx = keyconf->keyidx; key_flags &= ~STA_KEY_FLG_INVALID; - spin_lock_irqsave(&priv->sta_lock, flags); - priv->stations[sta_id].keyinfo.cipher = keyconf->cipher; - priv->stations[sta_id].keyinfo.keylen = keyconf->keylen; - memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, + spin_lock_irqsave(&il->sta_lock, flags); + il->stations[sta_id].keyinfo.cipher = keyconf->cipher; + il->stations[sta_id].keyinfo.keylen = keyconf->keylen; + 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; - IL_DEBUG_INFO(priv, "hwcrypto: modify ucode station key info\n"); + IL_DEBUG_INFO(il, "hwcrypto: modify ucode station key info\n"); - ret = il_send_add_sta(priv, - &priv->stations[sta_id].sta, CMD_ASYNC); + ret = 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); return ret; } -static int il3945_set_tkip_dynamic_key_info(struct il_priv *priv, +static int il3945_set_tkip_dynamic_key_info(struct il_priv *il, struct ieee80211_key_conf *keyconf, u8 sta_id) { return -EOPNOTSUPP; } -static int il3945_set_wep_dynamic_key_info(struct il_priv *priv, +static int il3945_set_wep_dynamic_key_info(struct il_priv *il, struct ieee80211_key_conf *keyconf, u8 sta_id) { return -EOPNOTSUPP; } -static int il3945_clear_sta_key_info(struct il_priv *priv, u8 sta_id) +static int il3945_clear_sta_key_info(struct il_priv *il, u8 sta_id) { unsigned long flags; struct il_addsta_cmd sta_cmd; - spin_lock_irqsave(&priv->sta_lock, flags); - memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct il_hw_key)); - memset(&priv->stations[sta_id].sta.key, 0, + spin_lock_irqsave(&il->sta_lock, flags); + memset(&il->stations[sta_id].keyinfo, 0, sizeof(struct il_hw_key)); + memset(&il->stations[sta_id].sta.key, 0, sizeof(struct il4965_keyinfo)); - priv->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC; - priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; - priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; - memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct il_addsta_cmd)); - spin_unlock_irqrestore(&priv->sta_lock, flags); + il->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC; + 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, &il->stations[sta_id].sta, sizeof(struct il_addsta_cmd)); + spin_unlock_irqrestore(&il->sta_lock, flags); - IL_DEBUG_INFO(priv, "hwcrypto: clear ucode station key info\n"); - return il_send_add_sta(priv, &sta_cmd, CMD_SYNC); + IL_DEBUG_INFO(il, "hwcrypto: clear ucode station key info\n"); + return il_send_add_sta(il, &sta_cmd, CMD_SYNC); } -static int il3945_set_dynamic_key(struct il_priv *priv, +static int il3945_set_dynamic_key(struct il_priv *il, struct ieee80211_key_conf *keyconf, u8 sta_id) { int ret = 0; @@ -226,154 +226,154 @@ static int il3945_set_dynamic_key(struct il_priv *priv, switch (keyconf->cipher) { case WLAN_CIPHER_SUITE_CCMP: - ret = il3945_set_ccmp_dynamic_key_info(priv, keyconf, sta_id); + ret = il3945_set_ccmp_dynamic_key_info(il, keyconf, sta_id); break; case WLAN_CIPHER_SUITE_TKIP: - ret = il3945_set_tkip_dynamic_key_info(priv, keyconf, sta_id); + ret = il3945_set_tkip_dynamic_key_info(il, keyconf, sta_id); break; case WLAN_CIPHER_SUITE_WEP40: case WLAN_CIPHER_SUITE_WEP104: - ret = il3945_set_wep_dynamic_key_info(priv, keyconf, sta_id); + ret = il3945_set_wep_dynamic_key_info(il, keyconf, sta_id); break; default: - IL_ERR(priv, "Unknown alg: %s alg=%x\n", __func__, + IL_ERR(il, "Unknown alg: %s alg=%x\n", __func__, keyconf->cipher); ret = -EINVAL; } - IL_DEBUG_WEP(priv, "Set dynamic key: alg=%x len=%d idx=%d sta=%d ret=%d\n", + IL_DEBUG_WEP(il, "Set dynamic key: alg=%x len=%d idx=%d sta=%d ret=%d\n", keyconf->cipher, keyconf->keylen, keyconf->keyidx, sta_id, ret); return ret; } -static int il3945_remove_static_key(struct il_priv *priv) +static int il3945_remove_static_key(struct il_priv *il) { int ret = -EOPNOTSUPP; return ret; } -static int il3945_set_static_key(struct il_priv *priv, +static int il3945_set_static_key(struct il_priv *il, struct ieee80211_key_conf *key) { if (key->cipher == WLAN_CIPHER_SUITE_WEP40 || key->cipher == WLAN_CIPHER_SUITE_WEP104) return -EOPNOTSUPP; - IL_ERR(priv, "Static key invalid: cipher %x\n", key->cipher); + IL_ERR(il, "Static key invalid: cipher %x\n", key->cipher); return -EINVAL; } -static void il3945_clear_free_frames(struct il_priv *priv) +static void il3945_clear_free_frames(struct il_priv *il) { struct list_head *element; - IL_DEBUG_INFO(priv, "%d frames on pre-allocated heap on clear.\n", - priv->frames_count); + IL_DEBUG_INFO(il, "%d frames on pre-allocated heap on clear.\n", + il->frames_count); - while (!list_empty(&priv->free_frames)) { - element = priv->free_frames.next; + while (!list_empty(&il->free_frames)) { + element = il->free_frames.next; list_del(element); kfree(list_entry(element, struct il3945_frame, list)); - priv->frames_count--; + il->frames_count--; } - if (priv->frames_count) { - IL_WARN(priv, "%d frames still in use. Did we lose one?\n", - priv->frames_count); - priv->frames_count = 0; + if (il->frames_count) { + IL_WARN(il, "%d frames still in use. Did we lose one?\n", + il->frames_count); + il->frames_count = 0; } } -static struct il3945_frame *il3945_get_free_frame(struct il_priv *priv) +static struct il3945_frame *il3945_get_free_frame(struct il_priv *il) { struct il3945_frame *frame; struct list_head *element; - if (list_empty(&priv->free_frames)) { + if (list_empty(&il->free_frames)) { frame = kzalloc(sizeof(*frame), GFP_KERNEL); if (!frame) { - IL_ERR(priv, "Could not allocate frame!\n"); + IL_ERR(il, "Could not allocate frame!\n"); return NULL; } - priv->frames_count++; + il->frames_count++; return frame; } - element = priv->free_frames.next; + element = il->free_frames.next; list_del(element); return list_entry(element, struct il3945_frame, list); } -static void il3945_free_frame(struct il_priv *priv, struct il3945_frame *frame) +static void il3945_free_frame(struct il_priv *il, struct il3945_frame *frame) { memset(frame, 0, sizeof(*frame)); - list_add(&frame->list, &priv->free_frames); + list_add(&frame->list, &il->free_frames); } -unsigned int il3945_fill_beacon_frame(struct il_priv *priv, +unsigned int il3945_fill_beacon_frame(struct il_priv *il, struct ieee80211_hdr *hdr, int left) { - if (!il_is_associated(priv, IL_RXON_CTX_BSS) || !priv->beacon_skb) + if (!il_is_associated(il, IL_RXON_CTX_BSS) || !il->beacon_skb) return 0; - if (priv->beacon_skb->len > left) + if (il->beacon_skb->len > left) return 0; - memcpy(hdr, priv->beacon_skb->data, priv->beacon_skb->len); + memcpy(hdr, il->beacon_skb->data, il->beacon_skb->len); - return priv->beacon_skb->len; + return il->beacon_skb->len; } -static int il3945_send_beacon_cmd(struct il_priv *priv) +static int il3945_send_beacon_cmd(struct il_priv *il) { struct il3945_frame *frame; unsigned int frame_size; int rc; u8 rate; - frame = il3945_get_free_frame(priv); + frame = il3945_get_free_frame(il); if (!frame) { - IL_ERR(priv, "Could not obtain free frame buffer for beacon " + IL_ERR(il, "Could not obtain free frame buffer for beacon " "command.\n"); return -ENOMEM; } - rate = il_get_lowest_plcp(priv, - &priv->contexts[IL_RXON_CTX_BSS]); + rate = il_get_lowest_plcp(il, + &il->contexts[IL_RXON_CTX_BSS]); - frame_size = il3945_hw_get_beacon_cmd(priv, frame, rate); + frame_size = il3945_hw_get_beacon_cmd(il, frame, rate); - rc = il_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, + rc = il_send_cmd_pdu(il, REPLY_TX_BEACON, frame_size, &frame->u.cmd[0]); - il3945_free_frame(priv, frame); + il3945_free_frame(il, frame); return rc; } -static void il3945_unset_hw_params(struct il_priv *priv) +static void il3945_unset_hw_params(struct il_priv *il) { - if (priv->_3945.shared_virt) - dma_free_coherent(&priv->pci_dev->dev, + if (il->_3945.shared_virt) + dma_free_coherent(&il->pci_dev->dev, sizeof(struct il3945_shared), - priv->_3945.shared_virt, - priv->_3945.shared_phys); + il->_3945.shared_virt, + il->_3945.shared_phys); } -static void il3945_build_tx_cmd_hwcrypto(struct il_priv *priv, +static void il3945_build_tx_cmd_hwcrypto(struct il_priv *il, struct ieee80211_tx_info *info, struct il_device_cmd *cmd, struct sk_buff *skb_frag, int sta_id) { struct il3945_tx_cmd *tx_cmd = (struct il3945_tx_cmd *)cmd->cmd.payload; - struct il_hw_key *keyinfo = &priv->stations[sta_id].keyinfo; + struct il_hw_key *keyinfo = &il->stations[sta_id].keyinfo; tx_cmd->sec_ctl = 0; @@ -381,7 +381,7 @@ static void il3945_build_tx_cmd_hwcrypto(struct il_priv *priv, case WLAN_CIPHER_SUITE_CCMP: tx_cmd->sec_ctl = TX_CMD_SEC_CCM; memcpy(tx_cmd->key, keyinfo->key, keyinfo->keylen); - IL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n"); + IL_DEBUG_TX(il, "tx_cmd with AES hwcrypto\n"); break; case WLAN_CIPHER_SUITE_TKIP: @@ -396,12 +396,12 @@ static void il3945_build_tx_cmd_hwcrypto(struct il_priv *priv, memcpy(&tx_cmd->key[3], keyinfo->key, keyinfo->keylen); - IL_DEBUG_TX(priv, "Configuring packet for WEP encryption " + IL_DEBUG_TX(il, "Configuring packet for WEP encryption " "with key %d\n", info->control.hw_key->hw_key_idx); break; default: - IL_ERR(priv, "Unknown encode cipher %x\n", keyinfo->cipher); + IL_ERR(il, "Unknown encode cipher %x\n", keyinfo->cipher); break; } } @@ -409,7 +409,7 @@ static void il3945_build_tx_cmd_hwcrypto(struct il_priv *priv, /* * handle build REPLY_TX command notification. */ -static void il3945_build_tx_cmd_basic(struct il_priv *priv, +static void il3945_build_tx_cmd_basic(struct il_priv *il, struct il_device_cmd *cmd, struct ieee80211_tx_info *info, struct ieee80211_hdr *hdr, u8 std_id) @@ -443,7 +443,7 @@ static void il3945_build_tx_cmd_basic(struct il_priv *priv, tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; } - il_tx_cmd_protection(priv, info, fc, &tx_flags); + il_tx_cmd_protection(il, info, fc, &tx_flags); tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK); if (ieee80211_is_mgmt(fc)) { @@ -463,7 +463,7 @@ static void il3945_build_tx_cmd_basic(struct il_priv *priv, /* * start REPLY_TX command process */ -static int il3945_tx_skb(struct il_priv *priv, struct sk_buff *skb) +static int il3945_tx_skb(struct il_priv *il, struct sk_buff *skb) { struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); @@ -484,14 +484,14 @@ static int il3945_tx_skb(struct il_priv *priv, struct sk_buff *skb) u8 wait_write_ptr = 0; unsigned long flags; - spin_lock_irqsave(&priv->lock, flags); - if (il_is_rfkill(priv)) { - IL_DEBUG_DROP(priv, "Dropping - RF KILL\n"); + spin_lock_irqsave(&il->lock, flags); + if (il_is_rfkill(il)) { + IL_DEBUG_DROP(il, "Dropping - RF KILL\n"); goto drop_unlock; } - if ((ieee80211_get_tx_rate(priv->hw, info)->hw_value & 0xFF) == IL_INVALID_RATE) { - IL_ERR(priv, "ERROR: No TX rate available.\n"); + if ((ieee80211_get_tx_rate(il->hw, info)->hw_value & 0xFF) == IL_INVALID_RATE) { + IL_ERR(il, "ERROR: No TX rate available.\n"); goto drop_unlock; } @@ -502,28 +502,28 @@ static int il3945_tx_skb(struct il_priv *priv, struct sk_buff *skb) #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG if (ieee80211_is_auth(fc)) - IL_DEBUG_TX(priv, "Sending AUTH frame\n"); + IL_DEBUG_TX(il, "Sending AUTH frame\n"); else if (ieee80211_is_assoc_req(fc)) - IL_DEBUG_TX(priv, "Sending ASSOC frame\n"); + IL_DEBUG_TX(il, "Sending ASSOC frame\n"); else if (ieee80211_is_reassoc_req(fc)) - IL_DEBUG_TX(priv, "Sending REASSOC frame\n"); + IL_DEBUG_TX(il, "Sending REASSOC frame\n"); #endif - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&il->lock, flags); hdr_len = ieee80211_hdrlen(fc); /* Find index into station table for destination station */ sta_id = il_sta_id_or_broadcast( - priv, &priv->contexts[IL_RXON_CTX_BSS], + il, &il->contexts[IL_RXON_CTX_BSS], info->control.sta); if (sta_id == IL_INVALID_STATION) { - IL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", + IL_DEBUG_DROP(il, "Dropping - INVALID STATION: %pM\n", hdr->addr1); goto drop; } - IL_DEBUG_RATE(priv, "station Id %d\n", sta_id); + IL_DEBUG_RATE(il, "station Id %d\n", sta_id); if (ieee80211_is_data_qos(fc)) { u8 *qc = ieee80211_get_qos_ctl(hdr); @@ -533,20 +533,20 @@ static int il3945_tx_skb(struct il_priv *priv, struct sk_buff *skb) } /* Descriptor for chosen Tx queue */ - txq = &priv->txq[txq_id]; + txq = &il->txq[txq_id]; q = &txq->q; if ((il_queue_space(q) < q->high_mark)) goto drop; - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); idx = il_get_cmd_index(q, q->write_ptr, 0); /* Set up driver data for this TFD */ memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct il_tx_info)); txq->txb[q->write_ptr].skb = skb; - txq->txb[q->write_ptr].ctx = &priv->contexts[IL_RXON_CTX_BSS]; + txq->txb[q->write_ptr].ctx = &il->contexts[IL_RXON_CTX_BSS]; /* Init first empty entry in queue's array of Tx/cmd buffers */ out_cmd = txq->cmd[idx]; @@ -570,20 +570,20 @@ static int il3945_tx_skb(struct il_priv *priv, struct sk_buff *skb) if (info->control.hw_key) - il3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, sta_id); + il3945_build_tx_cmd_hwcrypto(il, info, out_cmd, skb, sta_id); /* TODO need this for burst mode later on */ - il3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, sta_id); + il3945_build_tx_cmd_basic(il, out_cmd, info, hdr, sta_id); /* set is_hcca to 0; it probably will never be implemented */ - il3945_hw_build_tx_cmd_rate(priv, out_cmd, info, hdr, sta_id, 0); + il3945_hw_build_tx_cmd_rate(il, out_cmd, info, hdr, sta_id, 0); /* Total # bytes to be transmitted */ len = (u16)skb->len; tx_cmd->len = cpu_to_le16(len); - il_dbg_log_tx_data_frame(priv, len, hdr); - il_update_stats(priv, true, fc, len); + il_dbg_log_tx_data_frame(il, len, hdr); + il_update_stats(il, true, fc, len); tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK; tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK; @@ -594,11 +594,11 @@ static int il3945_tx_skb(struct il_priv *priv, struct sk_buff *skb) txq->need_update = 0; } - IL_DEBUG_TX(priv, "sequence nr = 0X%x\n", + IL_DEBUG_TX(il, "sequence nr = 0X%x\n", le16_to_cpu(out_cmd->hdr.sequence)); - IL_DEBUG_TX(priv, "tx_flags = 0X%x\n", le32_to_cpu(tx_cmd->tx_flags)); - il_print_hex_dump(priv, IL_DL_TX, tx_cmd, sizeof(*tx_cmd)); - il_print_hex_dump(priv, IL_DL_TX, (u8 *)tx_cmd->hdr, + IL_DEBUG_TX(il, "tx_flags = 0X%x\n", le32_to_cpu(tx_cmd->tx_flags)); + il_print_hex_dump(il, IL_DL_TX, tx_cmd, sizeof(*tx_cmd)); + il_print_hex_dump(il, IL_DL_TX, (u8 *)tx_cmd->hdr, ieee80211_hdrlen(fc)); /* @@ -616,7 +616,7 @@ static int il3945_tx_skb(struct il_priv *priv, struct sk_buff *skb) /* Physical address of this Tx command's header (not MAC header!), * within command buffer array. */ - txcmd_phys = pci_map_single(priv->pci_dev, &out_cmd->hdr, + txcmd_phys = pci_map_single(il->pci_dev, &out_cmd->hdr, len, PCI_DMA_TODEVICE); /* we do not map meta data ... so we can safely access address to * provide to unmap command*/ @@ -625,7 +625,7 @@ static int il3945_tx_skb(struct il_priv *priv, struct sk_buff *skb) /* Add buffer containing Tx command and MAC(!) header to TFD's * first entry */ - priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq, + il->cfg->ops->lib->txq_attach_buf_to_tfd(il, txq, txcmd_phys, len, 1, 0); @@ -633,9 +633,9 @@ static int il3945_tx_skb(struct il_priv *priv, struct sk_buff *skb) * if any (802.11 null frames have no payload). */ len = skb->len - hdr_len; if (len) { - phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len, + phys_addr = pci_map_single(il->pci_dev, skb->data + hdr_len, len, PCI_DMA_TODEVICE); - priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq, + il->cfg->ops->lib->txq_attach_buf_to_tfd(il, txq, phys_addr, len, 0, U32_PAD(len)); } @@ -643,30 +643,30 @@ static int il3945_tx_skb(struct il_priv *priv, struct sk_buff *skb) /* Tell device the write index *just past* this latest filled TFD */ q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd); - il_txq_update_write_ptr(priv, txq); - spin_unlock_irqrestore(&priv->lock, flags); + il_txq_update_write_ptr(il, txq); + spin_unlock_irqrestore(&il->lock, flags); if ((il_queue_space(q) < q->high_mark) - && priv->mac80211_registered) { + && il->mac80211_registered) { if (wait_write_ptr) { - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); txq->need_update = 1; - il_txq_update_write_ptr(priv, txq); - spin_unlock_irqrestore(&priv->lock, flags); + il_txq_update_write_ptr(il, txq); + spin_unlock_irqrestore(&il->lock, flags); } - il_stop_queue(priv, txq); + il_stop_queue(il, txq); } return 0; drop_unlock: - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&il->lock, flags); drop: return -1; } -static int il3945_get_measurement(struct il_priv *priv, +static int il3945_get_measurement(struct il_priv *il, struct ieee80211_measurement_params *params, u8 type) { @@ -681,11 +681,11 @@ static int il3945_get_measurement(struct il_priv *priv, int rc; int spectrum_resp_status; int duration = le16_to_cpu(params->duration); - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; - if (il_is_associated(priv, IL_RXON_CTX_BSS)) - add_time = il_usecs_to_beacons(priv, - le64_to_cpu(params->start_time) - priv->_3945.last_tsf, + if (il_is_associated(il, IL_RXON_CTX_BSS)) + add_time = il_usecs_to_beacons(il, + le64_to_cpu(params->start_time) - il->_3945.last_tsf, le16_to_cpu(ctx->timing.beacon_interval)); memset(&spectrum, 0, sizeof(spectrum)); @@ -697,10 +697,10 @@ static int il3945_get_measurement(struct il_priv *priv, cmd.len = sizeof(spectrum); spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len)); - if (il_is_associated(priv, IL_RXON_CTX_BSS)) + if (il_is_associated(il, IL_RXON_CTX_BSS)) spectrum.start_time = - il_add_beacon_time(priv, - priv->_3945.last_beacon_time, add_time, + il_add_beacon_time(il, + il->_3945.last_beacon_time, add_time, le16_to_cpu(ctx->timing.beacon_interval)); else spectrum.start_time = 0; @@ -712,13 +712,13 @@ static int il3945_get_measurement(struct il_priv *priv, spectrum.flags |= RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK; - rc = il_send_cmd_sync(priv, &cmd); + rc = il_send_cmd_sync(il, &cmd); if (rc) return rc; pkt = (struct il_rx_packet *)cmd.reply_page; if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { - IL_ERR(priv, "Bad return from REPLY_RX_ON_ASSOC command\n"); + IL_ERR(il, "Bad return from REPLY_RX_ON_ASSOC command\n"); rc = -EIO; } @@ -726,11 +726,11 @@ static int il3945_get_measurement(struct il_priv *priv, switch (spectrum_resp_status) { case 0: /* Command will be handled */ if (pkt->u.spectrum.id != 0xff) { - IL_DEBUG_INFO(priv, "Replaced existing measurement: %d\n", + IL_DEBUG_INFO(il, "Replaced existing measurement: %d\n", pkt->u.spectrum.id); - priv->measurement_status &= ~MEASUREMENT_READY; + il->measurement_status &= ~MEASUREMENT_READY; } - priv->measurement_status |= MEASUREMENT_ACTIVE; + il->measurement_status |= MEASUREMENT_ACTIVE; rc = 0; break; @@ -739,12 +739,12 @@ static int il3945_get_measurement(struct il_priv *priv, break; } - il_free_pages(priv, cmd.reply_page); + il_free_pages(il, cmd.reply_page); return rc; } -static void il3945_rx_reply_alive(struct il_priv *priv, +static void il3945_rx_reply_alive(struct il_priv *il, struct il_rx_mem_buffer *rxb) { struct il_rx_packet *pkt = rxb_addr(rxb); @@ -753,44 +753,44 @@ static void il3945_rx_reply_alive(struct il_priv *priv, palive = &pkt->u.alive_frame; - IL_DEBUG_INFO(priv, "Alive ucode status 0x%08X revision " + IL_DEBUG_INFO(il, "Alive ucode status 0x%08X revision " "0x%01X 0x%01X\n", palive->is_valid, palive->ver_type, palive->ver_subtype); if (palive->ver_subtype == INITIALIZE_SUBTYPE) { - IL_DEBUG_INFO(priv, "Initialization Alive received.\n"); - memcpy(&priv->card_alive_init, &pkt->u.alive_frame, + IL_DEBUG_INFO(il, "Initialization Alive received.\n"); + memcpy(&il->card_alive_init, &pkt->u.alive_frame, sizeof(struct il_alive_resp)); - pwork = &priv->init_alive_start; + pwork = &il->init_alive_start; } else { - IL_DEBUG_INFO(priv, "Runtime Alive received.\n"); - memcpy(&priv->card_alive, &pkt->u.alive_frame, + IL_DEBUG_INFO(il, "Runtime Alive received.\n"); + memcpy(&il->card_alive, &pkt->u.alive_frame, sizeof(struct il_alive_resp)); - pwork = &priv->alive_start; - il3945_disable_events(priv); + pwork = &il->alive_start; + il3945_disable_events(il); } /* We delay the ALIVE response by 5ms to * give the HW RF Kill time to activate... */ if (palive->is_valid == UCODE_VALID_OK) - queue_delayed_work(priv->workqueue, pwork, + queue_delayed_work(il->workqueue, pwork, msecs_to_jiffies(5)); else - IL_WARN(priv, "uCode did not respond OK.\n"); + IL_WARN(il, "uCode did not respond OK.\n"); } -static void il3945_rx_reply_add_sta(struct il_priv *priv, +static void il3945_rx_reply_add_sta(struct il_priv *il, struct il_rx_mem_buffer *rxb) { #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG struct il_rx_packet *pkt = rxb_addr(rxb); #endif - IL_DEBUG_RX(priv, "Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status); + IL_DEBUG_RX(il, "Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status); } -static void il3945_rx_beacon_notif(struct il_priv *priv, +static void il3945_rx_beacon_notif(struct il_priv *il, struct il_rx_mem_buffer *rxb) { struct il_rx_packet *pkt = rxb_addr(rxb); @@ -798,7 +798,7 @@ static void il3945_rx_beacon_notif(struct il_priv *priv, #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG u8 rate = beacon->beacon_notify_hdr.rate; - IL_DEBUG_RX(priv, "beacon status %x retries %d iss %d " + IL_DEBUG_RX(il, "beacon status %x retries %d iss %d " "tsf %d %d rate %d\n", le32_to_cpu(beacon->beacon_notify_hdr.status) & TX_STATUS_MSK, beacon->beacon_notify_hdr.failure_frame, @@ -807,40 +807,40 @@ static void il3945_rx_beacon_notif(struct il_priv *priv, le32_to_cpu(beacon->low_tsf), rate); #endif - priv->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status); + il->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status); } /* Handle notification from uCode that card's power state is changing * due to software, hardware, or critical temperature RFKILL */ -static void il3945_rx_card_state_notif(struct il_priv *priv, +static void il3945_rx_card_state_notif(struct il_priv *il, struct il_rx_mem_buffer *rxb) { struct il_rx_packet *pkt = rxb_addr(rxb); u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags); - unsigned long status = priv->status; + unsigned long status = il->status; - IL_WARN(priv, "Card state received: HW:%s SW:%s\n", + IL_WARN(il, "Card state received: HW:%s SW:%s\n", (flags & HW_CARD_DISABLED) ? "Kill" : "On", (flags & SW_CARD_DISABLED) ? "Kill" : "On"); - il_write32(priv, CSR_UCODE_DRV_GP1_SET, + il_write32(il, CSR_UCODE_DRV_GP1_SET, CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); if (flags & HW_CARD_DISABLED) - set_bit(STATUS_RF_KILL_HW, &priv->status); + set_bit(STATUS_RF_KILL_HW, &il->status); else - clear_bit(STATUS_RF_KILL_HW, &priv->status); + clear_bit(STATUS_RF_KILL_HW, &il->status); - il_scan_cancel(priv); + il_scan_cancel(il); if ((test_bit(STATUS_RF_KILL_HW, &status) != - test_bit(STATUS_RF_KILL_HW, &priv->status))) - wiphy_rfkill_set_hw_state(priv->hw->wiphy, - test_bit(STATUS_RF_KILL_HW, &priv->status)); + test_bit(STATUS_RF_KILL_HW, &il->status))) + wiphy_rfkill_set_hw_state(il->hw->wiphy, + test_bit(STATUS_RF_KILL_HW, &il->status)); else - wake_up(&priv->wait_command_queue); + wake_up(&il->wait_command_queue); } /** @@ -852,32 +852,32 @@ static void il3945_rx_card_state_notif(struct il_priv *priv, * This function chains into the hardware specific files for them to setup * any hardware specific handlers as well. */ -static void il3945_setup_rx_handlers(struct il_priv *priv) +static void il3945_setup_rx_handlers(struct il_priv *il) { - priv->rx_handlers[REPLY_ALIVE] = il3945_rx_reply_alive; - priv->rx_handlers[REPLY_ADD_STA] = il3945_rx_reply_add_sta; - priv->rx_handlers[REPLY_ERROR] = il_rx_reply_error; - priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = il_rx_csa; - priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] = + il->rx_handlers[REPLY_ALIVE] = il3945_rx_reply_alive; + il->rx_handlers[REPLY_ADD_STA] = il3945_rx_reply_add_sta; + il->rx_handlers[REPLY_ERROR] = il_rx_reply_error; + il->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = il_rx_csa; + il->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] = il_rx_spectrum_measure_notif; - priv->rx_handlers[PM_SLEEP_NOTIFICATION] = il_rx_pm_sleep_notif; - priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] = + il->rx_handlers[PM_SLEEP_NOTIFICATION] = il_rx_pm_sleep_notif; + il->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] = il_rx_pm_debug_statistics_notif; - priv->rx_handlers[BEACON_NOTIFICATION] = il3945_rx_beacon_notif; + il->rx_handlers[BEACON_NOTIFICATION] = il3945_rx_beacon_notif; /* * The same handler is used for both the REPLY to a discrete * statistics request from the host as well as for the periodic * statistics notifications (after received beacons) from the uCode. */ - priv->rx_handlers[REPLY_STATISTICS_CMD] = il3945_reply_statistics; - priv->rx_handlers[STATISTICS_NOTIFICATION] = il3945_hw_rx_statistics; + il->rx_handlers[REPLY_STATISTICS_CMD] = il3945_reply_statistics; + il->rx_handlers[STATISTICS_NOTIFICATION] = il3945_hw_rx_statistics; - il_setup_rx_scan_handlers(priv); - priv->rx_handlers[CARD_STATE_NOTIFICATION] = il3945_rx_card_state_notif; + il_setup_rx_scan_handlers(il); + il->rx_handlers[CARD_STATE_NOTIFICATION] = il3945_rx_card_state_notif; /* Set up hardware specific Rx handlers */ - il3945_hw_rx_handler_setup(priv); + il3945_hw_rx_handler_setup(il); } /************************** RX-FUNCTIONS ****************************/ @@ -947,7 +947,7 @@ static void il3945_setup_rx_handlers(struct il_priv *priv) /** * il3945_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr */ -static inline __le32 il3945_dma_addr2rbd_ptr(struct il_priv *priv, +static inline __le32 il3945_dma_addr2rbd_ptr(struct il_priv *il, dma_addr_t dma_addr) { return cpu_to_le32((u32)dma_addr); @@ -964,9 +964,9 @@ static inline __le32 il3945_dma_addr2rbd_ptr(struct il_priv *priv, * also updates the memory address in the firmware to reference the new * target buffer. */ -static void il3945_rx_queue_restock(struct il_priv *priv) +static void il3945_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; @@ -981,7 +981,7 @@ static void il3945_rx_queue_restock(struct il_priv *priv) list_del(element); /* Point to Rx buffer via next RBD in circular buffer */ - rxq->bd[rxq->write] = il3945_dma_addr2rbd_ptr(priv, rxb->page_dma); + rxq->bd[rxq->write] = il3945_dma_addr2rbd_ptr(il, rxb->page_dma); rxq->queue[rxq->write] = rxb; rxq->write = (rxq->write + 1) & RX_QUEUE_MASK; rxq->free_count--; @@ -990,7 +990,7 @@ static void il3945_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. @@ -1000,7 +1000,7 @@ static void il3945_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); } } @@ -1012,9 +1012,9 @@ static void il3945_rx_queue_restock(struct il_priv *priv) * Also restock the Rx queue via il3945_rx_queue_restock. * This is called as a scheduled work item (except for during initialization) */ -static void il3945_rx_allocate(struct il_priv *priv, gfp_t priority) +static void il3945_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; @@ -1033,17 +1033,17 @@ static void il3945_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, "Failed to allocate SKB buffer.\n"); + IL_DEBUG_INFO(il, "Failed to allocate SKB buffer.\n"); if ((rxq->free_count <= RX_LOW_WATERMARK) && net_ratelimit()) - IL_CRIT(priv, "Failed to allocate SKB buffer with %s. Only %u free buffers remaining.\n", + IL_CRIT(il, "Failed to allocate SKB buffer with %s. Only %u free buffers remaining.\n", priority == GFP_ATOMIC ? "GFP_ATOMIC" : "GFP_KERNEL", rxq->free_count); /* We don't reschedule replenish work here -- we will @@ -1055,7 +1055,7 @@ static void il3945_rx_allocate(struct il_priv *priv, gfp_t priority) spin_lock_irqsave(&rxq->lock, flags); 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; @@ -1065,21 +1065,21 @@ static void il3945_rx_allocate(struct il_priv *priv, gfp_t priority) rxb->page = page; /* Get physical address of RB/SKB */ - 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); spin_lock_irqsave(&rxq->lock, flags); 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 il3945_rx_queue_reset(struct il_priv *priv, struct il_rx_queue *rxq) +void il3945_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq) { unsigned long flags; int i; @@ -1091,10 +1091,10 @@ void il3945_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); @@ -1110,21 +1110,21 @@ void il3945_rx_queue_reset(struct il_priv *priv, struct il_rx_queue *rxq) void il3945_rx_replenish(void *data) { - struct il_priv *priv = data; + struct il_priv *il = data; unsigned long flags; - il3945_rx_allocate(priv, GFP_KERNEL); + il3945_rx_allocate(il, GFP_KERNEL); - spin_lock_irqsave(&priv->lock, flags); - il3945_rx_queue_restock(priv); - spin_unlock_irqrestore(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); + il3945_rx_queue_restock(il); + spin_unlock_irqrestore(&il->lock, flags); } -static void il3945_rx_replenish_now(struct il_priv *priv) +static void il3945_rx_replenish_now(struct il_priv *il) { - il3945_rx_allocate(priv, GFP_ATOMIC); + il3945_rx_allocate(il, GFP_ATOMIC); - il3945_rx_queue_restock(priv); + il3945_rx_queue_restock(il); } @@ -1133,22 +1133,22 @@ static void il3945_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 */ -static void il3945_rx_queue_free(struct il_priv *priv, struct il_rx_queue *rxq) +static void il3945_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; @@ -1195,15 +1195,15 @@ int il3945_calc_db_from_ratio(int sig_ratio) /** * il3945_rx_handle - Main entry function for receiving responses from uCode * - * Uses the priv->rx_handlers callback function array to invoke + * Uses the il->rx_handlers callback function array to invoke * the appropriate handlers, including command responses, * frame-received notifications, and other notifications. */ -static void il3945_rx_handle(struct il_priv *priv) +static void il3945_rx_handle(struct il_priv *il) { struct il_rx_mem_buffer *rxb; struct il_rx_packet *pkt; - struct il_rx_queue *rxq = &priv->rxq; + struct il_rx_queue *rxq = &il->rxq; u32 r, i; int reclaim; unsigned long flags; @@ -1225,7 +1225,7 @@ static void il3945_rx_handle(struct il_priv *priv) fill_rx = 1; /* Rx interrupt, but nothing sent from uCode */ if (i == r) - IL_DEBUG_RX(priv, "r = %d, i = %d\n", r, i); + IL_DEBUG_RX(il, "r = %d, i = %d\n", r, i); while (i != r) { int len; @@ -1239,8 +1239,8 @@ static void il3945_rx_handle(struct il_priv *priv) rxq->queue[i] = NULL; - pci_unmap_page(priv->pci_dev, rxb->page_dma, - PAGE_SIZE << priv->hw_params.rx_page_order, + pci_unmap_page(il->pci_dev, rxb->page_dma, + PAGE_SIZE << il->hw_params.rx_page_order, PCI_DMA_FROMDEVICE); pkt = rxb_addr(rxb); @@ -1260,14 +1260,14 @@ static void il3945_rx_handle(struct il_priv *priv) /* Based on type of command response or notification, * handle those that need handling via function in * rx_handlers table. See il3945_setup_rx_handlers() */ - if (priv->rx_handlers[pkt->hdr.cmd]) { - IL_DEBUG_RX(priv, "r = %d, i = %d, %s, 0x%02x\n", r, i, + if (il->rx_handlers[pkt->hdr.cmd]) { + IL_DEBUG_RX(il, "r = %d, i = %d, %s, 0x%02x\n", r, i, il_get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); - priv->isr_stats.rx_handlers[pkt->hdr.cmd]++; - priv->rx_handlers[pkt->hdr.cmd] (priv, rxb); + il->isr_stats.rx_handlers[pkt->hdr.cmd]++; + il->rx_handlers[pkt->hdr.cmd] (il, rxb); } else { /* No handling needed */ - IL_DEBUG_RX(priv, + IL_DEBUG_RX(il, "r %d i %d No handler needed for %s, 0x%02x\n", r, i, il_get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); @@ -1285,9 +1285,9 @@ static void il3945_rx_handle(struct il_priv *priv) * and fire off the (possibly) blocking il_send_cmd() * as we reclaim the driver command queue */ if (rxb->page) - il_tx_cmd_complete(priv, rxb); + il_tx_cmd_complete(il, rxb); else - IL_WARN(priv, "Claim null rxb?\n"); + IL_WARN(il, "Claim null rxb?\n"); } /* Reuse the page if possible. For notification packets and @@ -1295,8 +1295,8 @@ static void il3945_rx_handle(struct il_priv *priv) * rx_free list for reuse later. */ spin_lock_irqsave(&rxq->lock, flags); if (rxb->page != NULL) { - rxb->page_dma = pci_map_page(priv->pci_dev, rxb->page, - 0, PAGE_SIZE << priv->hw_params.rx_page_order, + rxb->page_dma = pci_map_page(il->pci_dev, rxb->page, + 0, PAGE_SIZE << il->hw_params.rx_page_order, PCI_DMA_FROMDEVICE); list_add_tail(&rxb->list, &rxq->rx_free); rxq->free_count++; @@ -1312,7 +1312,7 @@ static void il3945_rx_handle(struct il_priv *priv) count++; if (count >= 8) { rxq->read = i; - il3945_rx_replenish_now(priv); + il3945_rx_replenish_now(il); count = 0; } } @@ -1321,17 +1321,17 @@ static void il3945_rx_handle(struct il_priv *priv) /* Backtrack one entry */ rxq->read = i; if (fill_rx) - il3945_rx_replenish_now(priv); + il3945_rx_replenish_now(il); else - il3945_rx_queue_restock(priv); + il3945_rx_queue_restock(il); } /* call this function to flush any scheduled tasklet */ -static inline void il3945_synchronize_irq(struct il_priv *priv) +static inline void il3945_synchronize_irq(struct il_priv *il) { /* wait to make sure we flush pending tasklet*/ - synchronize_irq(priv->pci_dev->irq); - tasklet_kill(&priv->irq_tasklet); + synchronize_irq(il->pci_dev->irq); + tasklet_kill(&il->irq_tasklet); } static const char *il3945_desc_lookup(int i) @@ -1357,55 +1357,55 @@ static const char *il3945_desc_lookup(int i) #define ERROR_START_OFFSET (1 * sizeof(u32)) #define ERROR_ELEM_SIZE (7 * sizeof(u32)) -void il3945_dump_nic_error_log(struct il_priv *priv) +void il3945_dump_nic_error_log(struct il_priv *il) { u32 i; u32 desc, time, count, base, data1; u32 blink1, blink2, ilink1, ilink2; - base = le32_to_cpu(priv->card_alive.error_event_table_ptr); + base = le32_to_cpu(il->card_alive.error_event_table_ptr); if (!il3945_hw_valid_rtc_data_addr(base)) { - IL_ERR(priv, "Not valid error log pointer 0x%08X\n", base); + IL_ERR(il, "Not valid error log pointer 0x%08X\n", base); return; } - count = il_read_targ_mem(priv, base); + count = il_read_targ_mem(il, base); if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { - IL_ERR(priv, "Start IWL Error Log Dump:\n"); - IL_ERR(priv, "Status: 0x%08lX, count: %d\n", - priv->status, count); + IL_ERR(il, "Start IWL Error Log Dump:\n"); + IL_ERR(il, "Status: 0x%08lX, count: %d\n", + il->status, count); } - IL_ERR(priv, "Desc Time asrtPC blink2 " + IL_ERR(il, "Desc Time asrtPC blink2 " "ilink1 nmiPC Line\n"); for (i = ERROR_START_OFFSET; i < (count * ERROR_ELEM_SIZE) + ERROR_START_OFFSET; i += ERROR_ELEM_SIZE) { - desc = il_read_targ_mem(priv, base + i); + desc = il_read_targ_mem(il, base + i); time = - il_read_targ_mem(priv, base + i + 1 * sizeof(u32)); + il_read_targ_mem(il, base + i + 1 * sizeof(u32)); blink1 = - il_read_targ_mem(priv, base + i + 2 * sizeof(u32)); + il_read_targ_mem(il, base + i + 2 * sizeof(u32)); blink2 = - il_read_targ_mem(priv, base + i + 3 * sizeof(u32)); + il_read_targ_mem(il, base + i + 3 * sizeof(u32)); ilink1 = - il_read_targ_mem(priv, base + i + 4 * sizeof(u32)); + il_read_targ_mem(il, base + i + 4 * sizeof(u32)); ilink2 = - il_read_targ_mem(priv, base + i + 5 * sizeof(u32)); + il_read_targ_mem(il, base + i + 5 * sizeof(u32)); data1 = - il_read_targ_mem(priv, base + i + 6 * sizeof(u32)); + il_read_targ_mem(il, base + i + 6 * sizeof(u32)); - IL_ERR(priv, + IL_ERR(il, "%-13s (0x%X) %010u 0x%05X 0x%05X 0x%05X 0x%05X %u\n\n", il3945_desc_lookup(desc), desc, time, blink1, blink2, ilink1, ilink2, data1); } } -static void il3945_irq_tasklet(struct il_priv *priv) +static void il3945_irq_tasklet(struct il_priv *il) { u32 inta, handled = 0; u32 inta_fh; @@ -1414,30 +1414,30 @@ static void il3945_irq_tasklet(struct il_priv *priv) u32 inta_mask; #endif - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); /* Ack/clear/reset pending uCode interrupts. * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS, * and will clear only when CSR_FH_INT_STATUS gets cleared. */ - inta = il_read32(priv, CSR_INT); - il_write32(priv, CSR_INT, inta); + inta = il_read32(il, CSR_INT); + il_write32(il, CSR_INT, inta); /* Ack/clear/reset pending flow-handler (DMA) interrupts. * Any new interrupts that happen after this, either while we're * in this tasklet, or later, will show up in next ISR/tasklet. */ - inta_fh = il_read32(priv, CSR_FH_INT_STATUS); - il_write32(priv, CSR_FH_INT_STATUS, inta_fh); + inta_fh = il_read32(il, CSR_FH_INT_STATUS); + il_write32(il, CSR_FH_INT_STATUS, inta_fh); #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG - if (il_get_debug_level(priv) & IL_DL_ISR) { + if (il_get_debug_level(il) & IL_DL_ISR) { /* just for debug */ - inta_mask = il_read32(priv, CSR_INT_MASK); - IL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", + inta_mask = il_read32(il, CSR_INT_MASK); + IL_DEBUG_ISR(il, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", inta, inta_mask, inta_fh); } #endif - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&il->lock, flags); /* Since CSR_INT and CSR_FH_INT_STATUS reads and clears are not * atomic, make sure that inta covers all the interrupts that @@ -1450,13 +1450,13 @@ static void il3945_irq_tasklet(struct il_priv *priv) /* Now service all interrupt bits discovered above. */ if (inta & CSR_INT_BIT_HW_ERR) { - IL_ERR(priv, "Hardware error detected. Restarting.\n"); + IL_ERR(il, "Hardware error detected. Restarting.\n"); /* Tell the device to stop sending interrupts */ - il_disable_interrupts(priv); + il_disable_interrupts(il); - priv->isr_stats.hw++; - il_irq_handle_error(priv); + il->isr_stats.hw++; + il_irq_handle_error(il); handled |= CSR_INT_BIT_HW_ERR; @@ -1464,18 +1464,18 @@ static void il3945_irq_tasklet(struct il_priv *priv) } #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG - if (il_get_debug_level(priv) & (IL_DL_ISR)) { + if (il_get_debug_level(il) & (IL_DL_ISR)) { /* NIC fires this, but we don't use it, redundant with WAKEUP */ if (inta & CSR_INT_BIT_SCD) { - IL_DEBUG_ISR(priv, "Scheduler finished to transmit " + IL_DEBUG_ISR(il, "Scheduler finished to transmit " "the frame/frames.\n"); - priv->isr_stats.sch++; + il->isr_stats.sch++; } /* Alive notification via Rx interrupt will do the real work */ if (inta & CSR_INT_BIT_ALIVE) { - IL_DEBUG_ISR(priv, "Alive interrupt\n"); - priv->isr_stats.alive++; + IL_DEBUG_ISR(il, "Alive interrupt\n"); + il->isr_stats.alive++; } } #endif @@ -1484,25 +1484,25 @@ static void il3945_irq_tasklet(struct il_priv *priv) /* Error detected by uCode */ if (inta & CSR_INT_BIT_SW_ERR) { - IL_ERR(priv, "Microcode SW error detected. " + IL_ERR(il, "Microcode SW error detected. " "Restarting 0x%X.\n", inta); - priv->isr_stats.sw++; - il_irq_handle_error(priv); + il->isr_stats.sw++; + il_irq_handle_error(il); handled |= CSR_INT_BIT_SW_ERR; } /* uCode wakes up after power-down sleep */ if (inta & CSR_INT_BIT_WAKEUP) { - IL_DEBUG_ISR(priv, "Wakeup interrupt\n"); - il_rx_queue_update_write_ptr(priv, &priv->rxq); - il_txq_update_write_ptr(priv, &priv->txq[0]); - il_txq_update_write_ptr(priv, &priv->txq[1]); - il_txq_update_write_ptr(priv, &priv->txq[2]); - il_txq_update_write_ptr(priv, &priv->txq[3]); - il_txq_update_write_ptr(priv, &priv->txq[4]); - il_txq_update_write_ptr(priv, &priv->txq[5]); - - priv->isr_stats.wakeup++; + IL_DEBUG_ISR(il, "Wakeup interrupt\n"); + il_rx_queue_update_write_ptr(il, &il->rxq); + il_txq_update_write_ptr(il, &il->txq[0]); + il_txq_update_write_ptr(il, &il->txq[1]); + il_txq_update_write_ptr(il, &il->txq[2]); + il_txq_update_write_ptr(il, &il->txq[3]); + il_txq_update_write_ptr(il, &il->txq[4]); + il_txq_update_write_ptr(il, &il->txq[5]); + + il->isr_stats.wakeup++; handled |= CSR_INT_BIT_WAKEUP; } @@ -1510,49 +1510,49 @@ static void il3945_irq_tasklet(struct il_priv *priv) * Rx "responses" (frame-received notification), and other * notifications from uCode come through here*/ if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) { - il3945_rx_handle(priv); - priv->isr_stats.rx++; + il3945_rx_handle(il); + il->isr_stats.rx++; handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX); } if (inta & CSR_INT_BIT_FH_TX) { - IL_DEBUG_ISR(priv, "Tx interrupt\n"); - priv->isr_stats.tx++; + IL_DEBUG_ISR(il, "Tx interrupt\n"); + il->isr_stats.tx++; - il_write32(priv, CSR_FH_INT_STATUS, (1 << 6)); - il_write_direct32(priv, FH39_TCSR_CREDIT + il_write32(il, CSR_FH_INT_STATUS, (1 << 6)); + il_write_direct32(il, FH39_TCSR_CREDIT (FH39_SRVC_CHNL), 0x0); handled |= CSR_INT_BIT_FH_TX; } if (inta & ~handled) { - IL_ERR(priv, "Unhandled INTA bits 0x%08x\n", inta & ~handled); - priv->isr_stats.unhandled++; + IL_ERR(il, "Unhandled INTA bits 0x%08x\n", inta & ~handled); + il->isr_stats.unhandled++; } - if (inta & ~priv->inta_mask) { - IL_WARN(priv, "Disabled INTA bits 0x%08x were pending\n", - inta & ~priv->inta_mask); - IL_WARN(priv, " with FH_INT = 0x%08x\n", inta_fh); + if (inta & ~il->inta_mask) { + IL_WARN(il, "Disabled INTA bits 0x%08x were pending\n", + inta & ~il->inta_mask); + IL_WARN(il, " with FH_INT = 0x%08x\n", inta_fh); } /* Re-enable all interrupts */ /* only Re-enable if disabled by irq */ - if (test_bit(STATUS_INT_ENABLED, &priv->status)) - il_enable_interrupts(priv); + if (test_bit(STATUS_INT_ENABLED, &il->status)) + il_enable_interrupts(il); #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG - if (il_get_debug_level(priv) & (IL_DL_ISR)) { - inta = il_read32(priv, CSR_INT); - inta_mask = il_read32(priv, CSR_INT_MASK); - inta_fh = il_read32(priv, CSR_FH_INT_STATUS); - IL_DEBUG_ISR(priv, "End inta 0x%08x, enabled 0x%08x, fh 0x%08x, " + if (il_get_debug_level(il) & (IL_DL_ISR)) { + inta = il_read32(il, CSR_INT); + inta_mask = il_read32(il, CSR_INT_MASK); + inta_fh = il_read32(il, CSR_FH_INT_STATUS); + IL_DEBUG_ISR(il, "End inta 0x%08x, enabled 0x%08x, fh 0x%08x, " "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags); } #endif } -static int il3945_get_channels_for_scan(struct il_priv *priv, +static int il3945_get_channels_for_scan(struct il_priv *il, enum ieee80211_band band, u8 is_active, u8 n_probes, struct il3945_scan_channel *scan_ch, @@ -1565,28 +1565,28 @@ static int il3945_get_channels_for_scan(struct il_priv *priv, u16 active_dwell = 0; int added, i; - 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; scan_ch->channel = chan->hw_value; - ch_info = il_get_channel_info(priv, band, + ch_info = il_get_channel_info(il, band, scan_ch->channel); if (!il_is_channel_valid(ch_info)) { - IL_DEBUG_SCAN(priv, + IL_DEBUG_SCAN(il, "Channel %d is INVALID for this band.\n", scan_ch->channel); continue; @@ -1600,7 +1600,7 @@ static int il3945_get_channels_for_scan(struct il_priv *priv, if (!is_active || il_is_channel_passive(ch_info) || (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN)) { scan_ch->type = 0; /* passive */ - if (IL_UCODE_API(priv->ucode_ver) == 1) + if (IL_UCODE_API(il->ucode_ver) == 1) scan_ch->active_dwell = cpu_to_le16(passive_dwell - 1); } else { scan_ch->type = 1; /* active */ @@ -1610,7 +1610,7 @@ static int il3945_get_channels_for_scan(struct il_priv *priv, * scan channels (probes gets sent right away), * or for passive channels (probes get se sent only after * hearing clear Rx packet).*/ - if (IL_UCODE_API(priv->ucode_ver) >= 2) { + if (IL_UCODE_API(il->ucode_ver) >= 2) { if (n_probes) scan_ch->type |= IWL39_SCAN_PROBE_MASK(n_probes); } else { @@ -1635,7 +1635,7 @@ static int il3945_get_channels_for_scan(struct il_priv *priv, */ } - IL_DEBUG_SCAN(priv, "Scanning %d [%s %d]\n", + IL_DEBUG_SCAN(il, "Scanning %d [%s %d]\n", scan_ch->channel, (scan_ch->type & 1) ? "ACTIVE" : "PASSIVE", (scan_ch->type & 1) ? @@ -1645,11 +1645,11 @@ static int il3945_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; } -static void il3945_init_hw_rates(struct il_priv *priv, +static void il3945_init_hw_rates(struct il_priv *il, struct ieee80211_rate *rates) { int i; @@ -1675,30 +1675,30 @@ static void il3945_init_hw_rates(struct il_priv *priv, * ******************************************************************************/ -static void il3945_dealloc_ucode_pci(struct il_priv *priv) +static void il3945_dealloc_ucode_pci(struct il_priv *il) { - il_free_fw_desc(priv->pci_dev, &priv->ucode_code); - il_free_fw_desc(priv->pci_dev, &priv->ucode_data); - il_free_fw_desc(priv->pci_dev, &priv->ucode_data_backup); - il_free_fw_desc(priv->pci_dev, &priv->ucode_init); - il_free_fw_desc(priv->pci_dev, &priv->ucode_init_data); - il_free_fw_desc(priv->pci_dev, &priv->ucode_boot); + il_free_fw_desc(il->pci_dev, &il->ucode_code); + il_free_fw_desc(il->pci_dev, &il->ucode_data); + il_free_fw_desc(il->pci_dev, &il->ucode_data_backup); + il_free_fw_desc(il->pci_dev, &il->ucode_init); + il_free_fw_desc(il->pci_dev, &il->ucode_init_data); + il_free_fw_desc(il->pci_dev, &il->ucode_boot); } /** * il3945_verify_inst_full - verify runtime uCode image in card vs. host, * looking at all data. */ -static int il3945_verify_inst_full(struct il_priv *priv, __le32 *image, u32 len) +static int il3945_verify_inst_full(struct il_priv *il, __le32 *image, u32 len) { u32 val; u32 save_len = len; int rc = 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, IWL39_RTC_INST_LOWER_BOUND); errcnt = 0; @@ -1706,9 +1706,9 @@ static int il3945_verify_inst_full(struct il_priv *priv, __le32 *image, u32 len) /* 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)); rc = -EIO; @@ -1720,7 +1720,7 @@ static int il3945_verify_inst_full(struct il_priv *priv, __le32 *image, u32 len) if (!errcnt) - IL_DEBUG_INFO(priv, + IL_DEBUG_INFO(il, "ucode image in INSTRUCTION memory is good\n"); return rc; @@ -1732,25 +1732,25 @@ static int il3945_verify_inst_full(struct il_priv *priv, __le32 *image, u32 len) * using sample data 100 bytes apart. If these sample points are good, * it's a pretty good bet that everything between them is good, too. */ -static int il3945_verify_inst_sparse(struct il_priv *priv, __le32 *image, u32 len) +static int il3945_verify_inst_sparse(struct il_priv *il, __le32 *image, u32 len) { u32 val; int rc = 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 + IWL39_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)) { #if 0 /* Enable this if you want to see details */ - 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", i, val, *image); #endif @@ -1769,55 +1769,55 @@ static int il3945_verify_inst_sparse(struct il_priv *priv, __le32 *image, u32 le * il3945_verify_ucode - determine which instruction image is in SRAM, * and verify its contents */ -static int il3945_verify_ucode(struct il_priv *priv) +static int il3945_verify_ucode(struct il_priv *il) { __le32 *image; u32 len; int rc = 0; /* Try bootstrap */ - image = (__le32 *)priv->ucode_boot.v_addr; - len = priv->ucode_boot.len; - rc = il3945_verify_inst_sparse(priv, image, len); + image = (__le32 *)il->ucode_boot.v_addr; + len = il->ucode_boot.len; + rc = il3945_verify_inst_sparse(il, image, len); if (rc == 0) { - 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; - rc = il3945_verify_inst_sparse(priv, image, len); + image = (__le32 *)il->ucode_init.v_addr; + len = il->ucode_init.len; + rc = il3945_verify_inst_sparse(il, image, len); if (rc == 0) { - 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; - rc = il3945_verify_inst_sparse(priv, image, len); + image = (__le32 *)il->ucode_code.v_addr; + len = il->ucode_code.len; + rc = il3945_verify_inst_sparse(il, image, len); if (rc == 0) { - 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; - rc = il3945_verify_inst_full(priv, image, len); + image = (__le32 *)il->ucode_boot.v_addr; + len = il->ucode_boot.len; + rc = il3945_verify_inst_full(il, image, len); return rc; } -static void il3945_nic_start(struct il_priv *priv) +static void il3945_nic_start(struct il_priv *il) { /* Remove all resets to allow NIC to operate */ - il_write32(priv, CSR_RESET, 0); + il_write32(il, CSR_RESET, 0); } #define IWL3945_UCODE_GET(item) \ @@ -1847,15 +1847,15 @@ IWL3945_UCODE_GET(boot_size); * * Copy into buffers for card to fetch via bus-mastering */ -static int il3945_read_ucode(struct il_priv *priv) +static int il3945_read_ucode(struct il_priv *il) { const struct il_ucode_header *ucode; int ret = -EINVAL, index; const struct firmware *ucode_raw; /* firmware file name contains uCode/driver compatibility version */ - const char *name_pre = priv->cfg->fw_name_pre; - const unsigned int api_max = priv->cfg->ucode_api_max; - const unsigned int api_min = priv->cfg->ucode_api_min; + const char *name_pre = il->cfg->fw_name_pre; + const unsigned int api_max = il->cfg->ucode_api_max; + const unsigned int api_min = il->cfg->ucode_api_min; char buf[25]; u8 *src; size_t len; @@ -1865,9 +1865,9 @@ static int il3945_read_ucode(struct il_priv *priv) * request_firmware() is synchronous, file is in memory on return. */ for (index = api_max; index >= api_min; index--) { sprintf(buf, "%s%u%s", name_pre, index, ".ucode"); - ret = request_firmware(&ucode_raw, buf, &priv->pci_dev->dev); + ret = request_firmware(&ucode_raw, buf, &il->pci_dev->dev); if (ret < 0) { - IL_ERR(priv, "%s firmware file req failed: %d\n", + IL_ERR(il, "%s firmware file req failed: %d\n", buf, ret); if (ret == -ENOENT) continue; @@ -1875,11 +1875,11 @@ static int il3945_read_ucode(struct il_priv *priv) goto error; } else { if (index < api_max) - IL_ERR(priv, "Loaded firmware %s, " + IL_ERR(il, "Loaded firmware %s, " "which is deprecated. " " Please use API v%u instead.\n", buf, api_max); - IL_DEBUG_INFO(priv, "Got firmware '%s' file " + IL_DEBUG_INFO(il, "Got firmware '%s' file " "(%zd bytes) from disk\n", buf, ucode_raw->size); break; @@ -1891,7 +1891,7 @@ static int il3945_read_ucode(struct il_priv *priv) /* Make sure that we got at least our header! */ if (ucode_raw->size < il3945_ucode_get_header_size(1)) { - IL_ERR(priv, "File size way too small!\n"); + IL_ERR(il, "File size way too small!\n"); ret = -EINVAL; goto err_release; } @@ -1899,8 +1899,8 @@ static int il3945_read_ucode(struct il_priv *priv) /* Data from ucode file: header followed by uCode images */ ucode = (struct il_ucode_header *)ucode_raw->data; - priv->ucode_ver = le32_to_cpu(ucode->ver); - api_ver = IL_UCODE_API(priv->ucode_ver); + il->ucode_ver = le32_to_cpu(ucode->ver); + api_ver = IL_UCODE_API(il->ucode_ver); inst_size = il3945_ucode_get_inst_size(ucode); data_size = il3945_ucode_get_data_size(ucode); init_size = il3945_ucode_get_init_size(ucode); @@ -1913,44 +1913,44 @@ static int il3945_read_ucode(struct il_priv *priv) * on the API version read from firmware header from here on forward */ if (api_ver < api_min || api_ver > api_max) { - IL_ERR(priv, "Driver unable to support your firmware API. " + IL_ERR(il, "Driver unable to support your firmware API. " "Driver supports v%u, firmware is v%u.\n", api_max, api_ver); - priv->ucode_ver = 0; + il->ucode_ver = 0; ret = -EINVAL; goto err_release; } if (api_ver != api_max) - IL_ERR(priv, "Firmware has old API version. Expected %u, " + IL_ERR(il, "Firmware has old API version. Expected %u, " "got %u. New firmware can be obtained " "from http://www.intellinuxwireless.org.\n", api_max, api_ver); - IL_INFO(priv, "loaded firmware version %u.%u.%u.%u\n", - IL_UCODE_MAJOR(priv->ucode_ver), - IL_UCODE_MINOR(priv->ucode_ver), - IL_UCODE_API(priv->ucode_ver), - IL_UCODE_SERIAL(priv->ucode_ver)); + IL_INFO(il, "loaded firmware version %u.%u.%u.%u\n", + IL_UCODE_MAJOR(il->ucode_ver), + IL_UCODE_MINOR(il->ucode_ver), + IL_UCODE_API(il->ucode_ver), + IL_UCODE_SERIAL(il->ucode_ver)); - snprintf(priv->hw->wiphy->fw_version, - sizeof(priv->hw->wiphy->fw_version), + snprintf(il->hw->wiphy->fw_version, + sizeof(il->hw->wiphy->fw_version), "%u.%u.%u.%u", - IL_UCODE_MAJOR(priv->ucode_ver), - IL_UCODE_MINOR(priv->ucode_ver), - IL_UCODE_API(priv->ucode_ver), - IL_UCODE_SERIAL(priv->ucode_ver)); - - IL_DEBUG_INFO(priv, "f/w package hdr ucode version raw = 0x%x\n", - priv->ucode_ver); - IL_DEBUG_INFO(priv, "f/w package hdr runtime inst size = %u\n", + IL_UCODE_MAJOR(il->ucode_ver), + IL_UCODE_MINOR(il->ucode_ver), + IL_UCODE_API(il->ucode_ver), + IL_UCODE_SERIAL(il->ucode_ver)); + + IL_DEBUG_INFO(il, "f/w package hdr ucode version raw = 0x%x\n", + il->ucode_ver); + IL_DEBUG_INFO(il, "f/w package hdr runtime inst size = %u\n", inst_size); - IL_DEBUG_INFO(priv, "f/w package hdr runtime data size = %u\n", + IL_DEBUG_INFO(il, "f/w package hdr runtime data size = %u\n", data_size); - IL_DEBUG_INFO(priv, "f/w package hdr init inst size = %u\n", + IL_DEBUG_INFO(il, "f/w package hdr init inst size = %u\n", init_size); - IL_DEBUG_INFO(priv, "f/w package hdr init data size = %u\n", + IL_DEBUG_INFO(il, "f/w package hdr init data size = %u\n", init_data_size); - IL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %u\n", + IL_DEBUG_INFO(il, "f/w package hdr boot inst size = %u\n", boot_size); @@ -1959,7 +1959,7 @@ static int il3945_read_ucode(struct il_priv *priv) inst_size + data_size + init_size + init_data_size + boot_size) { - IL_DEBUG_INFO(priv, + IL_DEBUG_INFO(il, "uCode file size %zd does not match expected size\n", ucode_raw->size); ret = -EINVAL; @@ -1968,34 +1968,34 @@ static int il3945_read_ucode(struct il_priv *priv) /* Verify that uCode images will fit in card's SRAM */ if (inst_size > IWL39_MAX_INST_SIZE) { - IL_DEBUG_INFO(priv, "uCode instr len %d too large to fit in\n", + IL_DEBUG_INFO(il, "uCode instr len %d too large to fit in\n", inst_size); ret = -EINVAL; goto err_release; } if (data_size > IWL39_MAX_DATA_SIZE) { - IL_DEBUG_INFO(priv, "uCode data len %d too large to fit in\n", + IL_DEBUG_INFO(il, "uCode data len %d too large to fit in\n", data_size); ret = -EINVAL; goto err_release; } if (init_size > IWL39_MAX_INST_SIZE) { - IL_DEBUG_INFO(priv, + IL_DEBUG_INFO(il, "uCode init instr len %d too large to fit in\n", init_size); ret = -EINVAL; goto err_release; } if (init_data_size > IWL39_MAX_DATA_SIZE) { - IL_DEBUG_INFO(priv, + IL_DEBUG_INFO(il, "uCode init data len %d too large to fit in\n", init_data_size); ret = -EINVAL; goto err_release; } if (boot_size > IWL39_MAX_BSM_SIZE) { - IL_DEBUG_INFO(priv, + IL_DEBUG_INFO(il, "uCode boot instr len %d too large to fit in\n", boot_size); ret = -EINVAL; @@ -2007,37 +2007,37 @@ static int il3945_read_ucode(struct il_priv *priv) /* Runtime instructions and 2 copies of data: * 1) unmodified from disk * 2) backup cache for save/restore during power-downs */ - priv->ucode_code.len = inst_size; - il_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); + il->ucode_code.len = inst_size; + il_alloc_fw_desc(il->pci_dev, &il->ucode_code); - priv->ucode_data.len = data_size; - il_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); + il->ucode_data.len = data_size; + il_alloc_fw_desc(il->pci_dev, &il->ucode_data); - priv->ucode_data_backup.len = data_size; - il_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); + il->ucode_data_backup.len = data_size; + il_alloc_fw_desc(il->pci_dev, &il->ucode_data_backup); - if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr || - !priv->ucode_data_backup.v_addr) + if (!il->ucode_code.v_addr || !il->ucode_data.v_addr || + !il->ucode_data_backup.v_addr) goto err_pci_alloc; /* Initialization instructions and data */ if (init_size && init_data_size) { - priv->ucode_init.len = init_size; - il_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); + il->ucode_init.len = init_size; + il_alloc_fw_desc(il->pci_dev, &il->ucode_init); - priv->ucode_init_data.len = init_data_size; - il_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); + il->ucode_init_data.len = init_data_size; + il_alloc_fw_desc(il->pci_dev, &il->ucode_init_data); - if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr) + if (!il->ucode_init.v_addr || !il->ucode_init_data.v_addr) goto err_pci_alloc; } /* Bootstrap (instructions only, no data) */ if (boot_size) { - priv->ucode_boot.len = boot_size; - il_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); + il->ucode_boot.len = boot_size; + il_alloc_fw_desc(il->pci_dev, &il->ucode_boot); - if (!priv->ucode_boot.v_addr) + if (!il->ucode_boot.v_addr) goto err_pci_alloc; } @@ -2045,55 +2045,55 @@ static int il3945_read_ucode(struct il_priv *priv) /* Runtime instructions (first block of data in file) */ len = inst_size; - IL_DEBUG_INFO(priv, + IL_DEBUG_INFO(il, "Copying (but not loading) uCode instr len %zd\n", len); - memcpy(priv->ucode_code.v_addr, src, len); + memcpy(il->ucode_code.v_addr, src, len); src += len; - IL_DEBUG_INFO(priv, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n", - priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr); + IL_DEBUG_INFO(il, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n", + il->ucode_code.v_addr, (u32)il->ucode_code.p_addr); /* Runtime data (2nd block) * NOTE: Copy into backup buffer will be done in il3945_up() */ len = data_size; - IL_DEBUG_INFO(priv, + IL_DEBUG_INFO(il, "Copying (but not loading) uCode data len %zd\n", len); - memcpy(priv->ucode_data.v_addr, src, len); - memcpy(priv->ucode_data_backup.v_addr, src, len); + memcpy(il->ucode_data.v_addr, src, len); + memcpy(il->ucode_data_backup.v_addr, src, len); src += len; /* Initialization instructions (3rd block) */ if (init_size) { len = init_size; - IL_DEBUG_INFO(priv, + IL_DEBUG_INFO(il, "Copying (but not loading) init instr len %zd\n", len); - memcpy(priv->ucode_init.v_addr, src, len); + memcpy(il->ucode_init.v_addr, src, len); src += len; } /* Initialization data (4th block) */ if (init_data_size) { len = init_data_size; - IL_DEBUG_INFO(priv, + IL_DEBUG_INFO(il, "Copying (but not loading) init data len %zd\n", len); - memcpy(priv->ucode_init_data.v_addr, src, len); + memcpy(il->ucode_init_data.v_addr, src, len); src += len; } /* Bootstrap instructions (5th block) */ len = boot_size; - IL_DEBUG_INFO(priv, + IL_DEBUG_INFO(il, "Copying (but not loading) boot instr len %zd\n", len); - memcpy(priv->ucode_boot.v_addr, src, len); + memcpy(il->ucode_boot.v_addr, src, len); /* We have our copies now, allow OS release its copies */ release_firmware(ucode_raw); return 0; err_pci_alloc: - IL_ERR(priv, "failed to allocate pci memory\n"); + IL_ERR(il, "failed to allocate pci memory\n"); ret = -ENOMEM; - il3945_dealloc_ucode_pci(priv); + il3945_dealloc_ucode_pci(il); err_release: release_firmware(ucode_raw); @@ -2112,27 +2112,27 @@ static int il3945_read_ucode(struct il_priv *priv) * We need to replace them to load runtime uCode inst and data, * and to save runtime data when powering down. */ -static int il3945_set_ucode_ptrs(struct il_priv *priv) +static int il3945_set_ucode_ptrs(struct il_priv *il) { dma_addr_t pinst; dma_addr_t pdata; /* bits 31:0 for 3945 */ - pinst = priv->ucode_code.p_addr; - pdata = priv->ucode_data_backup.p_addr; + pinst = il->ucode_code.p_addr; + pdata = il->ucode_data_backup.p_addr; /* Tell bootstrap uCode where to find image to load */ - il_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); - il_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); - il_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, - priv->ucode_data.len); + il_write_prph(il, BSM_DRAM_INST_PTR_REG, pinst); + il_write_prph(il, BSM_DRAM_DATA_PTR_REG, pdata); + il_write_prph(il, BSM_DRAM_DATA_BYTECOUNT_REG, + il->ucode_data.len); /* Inst byte count must be last to set up, bit 31 signals uCode * that all new ptr/size info is in place */ - il_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, - priv->ucode_code.len | BSM_DRAM_INST_LOAD); + il_write_prph(il, BSM_DRAM_INST_BYTECOUNT_REG, + il->ucode_code.len | BSM_DRAM_INST_LOAD); - IL_DEBUG_INFO(priv, "Runtime uCode pointers are set.\n"); + IL_DEBUG_INFO(il, "Runtime uCode pointers are set.\n"); return 0; } @@ -2144,40 +2144,40 @@ static int il3945_set_ucode_ptrs(struct il_priv *priv) * * Tell "initialize" uCode to go ahead and load the runtime uCode. */ -static void il3945_init_alive_start(struct il_priv *priv) +static void il3945_init_alive_start(struct il_priv *il) { /* Check alive response for "valid" sign from uCode */ - if (priv->card_alive_init.is_valid != UCODE_VALID_OK) { + if (il->card_alive_init.is_valid != UCODE_VALID_OK) { /* We had an error bringing up the hardware, so take it * all the way back down so we can try again */ - IL_DEBUG_INFO(priv, "Initialize Alive failed.\n"); + IL_DEBUG_INFO(il, "Initialize Alive failed.\n"); goto restart; } /* Bootstrap uCode has loaded initialize uCode ... verify inst image. * This is a paranoid check, because we would not have gotten the * "initialize" alive if code weren't properly loaded. */ - if (il3945_verify_ucode(priv)) { + if (il3945_verify_ucode(il)) { /* Runtime instruction load was bad; * take it all the way back down so we can try again */ - IL_DEBUG_INFO(priv, "Bad \"initialize\" uCode load.\n"); + IL_DEBUG_INFO(il, "Bad \"initialize\" uCode load.\n"); goto restart; } /* Send pointers to protocol/runtime uCode image ... init code will * load and launch runtime uCode, which will send us another "Alive" * notification. */ - IL_DEBUG_INFO(priv, "Initialization Alive received.\n"); - if (il3945_set_ucode_ptrs(priv)) { + IL_DEBUG_INFO(il, "Initialization Alive received.\n"); + if (il3945_set_ucode_ptrs(il)) { /* Runtime instruction load won't happen; * take it all the way back down so we can try again */ - IL_DEBUG_INFO(priv, "Couldn't set up uCode pointers.\n"); + IL_DEBUG_INFO(il, "Couldn't set up uCode pointers.\n"); goto restart; } return; restart: - queue_work(priv->workqueue, &priv->restart); + queue_work(il->workqueue, &il->restart); } /** @@ -2185,65 +2185,65 @@ static void il3945_init_alive_start(struct il_priv *priv) * from protocol/runtime uCode (initialization uCode's * Alive gets handled by il3945_init_alive_start()). */ -static void il3945_alive_start(struct il_priv *priv) +static void il3945_alive_start(struct il_priv *il) { int thermal_spin = 0; u32 rfkill; - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; - IL_DEBUG_INFO(priv, "Runtime Alive received.\n"); + IL_DEBUG_INFO(il, "Runtime Alive received.\n"); - if (priv->card_alive.is_valid != UCODE_VALID_OK) { + if (il->card_alive.is_valid != UCODE_VALID_OK) { /* We had an error bringing up the hardware, so take it * all the way back down so we can try again */ - IL_DEBUG_INFO(priv, "Alive failed.\n"); + IL_DEBUG_INFO(il, "Alive failed.\n"); goto restart; } /* Initialize uCode has loaded Runtime uCode ... verify inst image. * This is a paranoid check, because we would not have gotten the * "runtime" alive if code weren't properly loaded. */ - if (il3945_verify_ucode(priv)) { + if (il3945_verify_ucode(il)) { /* Runtime instruction load was bad; * take it all the way back down so we can try again */ - IL_DEBUG_INFO(priv, "Bad runtime uCode load.\n"); + IL_DEBUG_INFO(il, "Bad runtime uCode load.\n"); goto restart; } - rfkill = il_read_prph(priv, APMG_RFKILL_REG); - IL_DEBUG_INFO(priv, "RFKILL status: 0x%x\n", rfkill); + rfkill = il_read_prph(il, APMG_RFKILL_REG); + IL_DEBUG_INFO(il, "RFKILL status: 0x%x\n", rfkill); if (rfkill & 0x1) { - clear_bit(STATUS_RF_KILL_HW, &priv->status); + clear_bit(STATUS_RF_KILL_HW, &il->status); /* if RFKILL is not on, then wait for thermal * sensor in adapter to kick in */ - while (il3945_hw_get_temperature(priv) == 0) { + while (il3945_hw_get_temperature(il) == 0) { thermal_spin++; udelay(10); } if (thermal_spin) - IL_DEBUG_INFO(priv, "Thermal calibration took %dus\n", + IL_DEBUG_INFO(il, "Thermal calibration took %dus\n", thermal_spin * 10); } else - set_bit(STATUS_RF_KILL_HW, &priv->status); + set_bit(STATUS_RF_KILL_HW, &il->status); /* After the ALIVE response, we can send commands to 3945 uCode */ - set_bit(STATUS_ALIVE, &priv->status); + set_bit(STATUS_ALIVE, &il->status); /* Enable watchdog to monitor the driver tx queues */ - il_setup_watchdog(priv); + il_setup_watchdog(il); - if (il_is_rfkill(priv)) + if (il_is_rfkill(il)) return; - ieee80211_wake_queues(priv->hw); + ieee80211_wake_queues(il->hw); - priv->active_rate = IL_RATES_MASK_3945; + il->active_rate = IL_RATES_MASK_3945; - il_power_update_mode(priv, true); + il_power_update_mode(il, true); - if (il_is_associated(priv, IL_RXON_CTX_BSS)) { + if (il_is_associated(il, IL_RXON_CTX_BSS)) { struct il3945_rxon_cmd *active_rxon = (struct il3945_rxon_cmd *)(&ctx->active); @@ -2251,205 +2251,205 @@ static void il3945_alive_start(struct il_priv *priv) active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; } else { /* Initialize our rx_config data */ - il_connection_init_rx_config(priv, ctx); + il_connection_init_rx_config(il, ctx); } /* Configure Bluetooth device coexistence support */ - il_send_bt_config(priv); + il_send_bt_config(il); - set_bit(STATUS_READY, &priv->status); + set_bit(STATUS_READY, &il->status); /* Configure the adapter for unassociated operation */ - il3945_commit_rxon(priv, ctx); + il3945_commit_rxon(il, ctx); - il3945_reg_txpower_periodic(priv); + il3945_reg_txpower_periodic(il); - IL_DEBUG_INFO(priv, "ALIVE processing complete.\n"); - wake_up(&priv->wait_command_queue); + IL_DEBUG_INFO(il, "ALIVE processing complete.\n"); + wake_up(&il->wait_command_queue); return; restart: - queue_work(priv->workqueue, &priv->restart); + queue_work(il->workqueue, &il->restart); } -static void il3945_cancel_deferred_work(struct il_priv *priv); +static void il3945_cancel_deferred_work(struct il_priv *il); -static void __il3945_down(struct il_priv *priv) +static void __il3945_down(struct il_priv *il) { unsigned long flags; int exit_pending; - IL_DEBUG_INFO(priv, DRV_NAME " is going down\n"); + IL_DEBUG_INFO(il, DRV_NAME " is going down\n"); - il_scan_cancel_timeout(priv, 200); + il_scan_cancel_timeout(il, 200); - exit_pending = test_and_set_bit(STATUS_EXIT_PENDING, &priv->status); + exit_pending = test_and_set_bit(STATUS_EXIT_PENDING, &il->status); /* Stop TX queues watchdog. We need to have STATUS_EXIT_PENDING bit set * to prevent rearm timer */ - del_timer_sync(&priv->watchdog); + del_timer_sync(&il->watchdog); /* Station information will now be cleared in device */ - il_clear_ucode_stations(priv, NULL); - il_dealloc_bcast_stations(priv); - il_clear_driver_stations(priv); + il_clear_ucode_stations(il, NULL); + il_dealloc_bcast_stations(il); + il_clear_driver_stations(il); /* Unblock any waiting calls */ - wake_up_all(&priv->wait_command_queue); + wake_up_all(&il->wait_command_queue); /* Wipe out the EXIT_PENDING status bit if we are not actually * exiting the module */ if (!exit_pending) - clear_bit(STATUS_EXIT_PENDING, &priv->status); + clear_bit(STATUS_EXIT_PENDING, &il->status); /* stop and reset the on-board processor */ - il_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); + il_write32(il, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); /* tell the device to stop sending interrupts */ - spin_lock_irqsave(&priv->lock, flags); - il_disable_interrupts(priv); - spin_unlock_irqrestore(&priv->lock, flags); - il3945_synchronize_irq(priv); + spin_lock_irqsave(&il->lock, flags); + il_disable_interrupts(il); + spin_unlock_irqrestore(&il->lock, flags); + il3945_synchronize_irq(il); - if (priv->mac80211_registered) - ieee80211_stop_queues(priv->hw); + if (il->mac80211_registered) + ieee80211_stop_queues(il->hw); /* If we have not previously called il3945_init() then * clear all bits but the RF Kill bits and return */ - if (!il_is_init(priv)) { - priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << + if (!il_is_init(il)) { + il->status = test_bit(STATUS_RF_KILL_HW, &il->status) << STATUS_RF_KILL_HW | - test_bit(STATUS_GEO_CONFIGURED, &priv->status) << + test_bit(STATUS_GEO_CONFIGURED, &il->status) << STATUS_GEO_CONFIGURED | - test_bit(STATUS_EXIT_PENDING, &priv->status) << + test_bit(STATUS_EXIT_PENDING, &il->status) << STATUS_EXIT_PENDING; goto exit; } /* ...otherwise clear out all the status bits but the RF Kill * bit and continue taking the NIC down. */ - priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) << + il->status &= test_bit(STATUS_RF_KILL_HW, &il->status) << STATUS_RF_KILL_HW | - test_bit(STATUS_GEO_CONFIGURED, &priv->status) << + test_bit(STATUS_GEO_CONFIGURED, &il->status) << STATUS_GEO_CONFIGURED | - test_bit(STATUS_FW_ERROR, &priv->status) << + test_bit(STATUS_FW_ERROR, &il->status) << STATUS_FW_ERROR | - test_bit(STATUS_EXIT_PENDING, &priv->status) << + test_bit(STATUS_EXIT_PENDING, &il->status) << STATUS_EXIT_PENDING; - il3945_hw_txq_ctx_stop(priv); - il3945_hw_rxq_stop(priv); + il3945_hw_txq_ctx_stop(il); + il3945_hw_rxq_stop(il); /* Power-down device's busmaster DMA clocks */ - il_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); + il_write_prph(il, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); udelay(5); /* Stop the device, and put it in low power state */ - il_apm_stop(priv); + il_apm_stop(il); exit: - memset(&priv->card_alive, 0, sizeof(struct il_alive_resp)); + memset(&il->card_alive, 0, sizeof(struct il_alive_resp)); - if (priv->beacon_skb) - dev_kfree_skb(priv->beacon_skb); - priv->beacon_skb = NULL; + if (il->beacon_skb) + dev_kfree_skb(il->beacon_skb); + il->beacon_skb = NULL; /* clear out any free frames */ - il3945_clear_free_frames(priv); + il3945_clear_free_frames(il); } -static void il3945_down(struct il_priv *priv) +static void il3945_down(struct il_priv *il) { - mutex_lock(&priv->mutex); - __il3945_down(priv); - mutex_unlock(&priv->mutex); + mutex_lock(&il->mutex); + __il3945_down(il); + mutex_unlock(&il->mutex); - il3945_cancel_deferred_work(priv); + il3945_cancel_deferred_work(il); } #define MAX_HW_RESTARTS 5 -static int il3945_alloc_bcast_station(struct il_priv *priv) +static int il3945_alloc_bcast_station(struct il_priv *il) { - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; unsigned long flags; u8 sta_id; - spin_lock_irqsave(&priv->sta_lock, flags); - sta_id = il_prep_station(priv, ctx, + 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); return 0; } -static int __il3945_up(struct il_priv *priv) +static int __il3945_up(struct il_priv *il) { int rc, i; - rc = il3945_alloc_bcast_station(priv); + rc = il3945_alloc_bcast_station(il); if (rc) return rc; - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { - IL_WARN(priv, "Exit pending; will not bring the NIC up\n"); + if (test_bit(STATUS_EXIT_PENDING, &il->status)) { + IL_WARN(il, "Exit pending; will not bring the NIC up\n"); return -EIO; } - if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) { - IL_ERR(priv, "ucode not available for device bring up\n"); + if (!il->ucode_data_backup.v_addr || !il->ucode_data.v_addr) { + IL_ERR(il, "ucode not available for device bring up\n"); return -EIO; } /* If platform's RF_KILL switch is NOT set to KILL */ - if (il_read32(priv, CSR_GP_CNTRL) & + if (il_read32(il, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) - clear_bit(STATUS_RF_KILL_HW, &priv->status); + clear_bit(STATUS_RF_KILL_HW, &il->status); else { - set_bit(STATUS_RF_KILL_HW, &priv->status); - IL_WARN(priv, "Radio disabled by HW RF Kill switch\n"); + set_bit(STATUS_RF_KILL_HW, &il->status); + IL_WARN(il, "Radio disabled by HW RF Kill switch\n"); return -ENODEV; } - il_write32(priv, CSR_INT, 0xFFFFFFFF); + il_write32(il, CSR_INT, 0xFFFFFFFF); - rc = il3945_hw_nic_init(priv); + rc = il3945_hw_nic_init(il); if (rc) { - IL_ERR(priv, "Unable to int nic\n"); + IL_ERR(il, "Unable to int nic\n"); return rc; } /* make sure rfkill handshake bits are cleared */ - il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - il_write32(priv, CSR_UCODE_DRV_GP1_CLR, + il_write32(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + il_write32(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); /* clear (again), then enable host interrupts */ - il_write32(priv, CSR_INT, 0xFFFFFFFF); - il_enable_interrupts(priv); + il_write32(il, CSR_INT, 0xFFFFFFFF); + il_enable_interrupts(il); /* really make sure rfkill handshake bits are cleared */ - il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + il_write32(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + il_write32(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); /* Copy original ucode data image from disk into backup cache. * This will be used to initialize the on-board processor's * data SRAM for a clean start when the runtime program first loads. */ - memcpy(priv->ucode_data_backup.v_addr, priv->ucode_data.v_addr, - priv->ucode_data.len); + memcpy(il->ucode_data_backup.v_addr, il->ucode_data.v_addr, + il->ucode_data.len); /* We return success when we resume from suspend and rf_kill is on. */ - if (test_bit(STATUS_RF_KILL_HW, &priv->status)) + if (test_bit(STATUS_RF_KILL_HW, &il->status)) return 0; for (i = 0; i < MAX_HW_RESTARTS; i++) { @@ -2457,29 +2457,29 @@ static int __il3945_up(struct il_priv *priv) /* load bootstrap state machine, * load bootstrap program into processor's memory, * prepare to load the "initialize" uCode */ - rc = priv->cfg->ops->lib->load_ucode(priv); + rc = il->cfg->ops->lib->load_ucode(il); if (rc) { - IL_ERR(priv, + IL_ERR(il, "Unable to set up bootstrap uCode: %d\n", rc); continue; } /* start card; "initialize" will load runtime ucode */ - il3945_nic_start(priv); + il3945_nic_start(il); - IL_DEBUG_INFO(priv, DRV_NAME " is coming up\n"); + IL_DEBUG_INFO(il, DRV_NAME " is coming up\n"); return 0; } - set_bit(STATUS_EXIT_PENDING, &priv->status); - __il3945_down(priv); - clear_bit(STATUS_EXIT_PENDING, &priv->status); + set_bit(STATUS_EXIT_PENDING, &il->status); + __il3945_down(il); + clear_bit(STATUS_EXIT_PENDING, &il->status); /* tried to restart and config the device for as long as our * patience could withstand */ - IL_ERR(priv, "Unable to initialize device after %d attempts.\n", i); + IL_ERR(il, "Unable to initialize device after %d attempts.\n", i); return -EIO; } @@ -2492,30 +2492,30 @@ static int __il3945_up(struct il_priv *priv) static void il3945_bg_init_alive_start(struct work_struct *data) { - struct il_priv *priv = + struct il_priv *il = container_of(data, struct il_priv, init_alive_start.work); - mutex_lock(&priv->mutex); - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) + mutex_lock(&il->mutex); + if (test_bit(STATUS_EXIT_PENDING, &il->status)) goto out; - il3945_init_alive_start(priv); + il3945_init_alive_start(il); out: - mutex_unlock(&priv->mutex); + mutex_unlock(&il->mutex); } static void il3945_bg_alive_start(struct work_struct *data) { - struct il_priv *priv = + struct il_priv *il = container_of(data, struct il_priv, alive_start.work); - mutex_lock(&priv->mutex); - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) + mutex_lock(&il->mutex); + if (test_bit(STATUS_EXIT_PENDING, &il->status)) goto out; - il3945_alive_start(priv); + il3945_alive_start(il); out: - mutex_unlock(&priv->mutex); + mutex_unlock(&il->mutex); } /* @@ -2526,32 +2526,32 @@ out: */ static void il3945_rfkill_poll(struct work_struct *data) { - struct il_priv *priv = + struct il_priv *il = container_of(data, struct il_priv, _3945.rfkill_poll.work); - bool old_rfkill = test_bit(STATUS_RF_KILL_HW, &priv->status); - bool new_rfkill = !(il_read32(priv, CSR_GP_CNTRL) + bool old_rfkill = test_bit(STATUS_RF_KILL_HW, &il->status); + bool new_rfkill = !(il_read32(il, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW); if (new_rfkill != old_rfkill) { if (new_rfkill) - set_bit(STATUS_RF_KILL_HW, &priv->status); + set_bit(STATUS_RF_KILL_HW, &il->status); else - clear_bit(STATUS_RF_KILL_HW, &priv->status); + clear_bit(STATUS_RF_KILL_HW, &il->status); - wiphy_rfkill_set_hw_state(priv->hw->wiphy, new_rfkill); + wiphy_rfkill_set_hw_state(il->hw->wiphy, new_rfkill); - IL_DEBUG_RF_KILL(priv, "RF_KILL bit toggled to %s.\n", + IL_DEBUG_RF_KILL(il, "RF_KILL bit toggled to %s.\n", new_rfkill ? "disable radio" : "enable radio"); } /* Keep this running, even if radio now enabled. This will be * cancelled in mac_start() if system decides to start again */ - queue_delayed_work(priv->workqueue, &priv->_3945.rfkill_poll, + queue_delayed_work(il->workqueue, &il->_3945.rfkill_poll, round_jiffies_relative(2 * HZ)); } -int il3945_request_scan(struct il_priv *priv, struct ieee80211_vif *vif) +int il3945_request_scan(struct il_priv *il, struct ieee80211_vif *vif) { struct il_host_cmd cmd = { .id = REPLY_SCAN_CMD, @@ -2565,29 +2565,29 @@ int il3945_request_scan(struct il_priv *priv, struct ieee80211_vif *vif) int ret; u16 len; - lockdep_assert_held(&priv->mutex); + lockdep_assert_held(&il->mutex); - if (!priv->scan_cmd) { - priv->scan_cmd = kmalloc(sizeof(struct il3945_scan_cmd) + + if (!il->scan_cmd) { + il->scan_cmd = kmalloc(sizeof(struct il3945_scan_cmd) + IL_MAX_SCAN_SIZE, GFP_KERNEL); - if (!priv->scan_cmd) { - IL_DEBUG_SCAN(priv, "Fail to allocate scan memory\n"); + if (!il->scan_cmd) { + IL_DEBUG_SCAN(il, "Fail to allocate scan memory\n"); return -ENOMEM; } } - scan = priv->scan_cmd; + scan = il->scan_cmd; memset(scan, 0, sizeof(struct il3945_scan_cmd) + IL_MAX_SCAN_SIZE); scan->quiet_plcp_th = IL_PLCP_QUIET_THRESH; scan->quiet_time = IL_ACTIVE_QUIET_TIME; - if (il_is_associated(priv, IL_RXON_CTX_BSS)) { + if (il_is_associated(il, IL_RXON_CTX_BSS)) { 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; @@ -2607,39 +2607,39 @@ int il3945_request_scan(struct il_priv *priv, struct ieee80211_vif *vif) (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, "Kicking off passive scan.\n"); + IL_DEBUG_SCAN(il, "Kicking off passive scan.\n"); /* We don't build a direct scan probe request; the uCode will do * that based on the direct_mask added to each channel entry */ scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; - scan->tx_cmd.sta_id = priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id; + scan->tx_cmd.sta_id = il->contexts[IL_RXON_CTX_BSS].bcast_sta_id; scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; /* flags + rate selection */ - switch (priv->scan_band) { + switch (il->scan_band) { case IEEE80211_BAND_2GHZ: scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; scan->tx_cmd.rate = IL_RATE_1M_PLCP; @@ -2650,7 +2650,7 @@ int il3945_request_scan(struct il_priv *priv, struct ieee80211_vif *vif) band = IEEE80211_BAND_5GHZ; break; default: - IL_WARN(priv, "Invalid scan band\n"); + IL_WARN(il, "Invalid scan band\n"); return -EIO; } @@ -2662,19 +2662,19 @@ int il3945_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_DISABLED; - len = il_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data, - vif->addr, priv->scan_request->ie, - priv->scan_request->ie_len, + len = il_fill_probe_req(il, (struct ieee80211_mgmt *)scan->data, + vif->addr, il->scan_request->ie, + il->scan_request->ie_len, IL_MAX_SCAN_SIZE - sizeof(*scan)); scan->tx_cmd.len = cpu_to_le16(len); /* select Rx antennas */ - scan->flags |= il3945_get_antenna_flags(priv); + scan->flags |= il3945_get_antenna_flags(il); - scan->channel_count = il3945_get_channels_for_scan(priv, band, is_active, n_probes, + scan->channel_count = il3945_get_channels_for_scan(il, band, is_active, n_probes, (void *)&scan->data[len], vif); 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; } @@ -2683,101 +2683,101 @@ int il3945_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); - ret = il_send_cmd_sync(priv, &cmd); + set_bit(STATUS_SCAN_HW, &il->status); + 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; } -void il3945_post_scan(struct il_priv *priv) +void il3945_post_scan(struct il_priv *il) { - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; /* * Since setting the RXON may have been deferred while * performing the scan, fire one off if needed */ if (memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging))) - il3945_commit_rxon(priv, ctx); + il3945_commit_rxon(il, ctx); } static void il3945_bg_restart(struct work_struct *data) { - struct il_priv *priv = container_of(data, struct il_priv, restart); + struct il_priv *il = container_of(data, struct il_priv, restart); - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) + if (test_bit(STATUS_EXIT_PENDING, &il->status)) return; - if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) { + if (test_and_clear_bit(STATUS_FW_ERROR, &il->status)) { struct il_rxon_context *ctx; - mutex_lock(&priv->mutex); - for_each_context(priv, ctx) + mutex_lock(&il->mutex); + for_each_context(il, ctx) ctx->vif = NULL; - priv->is_open = 0; - mutex_unlock(&priv->mutex); - il3945_down(priv); - ieee80211_restart_hw(priv->hw); + il->is_open = 0; + mutex_unlock(&il->mutex); + il3945_down(il); + ieee80211_restart_hw(il->hw); } else { - il3945_down(priv); + il3945_down(il); - mutex_lock(&priv->mutex); - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { - mutex_unlock(&priv->mutex); + mutex_lock(&il->mutex); + if (test_bit(STATUS_EXIT_PENDING, &il->status)) { + mutex_unlock(&il->mutex); return; } - __il3945_up(priv); - mutex_unlock(&priv->mutex); + __il3945_up(il); + mutex_unlock(&il->mutex); } } static void il3945_bg_rx_replenish(struct work_struct *data) { - struct il_priv *priv = + struct il_priv *il = container_of(data, struct il_priv, rx_replenish); - mutex_lock(&priv->mutex); - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) + mutex_lock(&il->mutex); + if (test_bit(STATUS_EXIT_PENDING, &il->status)) goto out; - il3945_rx_replenish(priv); + il3945_rx_replenish(il); out: - mutex_unlock(&priv->mutex); + mutex_unlock(&il->mutex); } -void il3945_post_associate(struct il_priv *priv) +void il3945_post_associate(struct il_priv *il) { int rc = 0; struct ieee80211_conf *conf = NULL; - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; - if (!ctx->vif || !priv->is_open) + if (!ctx->vif || !il->is_open) return; - IL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", + IL_DEBUG_ASSOC(il, "Associated as %d to: %pM\n", ctx->vif->bss_conf.aid, ctx->active.bssid_addr); - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) + if (test_bit(STATUS_EXIT_PENDING, &il->status)) return; - il_scan_cancel_timeout(priv, 200); + il_scan_cancel_timeout(il, 200); - conf = il_ieee80211_get_hw_conf(priv->hw); + conf = il_ieee80211_get_hw_conf(il->hw); ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - il3945_commit_rxon(priv, ctx); + il3945_commit_rxon(il, ctx); - rc = il_send_rxon_timing(priv, ctx); + rc = il_send_rxon_timing(il, ctx); if (rc) - IL_WARN(priv, "REPLY_RXON_TIMING failed - " + IL_WARN(il, "REPLY_RXON_TIMING failed - " "Attempting to continue.\n"); ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; ctx->staging.assoc_id = cpu_to_le16(ctx->vif->bss_conf.aid); - IL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", + IL_DEBUG_ASSOC(il, "assoc id %d beacon interval %d\n", ctx->vif->bss_conf.aid, ctx->vif->bss_conf.beacon_int); if (ctx->vif->bss_conf.use_short_preamble) @@ -2792,17 +2792,17 @@ void il3945_post_associate(struct il_priv *priv) ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; } - il3945_commit_rxon(priv, ctx); + il3945_commit_rxon(il, ctx); switch (ctx->vif->type) { case NL80211_IFTYPE_STATION: - il3945_rate_scale_init(priv->hw, IL_AP_ID); + il3945_rate_scale_init(il->hw, IL_AP_ID); break; case NL80211_IFTYPE_ADHOC: - il3945_send_beacon_cmd(priv); + il3945_send_beacon_cmd(il); break; default: - IL_ERR(priv, "%s Should not be called in %d mode\n", + IL_ERR(il, "%s Should not be called in %d mode\n", __func__, ctx->vif->type); break; } @@ -2818,43 +2818,43 @@ void il3945_post_associate(struct il_priv *priv) static int il3945_mac_start(struct ieee80211_hw *hw) { - 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"); /* we should be verifying the device is ready to be opened */ - mutex_lock(&priv->mutex); + mutex_lock(&il->mutex); /* fetch ucode file from disk, alloc and copy to bus-master buffers ... * ucode filename and max sizes are card-specific. */ - if (!priv->ucode_code.len) { - ret = il3945_read_ucode(priv); + if (!il->ucode_code.len) { + ret = il3945_read_ucode(il); if (ret) { - IL_ERR(priv, "Could not read microcode: %d\n", ret); - mutex_unlock(&priv->mutex); + IL_ERR(il, "Could not read microcode: %d\n", ret); + mutex_unlock(&il->mutex); goto out_release_irq; } } - ret = __il3945_up(priv); + ret = __il3945_up(il); - mutex_unlock(&priv->mutex); + mutex_unlock(&il->mutex); if (ret) goto out_release_irq; - IL_DEBUG_INFO(priv, "Start UP work.\n"); + IL_DEBUG_INFO(il, "Start UP work.\n"); /* Wait for START_ALIVE from ucode. Otherwise callbacks from * mac80211 will not be run successfully. */ - ret = wait_event_timeout(priv->wait_command_queue, - test_bit(STATUS_READY, &priv->status), + ret = wait_event_timeout(il->wait_command_queue, + test_bit(STATUS_READY, &il->status), UCODE_READY_TIMEOUT); if (!ret) { - if (!test_bit(STATUS_READY, &priv->status)) { - IL_ERR(priv, + if (!test_bit(STATUS_READY, &il->status)) { + IL_ERR(il, "Wait for START_ALIVE timeout after %dms.\n", jiffies_to_msecs(UCODE_READY_TIMEOUT)); ret = -ETIMEDOUT; @@ -2864,77 +2864,77 @@ static int il3945_mac_start(struct ieee80211_hw *hw) /* ucode is running and will send rfkill notifications, * no need to poll the killswitch state anymore */ - cancel_delayed_work(&priv->_3945.rfkill_poll); + cancel_delayed_work(&il->_3945.rfkill_poll); - priv->is_open = 1; - IL_DEBUG_MAC80211(priv, "leave\n"); + il->is_open = 1; + IL_DEBUG_MAC80211(il, "leave\n"); return 0; out_release_irq: - priv->is_open = 0; - IL_DEBUG_MAC80211(priv, "leave - failed\n"); + il->is_open = 0; + IL_DEBUG_MAC80211(il, "leave - failed\n"); return ret; } static void il3945_mac_stop(struct ieee80211_hw *hw) { - struct il_priv *priv = hw->priv; + struct il_priv *il = hw->priv; - IL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(il, "enter\n"); - if (!priv->is_open) { - IL_DEBUG_MAC80211(priv, "leave - skip\n"); + if (!il->is_open) { + IL_DEBUG_MAC80211(il, "leave - skip\n"); return; } - priv->is_open = 0; + il->is_open = 0; - il3945_down(priv); + il3945_down(il); - flush_workqueue(priv->workqueue); + flush_workqueue(il->workqueue); /* start polling the killswitch state again */ - queue_delayed_work(priv->workqueue, &priv->_3945.rfkill_poll, + queue_delayed_work(il->workqueue, &il->_3945.rfkill_poll, round_jiffies_relative(2 * HZ)); - IL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(il, "leave\n"); } static void il3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) { - struct il_priv *priv = hw->priv; + struct il_priv *il = hw->priv; - IL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(il, "enter\n"); - IL_DEBUG_TX(priv, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, + IL_DEBUG_TX(il, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); - if (il3945_tx_skb(priv, skb)) + if (il3945_tx_skb(il, skb)) dev_kfree_skb_any(skb); - IL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(il, "leave\n"); } -void il3945_config_ap(struct il_priv *priv) +void il3945_config_ap(struct il_priv *il) { - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; struct ieee80211_vif *vif = ctx->vif; int rc = 0; - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) + if (test_bit(STATUS_EXIT_PENDING, &il->status)) return; /* The following should be done only at AP bring up */ - if (!(il_is_associated(priv, IL_RXON_CTX_BSS))) { + if (!(il_is_associated(il, IL_RXON_CTX_BSS))) { /* RXON - unassoc (to set timing command) */ ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - il3945_commit_rxon(priv, ctx); + il3945_commit_rxon(il, ctx); /* RXON Timing */ - rc = il_send_rxon_timing(priv, ctx); + rc = il_send_rxon_timing(il, ctx); if (rc) - IL_WARN(priv, "REPLY_RXON_TIMING failed - " + IL_WARN(il, "REPLY_RXON_TIMING failed - " "Attempting to continue.\n"); ctx->staging.assoc_id = 0; @@ -2956,9 +2956,9 @@ void il3945_config_ap(struct il_priv *priv) } /* restore RXON assoc */ ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; - il3945_commit_rxon(priv, ctx); + il3945_commit_rxon(il, ctx); } - il3945_send_beacon_cmd(priv); + il3945_send_beacon_cmd(il); } static int il3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, @@ -2966,15 +2966,15 @@ static int il3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, struct ieee80211_sta *sta, struct ieee80211_key_conf *key) { - struct il_priv *priv = hw->priv; + struct il_priv *il = hw->priv; int ret = 0; u8 sta_id = IL_INVALID_STATION; u8 static_key; - IL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(il, "enter\n"); if (il3945_mod_params.sw_crypto) { - IL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n"); + IL_DEBUG_MAC80211(il, "leave - hwcrypto disabled\n"); return -EOPNOTSUPP; } @@ -2986,39 +2986,39 @@ static int il3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) return -EOPNOTSUPP; - static_key = !il_is_associated(priv, IL_RXON_CTX_BSS); + static_key = !il_is_associated(il, IL_RXON_CTX_BSS); if (!static_key) { sta_id = il_sta_id_or_broadcast( - priv, &priv->contexts[IL_RXON_CTX_BSS], sta); + il, &il->contexts[IL_RXON_CTX_BSS], sta); if (sta_id == IL_INVALID_STATION) return -EINVAL; } - mutex_lock(&priv->mutex); - il_scan_cancel_timeout(priv, 100); + mutex_lock(&il->mutex); + il_scan_cancel_timeout(il, 100); switch (cmd) { case SET_KEY: if (static_key) - ret = il3945_set_static_key(priv, key); + ret = il3945_set_static_key(il, key); else - ret = il3945_set_dynamic_key(priv, key, sta_id); - IL_DEBUG_MAC80211(priv, "enable hwcrypto key\n"); + ret = il3945_set_dynamic_key(il, key, sta_id); + IL_DEBUG_MAC80211(il, "enable hwcrypto key\n"); break; case DISABLE_KEY: if (static_key) - ret = il3945_remove_static_key(priv); + ret = il3945_remove_static_key(il); else - ret = il3945_clear_sta_key_info(priv, sta_id); - IL_DEBUG_MAC80211(priv, "disable hwcrypto key\n"); + ret = il3945_clear_sta_key_info(il, sta_id); + IL_DEBUG_MAC80211(il, "disable hwcrypto key\n"); break; default: ret = -EINVAL; } - mutex_unlock(&priv->mutex); - IL_DEBUG_MAC80211(priv, "leave\n"); + mutex_unlock(&il->mutex); + IL_DEBUG_MAC80211(il, "leave\n"); return ret; } @@ -3027,38 +3027,38 @@ static int il3945_mac_sta_add(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 il3945_sta_priv *sta_priv = (void *)sta->drv_priv; int ret; bool is_ap = vif->type == NL80211_IFTYPE_STATION; u8 sta_id; - IL_DEBUG_INFO(priv, "received request to add station %pM\n", + IL_DEBUG_INFO(il, "received request to add station %pM\n", sta->addr); - mutex_lock(&priv->mutex); - IL_DEBUG_INFO(priv, "proceeding to add station %pM\n", + mutex_lock(&il->mutex); + IL_DEBUG_INFO(il, "proceeding to add station %pM\n", sta->addr); sta_priv->common.sta_id = IL_INVALID_STATION; - ret = il_add_station_common(priv, - &priv->contexts[IL_RXON_CTX_BSS], + ret = il_add_station_common(il, + &il->contexts[IL_RXON_CTX_BSS], sta->addr, is_ap, sta, &sta_id); if (ret) { - IL_ERR(priv, "Unable to add station %pM (%d)\n", + IL_ERR(il, "Unable to add station %pM (%d)\n", sta->addr, ret); /* Should we return success if return code is EEXIST ? */ - mutex_unlock(&priv->mutex); + mutex_unlock(&il->mutex); return ret; } sta_priv->common.sta_id = sta_id; /* Initialize rate scaling */ - IL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", + IL_DEBUG_INFO(il, "Initializing rate scaling for station %pM\n", sta->addr); - il3945_rs_rate_init(priv, sta, sta_id); - mutex_unlock(&priv->mutex); + il3945_rs_rate_init(il, sta, sta_id); + mutex_unlock(&il->mutex); return 0; } @@ -3068,9 +3068,9 @@ static void il3945_configure_filter(struct ieee80211_hw *hw, unsigned int *total_flags, u64 multicast) { - struct il_priv *priv = hw->priv; + struct il_priv *il = hw->priv; __le32 filter_or = 0, filter_nand = 0; - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; #define CHK(test, flag) do { \ if (*total_flags & (test)) \ @@ -3079,7 +3079,7 @@ static void il3945_configure_filter(struct ieee80211_hw *hw, filter_nand |= (flag); \ } while (0) - IL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", + IL_DEBUG_MAC80211(il, "Enter: changed: 0x%x, total: 0x%x\n", changed_flags, *total_flags); CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); @@ -3088,7 +3088,7 @@ static void il3945_configure_filter(struct ieee80211_hw *hw, #undef CHK - mutex_lock(&priv->mutex); + mutex_lock(&il->mutex); ctx->staging.filter_flags &= ~filter_nand; ctx->staging.filter_flags |= filter_or; @@ -3099,7 +3099,7 @@ static void il3945_configure_filter(struct ieee80211_hw *hw, * we'll eventually commit the filter flags change anyway. */ - mutex_unlock(&priv->mutex); + mutex_unlock(&il->mutex); /* * Receiving all multicast frames is always enabled by the @@ -3134,24 +3134,24 @@ static void il3945_configure_filter(struct ieee80211_hw *hw, static ssize_t il3945_show_debug_level(struct device *d, struct device_attribute *attr, char *buf) { - struct il_priv *priv = dev_get_drvdata(d); - return sprintf(buf, "0x%08X\n", il_get_debug_level(priv)); + struct il_priv *il = dev_get_drvdata(d); + return sprintf(buf, "0x%08X\n", il_get_debug_level(il)); } static ssize_t il3945_store_debug_level(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct il_priv *priv = dev_get_drvdata(d); + struct il_priv *il = dev_get_drvdata(d); unsigned long val; int ret; ret = strict_strtoul(buf, 0, &val); if (ret) - IL_INFO(priv, "%s is not in hex or decimal form.\n", buf); + IL_INFO(il, "%s is not in hex or decimal form.\n", buf); else { - priv->debug_level = val; - if (il_alloc_traffic_mem(priv)) - IL_ERR(priv, + il->debug_level = val; + if (il_alloc_traffic_mem(il)) + IL_ERR(il, "Not enough memory to generate traffic log\n"); } return strnlen(buf, count); @@ -3165,12 +3165,12 @@ static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO, static ssize_t il3945_show_temperature(struct device *d, struct device_attribute *attr, char *buf) { - struct il_priv *priv = dev_get_drvdata(d); + struct il_priv *il = dev_get_drvdata(d); - if (!il_is_alive(priv)) + if (!il_is_alive(il)) return -EAGAIN; - return sprintf(buf, "%d\n", il3945_hw_get_temperature(priv)); + return sprintf(buf, "%d\n", il3945_hw_get_temperature(il)); } static DEVICE_ATTR(temperature, S_IRUGO, il3945_show_temperature, NULL); @@ -3178,23 +3178,23 @@ static DEVICE_ATTR(temperature, S_IRUGO, il3945_show_temperature, NULL); static ssize_t il3945_show_tx_power(struct device *d, struct device_attribute *attr, char *buf) { - struct il_priv *priv = dev_get_drvdata(d); - return sprintf(buf, "%d\n", priv->tx_power_user_lmt); + struct il_priv *il = dev_get_drvdata(d); + return sprintf(buf, "%d\n", il->tx_power_user_lmt); } static ssize_t il3945_store_tx_power(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct il_priv *priv = dev_get_drvdata(d); + struct il_priv *il = dev_get_drvdata(d); char *p = (char *)buf; u32 val; val = simple_strtoul(p, &p, 10); if (p == buf) - IL_INFO(priv, ": %s is not in decimal form.\n", buf); + IL_INFO(il, ": %s is not in decimal form.\n", buf); else - il3945_hw_reg_set_txpower(priv, val); + il3945_hw_reg_set_txpower(il, val); return count; } @@ -3204,8 +3204,8 @@ static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, il3945_show_tx_power, il3945_sto static ssize_t il3945_show_flags(struct device *d, struct device_attribute *attr, char *buf) { - struct il_priv *priv = dev_get_drvdata(d); - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_priv *il = dev_get_drvdata(d); + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; return sprintf(buf, "0x%04X\n", ctx->active.flags); } @@ -3214,23 +3214,23 @@ static ssize_t il3945_store_flags(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct il_priv *priv = dev_get_drvdata(d); + struct il_priv *il = dev_get_drvdata(d); u32 flags = simple_strtoul(buf, NULL, 0); - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; - mutex_lock(&priv->mutex); + mutex_lock(&il->mutex); if (le32_to_cpu(ctx->staging.flags) != flags) { /* Cancel any currently running scans... */ - if (il_scan_cancel_timeout(priv, 100)) - IL_WARN(priv, "Could not cancel scan.\n"); + if (il_scan_cancel_timeout(il, 100)) + IL_WARN(il, "Could not cancel scan.\n"); else { - IL_DEBUG_INFO(priv, "Committing rxon.flags = 0x%04X\n", + IL_DEBUG_INFO(il, "Committing rxon.flags = 0x%04X\n", flags); ctx->staging.flags = cpu_to_le32(flags); - il3945_commit_rxon(priv, ctx); + il3945_commit_rxon(il, ctx); } } - mutex_unlock(&priv->mutex); + mutex_unlock(&il->mutex); return count; } @@ -3240,8 +3240,8 @@ static DEVICE_ATTR(flags, S_IWUSR | S_IRUGO, il3945_show_flags, il3945_store_fla static ssize_t il3945_show_filter_flags(struct device *d, struct device_attribute *attr, char *buf) { - struct il_priv *priv = dev_get_drvdata(d); - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_priv *il = dev_get_drvdata(d); + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; return sprintf(buf, "0x%04X\n", le32_to_cpu(ctx->active.filter_flags)); @@ -3251,24 +3251,24 @@ static ssize_t il3945_store_filter_flags(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct il_priv *priv = dev_get_drvdata(d); - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_priv *il = dev_get_drvdata(d); + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; u32 filter_flags = simple_strtoul(buf, NULL, 0); - mutex_lock(&priv->mutex); + mutex_lock(&il->mutex); if (le32_to_cpu(ctx->staging.filter_flags) != filter_flags) { /* Cancel any currently running scans... */ - if (il_scan_cancel_timeout(priv, 100)) - IL_WARN(priv, "Could not cancel scan.\n"); + if (il_scan_cancel_timeout(il, 100)) + IL_WARN(il, "Could not cancel scan.\n"); else { - IL_DEBUG_INFO(priv, "Committing rxon.filter_flags = " + IL_DEBUG_INFO(il, "Committing rxon.filter_flags = " "0x%04X\n", filter_flags); ctx->staging.filter_flags = cpu_to_le32(filter_flags); - il3945_commit_rxon(priv, ctx); + il3945_commit_rxon(il, ctx); } } - mutex_unlock(&priv->mutex); + mutex_unlock(&il->mutex); return count; } @@ -3279,20 +3279,20 @@ static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, il3945_show_filter_flags, static ssize_t il3945_show_measurement(struct device *d, struct device_attribute *attr, char *buf) { - struct il_priv *priv = dev_get_drvdata(d); + struct il_priv *il = dev_get_drvdata(d); struct il_spectrum_notification measure_report; u32 size = sizeof(measure_report), len = 0, ofs = 0; u8 *data = (u8 *)&measure_report; unsigned long flags; - spin_lock_irqsave(&priv->lock, flags); - if (!(priv->measurement_status & MEASUREMENT_READY)) { - spin_unlock_irqrestore(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); + if (!(il->measurement_status & MEASUREMENT_READY)) { + spin_unlock_irqrestore(&il->lock, flags); return 0; } - memcpy(&measure_report, &priv->measure_report, size); - priv->measurement_status = 0; - spin_unlock_irqrestore(&priv->lock, flags); + memcpy(&measure_report, &il->measure_report, size); + il->measurement_status = 0; + spin_unlock_irqrestore(&il->lock, flags); while (size && (PAGE_SIZE - len)) { hex_dump_to_buffer(data + ofs, size, 16, 1, buf + len, @@ -3312,11 +3312,11 @@ static ssize_t il3945_store_measurement(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct il_priv *priv = dev_get_drvdata(d); - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_priv *il = dev_get_drvdata(d); + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; struct ieee80211_measurement_params params = { .channel = le16_to_cpu(ctx->active.channel), - .start_time = cpu_to_le64(priv->_3945.last_tsf), + .start_time = cpu_to_le64(il->_3945.last_tsf), .duration = cpu_to_le16(1), }; u8 type = IL_MEASURE_BASIC; @@ -3337,9 +3337,9 @@ static ssize_t il3945_store_measurement(struct device *d, type = simple_strtoul(p + 1, NULL, 0); } - IL_DEBUG_INFO(priv, "Invoking measurement of type %d on " + IL_DEBUG_INFO(il, "Invoking measurement of type %d on " "channel %d (for '%s')\n", type, params.channel, buf); - il3945_get_measurement(priv, ¶ms, type); + il3945_get_measurement(il, ¶ms, type); return count; } @@ -3351,11 +3351,11 @@ static ssize_t il3945_store_retry_rate(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct il_priv *priv = dev_get_drvdata(d); + struct il_priv *il = dev_get_drvdata(d); - priv->retry_rate = simple_strtoul(buf, NULL, 0); - if (priv->retry_rate <= 0) - priv->retry_rate = 1; + il->retry_rate = simple_strtoul(buf, NULL, 0); + if (il->retry_rate <= 0) + il->retry_rate = 1; return count; } @@ -3363,8 +3363,8 @@ static ssize_t il3945_store_retry_rate(struct device *d, static ssize_t il3945_show_retry_rate(struct device *d, struct device_attribute *attr, char *buf) { - struct il_priv *priv = dev_get_drvdata(d); - return sprintf(buf, "%d", priv->retry_rate); + struct il_priv *il = dev_get_drvdata(d); + return sprintf(buf, "%d", il->retry_rate); } static DEVICE_ATTR(retry_rate, S_IWUSR | S_IRUSR, il3945_show_retry_rate, @@ -3383,9 +3383,9 @@ static DEVICE_ATTR(channels, S_IRUSR, il3945_show_channels, NULL); static ssize_t il3945_show_antenna(struct device *d, struct device_attribute *attr, char *buf) { - struct il_priv *priv = dev_get_drvdata(d); + struct il_priv *il = dev_get_drvdata(d); - if (!il_is_alive(priv)) + if (!il_is_alive(il)) return -EAGAIN; return sprintf(buf, "%d\n", il3945_mod_params.antenna); @@ -3395,22 +3395,22 @@ static ssize_t il3945_store_antenna(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct il_priv *priv __maybe_unused = dev_get_drvdata(d); + struct il_priv *il __maybe_unused = dev_get_drvdata(d); int ant; if (count == 0) return 0; if (sscanf(buf, "%1i", &ant) != 1) { - IL_DEBUG_INFO(priv, "not in hex or decimal form.\n"); + IL_DEBUG_INFO(il, "not in hex or decimal form.\n"); return count; } if ((ant >= 0) && (ant <= 2)) { - IL_DEBUG_INFO(priv, "Setting antenna select to %d.\n", ant); + IL_DEBUG_INFO(il, "Setting antenna select to %d.\n", ant); il3945_mod_params.antenna = (enum il3945_antenna)ant; } else - IL_DEBUG_INFO(priv, "Bad antenna select value %d.\n", ant); + IL_DEBUG_INFO(il, "Bad antenna select value %d.\n", ant); return count; @@ -3421,10 +3421,10 @@ static DEVICE_ATTR(antenna, S_IWUSR | S_IRUGO, il3945_show_antenna, il3945_store static ssize_t il3945_show_status(struct device *d, struct device_attribute *attr, char *buf) { - struct il_priv *priv = dev_get_drvdata(d); - if (!il_is_alive(priv)) + struct il_priv *il = dev_get_drvdata(d); + if (!il_is_alive(il)) return -EAGAIN; - return sprintf(buf, "0x%08x\n", (int)priv->status); + return sprintf(buf, "0x%08x\n", (int)il->status); } static DEVICE_ATTR(status, S_IRUGO, il3945_show_status, NULL); @@ -3433,11 +3433,11 @@ static ssize_t il3945_dump_error_log(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct il_priv *priv = dev_get_drvdata(d); + struct il_priv *il = dev_get_drvdata(d); char *p = (char *)buf; if (p[0] == '1') - il3945_dump_nic_error_log(priv); + il3945_dump_nic_error_log(il); return strnlen(buf, count); } @@ -3450,38 +3450,38 @@ static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, il3945_dump_error_log); * *****************************************************************************/ -static void il3945_setup_deferred_work(struct il_priv *priv) +static void il3945_setup_deferred_work(struct il_priv *il) { - priv->workqueue = create_singlethread_workqueue(DRV_NAME); + il->workqueue = create_singlethread_workqueue(DRV_NAME); - init_waitqueue_head(&priv->wait_command_queue); + init_waitqueue_head(&il->wait_command_queue); - INIT_WORK(&priv->restart, il3945_bg_restart); - INIT_WORK(&priv->rx_replenish, il3945_bg_rx_replenish); - INIT_DELAYED_WORK(&priv->init_alive_start, il3945_bg_init_alive_start); - INIT_DELAYED_WORK(&priv->alive_start, il3945_bg_alive_start); - INIT_DELAYED_WORK(&priv->_3945.rfkill_poll, il3945_rfkill_poll); + INIT_WORK(&il->restart, il3945_bg_restart); + INIT_WORK(&il->rx_replenish, il3945_bg_rx_replenish); + INIT_DELAYED_WORK(&il->init_alive_start, il3945_bg_init_alive_start); + INIT_DELAYED_WORK(&il->alive_start, il3945_bg_alive_start); + INIT_DELAYED_WORK(&il->_3945.rfkill_poll, il3945_rfkill_poll); - il_setup_scan_deferred_work(priv); + il_setup_scan_deferred_work(il); - il3945_hw_setup_deferred_work(priv); + il3945_hw_setup_deferred_work(il); - init_timer(&priv->watchdog); - priv->watchdog.data = (unsigned long)priv; - priv->watchdog.function = il_bg_watchdog; + init_timer(&il->watchdog); + il->watchdog.data = (unsigned long)il; + il->watchdog.function = il_bg_watchdog; - tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) - il3945_irq_tasklet, (unsigned long)priv); + tasklet_init(&il->irq_tasklet, (void (*)(unsigned long)) + il3945_irq_tasklet, (unsigned long)il); } -static void il3945_cancel_deferred_work(struct il_priv *priv) +static void il3945_cancel_deferred_work(struct il_priv *il) { - il3945_hw_cancel_deferred_work(priv); + il3945_hw_cancel_deferred_work(il); - cancel_delayed_work_sync(&priv->init_alive_start); - cancel_delayed_work(&priv->alive_start); + cancel_delayed_work_sync(&il->init_alive_start); + cancel_delayed_work(&il->alive_start); - il_cancel_scan_deferred_work(priv); + il_cancel_scan_deferred_work(il); } static struct attribute *il3945_sysfs_entries[] = { @@ -3525,70 +3525,70 @@ struct ieee80211_ops il3945_hw_ops = { .tx_last_beacon = il_mac_tx_last_beacon, }; -static int il3945_init_drv(struct il_priv *priv) +static int il3945_init_drv(struct il_priv *il) { int ret; - struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; + struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; - priv->retry_rate = 1; - priv->beacon_skb = NULL; + il->retry_rate = 1; + il->beacon_skb = NULL; - spin_lock_init(&priv->sta_lock); - spin_lock_init(&priv->hcmd_lock); + spin_lock_init(&il->sta_lock); + spin_lock_init(&il->hcmd_lock); - INIT_LIST_HEAD(&priv->free_frames); + INIT_LIST_HEAD(&il->free_frames); - mutex_init(&priv->mutex); + mutex_init(&il->mutex); - priv->ieee_channels = NULL; - priv->ieee_rates = NULL; - priv->band = IEEE80211_BAND_2GHZ; + il->ieee_channels = NULL; + il->ieee_rates = NULL; + il->band = IEEE80211_BAND_2GHZ; - priv->iw_mode = NL80211_IFTYPE_STATION; - priv->missed_beacon_threshold = IL_MISSED_BEACON_THRESHOLD_DEF; + il->iw_mode = NL80211_IFTYPE_STATION; + il->missed_beacon_threshold = IL_MISSED_BEACON_THRESHOLD_DEF; /* initialize force reset */ - priv->force_reset.reset_duration = IL_DELAY_NEXT_FORCE_FW_RELOAD; + il->force_reset.reset_duration = IL_DELAY_NEXT_FORCE_FW_RELOAD; if (eeprom->version < EEPROM_3945_EEPROM_VERSION) { - IL_WARN(priv, "Unsupported EEPROM version: 0x%04X\n", + IL_WARN(il, "Unsupported EEPROM version: 0x%04X\n", eeprom->version); ret = -EINVAL; goto err; } - ret = il_init_channel_map(priv); + ret = il_init_channel_map(il); if (ret) { - IL_ERR(priv, "initializing regulatory failed: %d\n", ret); + IL_ERR(il, "initializing regulatory failed: %d\n", ret); goto err; } /* Set up txpower settings in driver for all channels */ - if (il3945_txpower_set_from_eeprom(priv)) { + if (il3945_txpower_set_from_eeprom(il)) { ret = -EIO; goto err_free_channel_map; } - ret = il_init_geos(priv); + ret = il_init_geos(il); if (ret) { - IL_ERR(priv, "initializing geos failed: %d\n", ret); + IL_ERR(il, "initializing geos failed: %d\n", ret); goto err_free_channel_map; } - il3945_init_hw_rates(priv, priv->ieee_rates); + il3945_init_hw_rates(il, il->ieee_rates); return 0; err_free_channel_map: - il_free_channel_map(priv); + il_free_channel_map(il); err: return ret; } #define IWL3945_MAX_PROBE_REQUEST 200 -static int il3945_setup_mac(struct il_priv *priv) +static int il3945_setup_mac(struct il_priv *il) { int ret; - struct ieee80211_hw *hw = priv->hw; + struct ieee80211_hw *hw = il->hw; hw->rate_control_algorithm = "iwl-3945-rs"; hw->sta_data_size = sizeof(struct il3945_sta_priv); @@ -3599,7 +3599,7 @@ static int il3945_setup_mac(struct il_priv *priv) IEEE80211_HW_SPECTRUM_MGMT; hw->wiphy->interface_modes = - priv->contexts[IL_RXON_CTX_BSS].interface_modes; + il->contexts[IL_RXON_CTX_BSS].interface_modes; hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | WIPHY_FLAG_DISABLE_BEACON_HINTS | @@ -3612,22 +3612,22 @@ static int il3945_setup_mac(struct il_priv *priv) /* Default value; 4 EDCA QOS priorities */ hw->queues = 4; - if (priv->bands[IEEE80211_BAND_2GHZ].n_channels) - priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = - &priv->bands[IEEE80211_BAND_2GHZ]; + if (il->bands[IEEE80211_BAND_2GHZ].n_channels) + il->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = + &il->bands[IEEE80211_BAND_2GHZ]; - if (priv->bands[IEEE80211_BAND_5GHZ].n_channels) - priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = - &priv->bands[IEEE80211_BAND_5GHZ]; + if (il->bands[IEEE80211_BAND_5GHZ].n_channels) + il->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = + &il->bands[IEEE80211_BAND_5GHZ]; - il_leds_init(priv); + il_leds_init(il); - ret = ieee80211_register_hw(priv->hw); + ret = ieee80211_register_hw(il->hw); if (ret) { - IL_ERR(priv, "Failed to register hw (error %d)\n", ret); + IL_ERR(il, "Failed to register hw (error %d)\n", ret); return ret; } - priv->mac80211_registered = 1; + il->mac80211_registered = 1; return 0; } @@ -3635,7 +3635,7 @@ static int il3945_setup_mac(struct il_priv *priv) static int il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { int err = 0, i; - struct il_priv *priv; + struct il_priv *il; struct ieee80211_hw *hw; struct il_cfg *cfg = (struct il_cfg *)(ent->driver_data); struct il3945_eeprom *eeprom; @@ -3646,53 +3646,53 @@ static int il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *en * ********************/ /* mac80211 allocates memory for this device instance, including - * space for this driver's private structure */ + * space for this driver's ilate structure */ hw = il_alloc_all(cfg); if (hw == NULL) { pr_err("Can not allocate network device\n"); err = -ENOMEM; goto out; } - priv = hw->priv; + il = hw->priv; SET_IEEE80211_DEV(hw, &pdev->dev); - priv->cmd_queue = IWL39_CMD_QUEUE_NUM; + il->cmd_queue = IWL39_CMD_QUEUE_NUM; /* 3945 has only one valid context */ - priv->valid_contexts = BIT(IL_RXON_CTX_BSS); + il->valid_contexts = BIT(IL_RXON_CTX_BSS); for (i = 0; i < NUM_IL_RXON_CTX; i++) - priv->contexts[i].ctxid = i; - - priv->contexts[IL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON; - priv->contexts[IL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING; - priv->contexts[IL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC; - priv->contexts[IL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM; - priv->contexts[IL_RXON_CTX_BSS].ap_sta_id = IL_AP_ID; - priv->contexts[IL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY; - priv->contexts[IL_RXON_CTX_BSS].interface_modes = + il->contexts[i].ctxid = i; + + il->contexts[IL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON; + il->contexts[IL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING; + il->contexts[IL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC; + il->contexts[IL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM; + il->contexts[IL_RXON_CTX_BSS].ap_sta_id = IL_AP_ID; + il->contexts[IL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY; + il->contexts[IL_RXON_CTX_BSS].interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC); - priv->contexts[IL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS; - priv->contexts[IL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS; - priv->contexts[IL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS; + il->contexts[IL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS; + il->contexts[IL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS; + il->contexts[IL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS; /* * Disabling hardware scan means that mac80211 will perform scans * "the hard way", rather than using device's scan. */ if (il3945_mod_params.disable_hw_scan) { - IL_DEBUG_INFO(priv, "Disabling hw_scan\n"); + IL_DEBUG_INFO(il, "Disabling hw_scan\n"); il3945_hw_ops.hw_scan = NULL; } - IL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n"); - priv->cfg = cfg; - priv->pci_dev = pdev; - priv->inta_mask = CSR_INI_SET_MASK; + IL_DEBUG_INFO(il, "*** LOAD DRIVER ***\n"); + il->cfg = cfg; + il->pci_dev = pdev; + il->inta_mask = CSR_INI_SET_MASK; - if (il_alloc_traffic_mem(priv)) - IL_ERR(priv, "Not enough memory to generate traffic log\n"); + if (il_alloc_traffic_mem(il)) + IL_ERR(il, "Not enough memory to generate traffic log\n"); /*************************** * 2. Initializing PCI bus @@ -3711,11 +3711,11 @@ static int il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *en if (!err) err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { - IL_WARN(priv, "No suitable DMA available.\n"); + IL_WARN(il, "No suitable DMA available.\n"); goto out_pci_disable_device; } - pci_set_drvdata(pdev, priv); + pci_set_drvdata(pdev, il); err = pci_request_regions(pdev, DRV_NAME); if (err) goto out_pci_disable_device; @@ -3723,15 +3723,15 @@ static int il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *en /*********************** * 3. Read REV Register * ********************/ - priv->hw_base = pci_iomap(pdev, 0, 0); - if (!priv->hw_base) { + il->hw_base = pci_iomap(pdev, 0, 0); + if (!il->hw_base) { err = -ENODEV; goto out_pci_release_regions; } - IL_DEBUG_INFO(priv, "pci_resource_len = 0x%08llx\n", + IL_DEBUG_INFO(il, "pci_resource_len = 0x%08llx\n", (unsigned long long) pci_resource_len(pdev, 0)); - IL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base); + IL_DEBUG_INFO(il, "pci_resource_base = %p\n", il->hw_base); /* We disable the RETRY_TIMEOUT register (0x41) to keep * PCI Tx retries from interfering with C3 CPU state */ @@ -3740,152 +3740,152 @@ static int il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *en /* these spin locks will be used in apm_ops.init and EEPROM access * we should init now */ - spin_lock_init(&priv->reg_lock); - spin_lock_init(&priv->lock); + spin_lock_init(&il->reg_lock); + spin_lock_init(&il->lock); /* * stop and reset the on-board processor just in case it is in a * strange state ... like being left stranded by a primary kernel * and this is now the kdump kernel trying to start up */ - il_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); + il_write32(il, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); /*********************** * 4. Read EEPROM * ********************/ /* Read the EEPROM */ - err = il_eeprom_init(priv); + err = il_eeprom_init(il); if (err) { - IL_ERR(priv, "Unable to init EEPROM\n"); + IL_ERR(il, "Unable to init EEPROM\n"); goto out_iounmap; } /* MAC Address location in EEPROM same for 3945/4965 */ - eeprom = (struct il3945_eeprom *)priv->eeprom; - IL_DEBUG_INFO(priv, "MAC address: %pM\n", eeprom->mac_address); - SET_IEEE80211_PERM_ADDR(priv->hw, eeprom->mac_address); + eeprom = (struct il3945_eeprom *)il->eeprom; + IL_DEBUG_INFO(il, "MAC address: %pM\n", eeprom->mac_address); + SET_IEEE80211_PERM_ADDR(il->hw, eeprom->mac_address); /*********************** * 5. Setup HW Constants * ********************/ /* Device-specific setup */ - if (il3945_hw_set_hw_params(priv)) { - IL_ERR(priv, "failed to set hw settings\n"); + if (il3945_hw_set_hw_params(il)) { + IL_ERR(il, "failed to set hw settings\n"); goto out_eeprom_free; } /*********************** - * 6. Setup priv + * 6. Setup il * ********************/ - err = il3945_init_drv(priv); + err = il3945_init_drv(il); if (err) { - IL_ERR(priv, "initializing driver failed\n"); + IL_ERR(il, "initializing driver failed\n"); goto out_unset_hw_params; } - IL_INFO(priv, "Detected Intel Wireless WiFi Link %s\n", - priv->cfg->name); + IL_INFO(il, "Detected Intel Wireless WiFi Link %s\n", + il->cfg->name); /*********************** * 7. Setup Services * ********************/ - spin_lock_irqsave(&priv->lock, flags); - il_disable_interrupts(priv); - spin_unlock_irqrestore(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); + il_disable_interrupts(il); + spin_unlock_irqrestore(&il->lock, flags); - pci_enable_msi(priv->pci_dev); + pci_enable_msi(il->pci_dev); - err = request_irq(priv->pci_dev->irq, il_isr, - IRQF_SHARED, DRV_NAME, priv); + err = request_irq(il->pci_dev->irq, il_isr, + IRQF_SHARED, DRV_NAME, il); if (err) { - IL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq); + IL_ERR(il, "Error allocating IRQ %d\n", il->pci_dev->irq); goto out_disable_msi; } err = sysfs_create_group(&pdev->dev.kobj, &il3945_attribute_group); if (err) { - IL_ERR(priv, "failed to create sysfs device attributes\n"); + IL_ERR(il, "failed to create sysfs device attributes\n"); goto out_release_irq; } - il_set_rxon_channel(priv, - &priv->bands[IEEE80211_BAND_2GHZ].channels[5], - &priv->contexts[IL_RXON_CTX_BSS]); - il3945_setup_deferred_work(priv); - il3945_setup_rx_handlers(priv); - il_power_initialize(priv); + il_set_rxon_channel(il, + &il->bands[IEEE80211_BAND_2GHZ].channels[5], + &il->contexts[IL_RXON_CTX_BSS]); + il3945_setup_deferred_work(il); + il3945_setup_rx_handlers(il); + il_power_initialize(il); /********************************* * 8. Setup and Register mac80211 * *******************************/ - il_enable_interrupts(priv); + il_enable_interrupts(il); - err = il3945_setup_mac(priv); + err = il3945_setup_mac(il); if (err) goto out_remove_sysfs; - err = il_dbgfs_register(priv, DRV_NAME); + err = il_dbgfs_register(il, DRV_NAME); if (err) - IL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); + IL_ERR(il, "failed to create debugfs files. Ignoring error: %d\n", err); /* Start monitoring the killswitch */ - queue_delayed_work(priv->workqueue, &priv->_3945.rfkill_poll, + queue_delayed_work(il->workqueue, &il->_3945.rfkill_poll, 2 * HZ); return 0; out_remove_sysfs: - destroy_workqueue(priv->workqueue); - priv->workqueue = NULL; + destroy_workqueue(il->workqueue); + il->workqueue = NULL; sysfs_remove_group(&pdev->dev.kobj, &il3945_attribute_group); out_release_irq: - free_irq(priv->pci_dev->irq, priv); + free_irq(il->pci_dev->irq, il); out_disable_msi: - pci_disable_msi(priv->pci_dev); - il_free_geos(priv); - il_free_channel_map(priv); + pci_disable_msi(il->pci_dev); + il_free_geos(il); + il_free_channel_map(il); out_unset_hw_params: - il3945_unset_hw_params(priv); + il3945_unset_hw_params(il); out_eeprom_free: - il_eeprom_free(priv); + il_eeprom_free(il); out_iounmap: - pci_iounmap(pdev, priv->hw_base); + pci_iounmap(pdev, il->hw_base); out_pci_release_regions: pci_release_regions(pdev); out_pci_disable_device: pci_set_drvdata(pdev, NULL); pci_disable_device(pdev); out_ieee80211_free_hw: - il_free_traffic_mem(priv); - ieee80211_free_hw(priv->hw); + il_free_traffic_mem(il); + ieee80211_free_hw(il->hw); out: return err; } static void __devexit il3945_pci_remove(struct pci_dev *pdev) { - struct il_priv *priv = pci_get_drvdata(pdev); + struct il_priv *il = pci_get_drvdata(pdev); unsigned long flags; - if (!priv) + if (!il) return; - IL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); + IL_DEBUG_INFO(il, "*** UNLOAD DRIVER ***\n"); - il_dbgfs_unregister(priv); + il_dbgfs_unregister(il); - set_bit(STATUS_EXIT_PENDING, &priv->status); + set_bit(STATUS_EXIT_PENDING, &il->status); - il_leds_exit(priv); + il_leds_exit(il); - if (priv->mac80211_registered) { - ieee80211_unregister_hw(priv->hw); - priv->mac80211_registered = 0; + if (il->mac80211_registered) { + ieee80211_unregister_hw(il->hw); + il->mac80211_registered = 0; } else { - il3945_down(priv); + il3945_down(il); } /* @@ -3895,54 +3895,54 @@ static void __devexit il3945_pci_remove(struct pci_dev *pdev) * paths to avoid running il_down() at all before leaving driver. * This (inexpensive) call *makes sure* device is reset. */ - il_apm_stop(priv); + il_apm_stop(il); /* make sure we flush any pending irq or * tasklet for the driver */ - spin_lock_irqsave(&priv->lock, flags); - il_disable_interrupts(priv); - spin_unlock_irqrestore(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); + il_disable_interrupts(il); + spin_unlock_irqrestore(&il->lock, flags); - il3945_synchronize_irq(priv); + il3945_synchronize_irq(il); sysfs_remove_group(&pdev->dev.kobj, &il3945_attribute_group); - cancel_delayed_work_sync(&priv->_3945.rfkill_poll); + cancel_delayed_work_sync(&il->_3945.rfkill_poll); - il3945_dealloc_ucode_pci(priv); + il3945_dealloc_ucode_pci(il); - if (priv->rxq.bd) - il3945_rx_queue_free(priv, &priv->rxq); - il3945_hw_txq_ctx_free(priv); + if (il->rxq.bd) + il3945_rx_queue_free(il, &il->rxq); + il3945_hw_txq_ctx_free(il); - il3945_unset_hw_params(priv); + il3945_unset_hw_params(il); /*netif_stop_queue(dev); */ - flush_workqueue(priv->workqueue); + flush_workqueue(il->workqueue); /* ieee80211_unregister_hw calls il3945_mac_stop, which flushes - * priv->workqueue... so we can't take down the workqueue + * il->workqueue... so we can't take down the workqueue * until now... */ - destroy_workqueue(priv->workqueue); - priv->workqueue = NULL; - il_free_traffic_mem(priv); + destroy_workqueue(il->workqueue); + il->workqueue = NULL; + il_free_traffic_mem(il); - free_irq(pdev->irq, priv); + free_irq(pdev->irq, il); pci_disable_msi(pdev); - pci_iounmap(pdev, priv->hw_base); + pci_iounmap(pdev, il->hw_base); pci_release_regions(pdev); pci_disable_device(pdev); pci_set_drvdata(pdev, NULL); - il_free_channel_map(priv); - il_free_geos(priv); - kfree(priv->scan_cmd); - if (priv->beacon_skb) - dev_kfree_skb(priv->beacon_skb); + il_free_channel_map(il); + il_free_geos(il); + kfree(il->scan_cmd); + if (il->beacon_skb) + dev_kfree_skb(il->beacon_skb); - ieee80211_free_hw(priv->hw); + ieee80211_free_hw(il->hw); } diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c index bd37c9226e65..ae8a93751561 100644 --- a/drivers/net/wireless/iwlegacy/iwl4965-base.c +++ b/drivers/net/wireless/iwlegacy/iwl4965-base.c @@ -87,85 +87,85 @@ MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR); MODULE_LICENSE("GPL"); MODULE_ALIAS("iwl4965"); -void il4965_update_chain_flags(struct il_priv *priv) +void il4965_update_chain_flags(struct il_priv *il) { struct il_rxon_context *ctx; - if (priv->cfg->ops->hcmd->set_rxon_chain) { - for_each_context(priv, ctx) { - priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); + if (il->cfg->ops->hcmd->set_rxon_chain) { + for_each_context(il, ctx) { + il->cfg->ops->hcmd->set_rxon_chain(il, ctx); if (ctx->active.rx_chain != ctx->staging.rx_chain) - il_commit_rxon(priv, ctx); + il_commit_rxon(il, ctx); } } } -static void il4965_clear_free_frames(struct il_priv *priv) +static void il4965_clear_free_frames(struct il_priv *il) { struct list_head *element; - IL_DEBUG_INFO(priv, "%d frames on pre-allocated heap on clear.\n", - priv->frames_count); + IL_DEBUG_INFO(il, "%d frames on pre-allocated heap on clear.\n", + il->frames_count); - while (!list_empty(&priv->free_frames)) { - element = priv->free_frames.next; + while (!list_empty(&il->free_frames)) { + element = il->free_frames.next; list_del(element); kfree(list_entry(element, struct il_frame, list)); - priv->frames_count--; + il->frames_count--; } - if (priv->frames_count) { - IL_WARN(priv, "%d frames still in use. Did we lose one?\n", - priv->frames_count); - priv->frames_count = 0; + if (il->frames_count) { + IL_WARN(il, "%d frames still in use. Did we lose one?\n", + il->frames_count); + il->frames_count = 0; } } -static struct il_frame *il4965_get_free_frame(struct il_priv *priv) +static struct il_frame *il4965_get_free_frame(struct il_priv *il) { struct il_frame *frame; struct list_head *element; - if (list_empty(&priv->free_frames)) { + if (list_empty(&il->free_frames)) { frame = kzalloc(sizeof(*frame), GFP_KERNEL); if (!frame) { - IL_ERR(priv, "Could not allocate frame!\n"); + IL_ERR(il, "Could not allocate frame!\n"); return NULL; } - priv->frames_count++; + il->frames_count++; return frame; } - element = priv->free_frames.next; + element = il->free_frames.next; list_del(element); return list_entry(element, struct il_frame, list); } -static void il4965_free_frame(struct il_priv *priv, struct il_frame *frame) +static void il4965_free_frame(struct il_priv *il, struct il_frame *frame) { memset(frame, 0, sizeof(*frame)); - list_add(&frame->list, &priv->free_frames); + list_add(&frame->list, &il->free_frames); } -static u32 il4965_fill_beacon_frame(struct il_priv *priv, +static u32 il4965_fill_beacon_frame(struct il_priv *il, struct ieee80211_hdr *hdr, int left) { - lockdep_assert_held(&priv->mutex); + lockdep_assert_held(&il->mutex); - if (!priv->beacon_skb) + if (!il->beacon_skb) return 0; - if (priv->beacon_skb->len > left) + if (il->beacon_skb->len > left) return 0; - memcpy(hdr, priv->beacon_skb->data, priv->beacon_skb->len); + memcpy(hdr, il->beacon_skb->data, il->beacon_skb->len); - return priv->beacon_skb->len; + return il->beacon_skb->len; } /* Parse the beacon frame to find the TIM element and set tim_idx & tim_size */ -static void il4965_set_beacon_tim(struct il_priv *priv, +static void il4965_set_beacon_tim(struct il_priv *il, struct il_tx_beacon_cmd *tx_beacon_cmd, u8 *beacon, u32 frame_size) { @@ -188,10 +188,10 @@ static void il4965_set_beacon_tim(struct il_priv *priv, tx_beacon_cmd->tim_idx = cpu_to_le16(tim_idx); tx_beacon_cmd->tim_size = beacon[tim_idx+1]; } else - IL_WARN(priv, "Unable to find TIM Element in beacon\n"); + IL_WARN(il, "Unable to find TIM Element in beacon\n"); } -static unsigned int il4965_hw_get_beacon_cmd(struct il_priv *priv, +static unsigned int il4965_hw_get_beacon_cmd(struct il_priv *il, struct il_frame *frame) { struct il_tx_beacon_cmd *tx_beacon_cmd; @@ -203,10 +203,10 @@ static unsigned int il4965_hw_get_beacon_cmd(struct il_priv *priv, * beacon contents. */ - lockdep_assert_held(&priv->mutex); + lockdep_assert_held(&il->mutex); - if (!priv->beacon_ctx) { - IL_ERR(priv, "trying to build beacon w/o beacon context!\n"); + if (!il->beacon_ctx) { + IL_ERR(il, "trying to build beacon w/o beacon context!\n"); return 0; } @@ -215,7 +215,7 @@ static unsigned int il4965_hw_get_beacon_cmd(struct il_priv *priv, memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); /* Set up TX beacon contents */ - frame_size = il4965_fill_beacon_frame(priv, tx_beacon_cmd->frame, + frame_size = il4965_fill_beacon_frame(il, tx_beacon_cmd->frame, sizeof(frame->u) - sizeof(*tx_beacon_cmd)); if (WARN_ON_ONCE(frame_size > MAX_MPDU_SIZE)) return 0; @@ -224,20 +224,20 @@ static unsigned int il4965_hw_get_beacon_cmd(struct il_priv *priv, /* Set up TX command fields */ tx_beacon_cmd->tx.len = cpu_to_le16((u16)frame_size); - tx_beacon_cmd->tx.sta_id = priv->beacon_ctx->bcast_sta_id; + tx_beacon_cmd->tx.sta_id = il->beacon_ctx->bcast_sta_id; tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; tx_beacon_cmd->tx.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK | TX_CMD_FLG_TSF_MSK | TX_CMD_FLG_STA_RATE_MSK; /* Set up TX beacon command fields */ - il4965_set_beacon_tim(priv, tx_beacon_cmd, (u8 *)tx_beacon_cmd->frame, + il4965_set_beacon_tim(il, tx_beacon_cmd, (u8 *)tx_beacon_cmd->frame, frame_size); /* Set up packet rate and flags */ - rate = il_get_lowest_plcp(priv, priv->beacon_ctx); - priv->mgmt_tx_ant = il4965_toggle_tx_ant(priv, priv->mgmt_tx_ant, - priv->hw_params.valid_tx_ant); - rate_flags = il4965_ant_idx_to_flags(priv->mgmt_tx_ant); + rate = il_get_lowest_plcp(il, il->beacon_ctx); + il->mgmt_tx_ant = il4965_toggle_tx_ant(il, il->mgmt_tx_ant, + il->hw_params.valid_tx_ant); + rate_flags = il4965_ant_idx_to_flags(il->mgmt_tx_ant); if ((rate >= IL_FIRST_CCK_RATE) && (rate <= IL_LAST_CCK_RATE)) rate_flags |= RATE_MCS_CCK_MSK; tx_beacon_cmd->tx.rate_n_flags = il4965_hw_set_rate_n_flags(rate, @@ -246,30 +246,30 @@ static unsigned int il4965_hw_get_beacon_cmd(struct il_priv *priv, return sizeof(*tx_beacon_cmd) + frame_size; } -int il4965_send_beacon_cmd(struct il_priv *priv) +int il4965_send_beacon_cmd(struct il_priv *il) { struct il_frame *frame; unsigned int frame_size; int rc; - frame = il4965_get_free_frame(priv); + frame = il4965_get_free_frame(il); if (!frame) { - IL_ERR(priv, "Could not obtain free frame buffer for beacon " + IL_ERR(il, "Could not obtain free frame buffer for beacon " "command.\n"); return -ENOMEM; } - frame_size = il4965_hw_get_beacon_cmd(priv, frame); + frame_size = il4965_hw_get_beacon_cmd(il, frame); if (!frame_size) { - IL_ERR(priv, "Error configuring the beacon command\n"); - il4965_free_frame(priv, frame); + IL_ERR(il, "Error configuring the beacon command\n"); + il4965_free_frame(il, frame); return -EINVAL; } - rc = il_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, + rc = il_send_cmd_pdu(il, REPLY_TX_BEACON, frame_size, &frame->u.cmd[0]); - il4965_free_frame(priv, frame); + il4965_free_frame(il, frame); return rc; } @@ -315,17 +315,17 @@ static inline u8 il4965_tfd_get_num_tbs(struct il_tfd *tfd) /** * il4965_hw_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr] - * @priv - driver private data + * @il - driver ilate data * @txq - tx queue * * Does NOT advance any TFD circular buffer read/write indexes * Does NOT free the TFD itself (which is within circular buffer) */ -void il4965_hw_txq_free_tfd(struct il_priv *priv, struct il_tx_queue *txq) +void il4965_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq) { struct il_tfd *tfd_tmp = (struct il_tfd *)txq->tfds; struct il_tfd *tfd; - struct pci_dev *dev = priv->pci_dev; + struct pci_dev *dev = il->pci_dev; int index = txq->q.read_ptr; int i; int num_tbs; @@ -336,7 +336,7 @@ void il4965_hw_txq_free_tfd(struct il_priv *priv, struct il_tx_queue *txq) num_tbs = il4965_tfd_get_num_tbs(tfd); if (num_tbs >= IL_NUM_OF_TBS) { - IL_ERR(priv, "Too many chunks: %i\n", num_tbs); + IL_ERR(il, "Too many chunks: %i\n", num_tbs); /* @todo issue fatal error, it is quite serious situation */ return; } @@ -368,7 +368,7 @@ 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, +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) @@ -388,14 +388,14 @@ int il4965_hw_txq_attach_buf_to_tfd(struct il_priv *priv, /* Each TFD can point to a maximum 20 Tx buffers */ if (num_tbs >= IL_NUM_OF_TBS) { - IL_ERR(priv, "Error can not send more than %d chunks\n", + IL_ERR(il, "Error can not send more than %d chunks\n", IL_NUM_OF_TBS); return -EINVAL; } BUG_ON(addr & ~DMA_BIT_MASK(36)); if (unlikely(addr & ~IL_TX_DMA_MASK)) - IL_ERR(priv, "Unaligned address = %llx\n", + IL_ERR(il, "Unaligned address = %llx\n", (unsigned long long)addr); il4965_tfd_set_tb(tfd, num_tbs, addr, len); @@ -410,13 +410,13 @@ int il4965_hw_txq_attach_buf_to_tfd(struct il_priv *priv, * 4965 supports up to 16 Tx queues in DRAM, mapped to up to 8 Tx DMA * channels supported in hardware. */ -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) { int txq_id = txq->q.id; /* Circular buffer (TFD queue in DRAM) physical base address */ - il_write_direct32(priv, FH_MEM_CBBC_QUEUE(txq_id), + il_write_direct32(il, FH_MEM_CBBC_QUEUE(txq_id), txq->q.dma_addr >> 8); return 0; @@ -427,7 +427,7 @@ int il4965_hw_tx_queue_init(struct il_priv *priv, * Generic RX handler implementations * ******************************************************************************/ -static void il4965_rx_reply_alive(struct il_priv *priv, +static void il4965_rx_reply_alive(struct il_priv *il, struct il_rx_mem_buffer *rxb) { struct il_rx_packet *pkt = rxb_addr(rxb); @@ -436,31 +436,31 @@ static void il4965_rx_reply_alive(struct il_priv *priv, palive = &pkt->u.alive_frame; - IL_DEBUG_INFO(priv, "Alive ucode status 0x%08X revision " + IL_DEBUG_INFO(il, "Alive ucode status 0x%08X revision " "0x%01X 0x%01X\n", palive->is_valid, palive->ver_type, palive->ver_subtype); if (palive->ver_subtype == INITIALIZE_SUBTYPE) { - IL_DEBUG_INFO(priv, "Initialization Alive received.\n"); - memcpy(&priv->card_alive_init, + IL_DEBUG_INFO(il, "Initialization Alive received.\n"); + memcpy(&il->card_alive_init, &pkt->u.alive_frame, sizeof(struct il_init_alive_resp)); - pwork = &priv->init_alive_start; + pwork = &il->init_alive_start; } else { - IL_DEBUG_INFO(priv, "Runtime Alive received.\n"); - memcpy(&priv->card_alive, &pkt->u.alive_frame, + IL_DEBUG_INFO(il, "Runtime Alive received.\n"); + memcpy(&il->card_alive, &pkt->u.alive_frame, sizeof(struct il_alive_resp)); - pwork = &priv->alive_start; + pwork = &il->alive_start; } /* We delay the ALIVE response by 5ms to * give the HW RF Kill time to activate... */ if (palive->is_valid == UCODE_VALID_OK) - queue_delayed_work(priv->workqueue, pwork, + queue_delayed_work(il->workqueue, pwork, msecs_to_jiffies(5)); else - IL_WARN(priv, "uCode did not respond OK.\n"); + IL_WARN(il, "uCode did not respond OK.\n"); } /** @@ -475,19 +475,19 @@ static void il4965_rx_reply_alive(struct il_priv *priv, */ static void il4965_bg_statistics_periodic(unsigned long data) { - struct il_priv *priv = (struct il_priv *)data; + struct il_priv *il = (struct il_priv *)data; - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) + if (test_bit(STATUS_EXIT_PENDING, &il->status)) return; /* dont send host command if rf-kill is on */ - if (!il_is_ready_rf(priv)) + if (!il_is_ready_rf(il)) return; - il_send_statistics_request(priv, CMD_ASYNC, false); + il_send_statistics_request(il, CMD_ASYNC, false); } -static void il4965_rx_beacon_notif(struct il_priv *priv, +static void il4965_rx_beacon_notif(struct il_priv *il, struct il_rx_mem_buffer *rxb) { struct il_rx_packet *pkt = rxb_addr(rxb); @@ -496,7 +496,7 @@ static void il4965_rx_beacon_notif(struct il_priv *priv, #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG u8 rate = il4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); - IL_DEBUG_RX(priv, "beacon status %x retries %d iss %d " + IL_DEBUG_RX(il, "beacon status %x retries %d iss %d " "tsf %d %d rate %d\n", le32_to_cpu(beacon->beacon_notify_hdr.u.status) & TX_STATUS_MSK, beacon->beacon_notify_hdr.failure_frame, @@ -505,38 +505,38 @@ static void il4965_rx_beacon_notif(struct il_priv *priv, le32_to_cpu(beacon->low_tsf), rate); #endif - priv->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status); + il->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status); } -static void il4965_perform_ct_kill_task(struct il_priv *priv) +static void il4965_perform_ct_kill_task(struct il_priv *il) { unsigned long flags; - IL_DEBUG_POWER(priv, "Stop all queues\n"); + IL_DEBUG_POWER(il, "Stop all queues\n"); - if (priv->mac80211_registered) - ieee80211_stop_queues(priv->hw); + if (il->mac80211_registered) + ieee80211_stop_queues(il->hw); - il_write32(priv, CSR_UCODE_DRV_GP1_SET, + il_write32(il, CSR_UCODE_DRV_GP1_SET, CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); - il_read32(priv, CSR_UCODE_DRV_GP1); + il_read32(il, CSR_UCODE_DRV_GP1); - spin_lock_irqsave(&priv->reg_lock, flags); - if (!il_grab_nic_access(priv)) - il_release_nic_access(priv); - spin_unlock_irqrestore(&priv->reg_lock, flags); + spin_lock_irqsave(&il->reg_lock, flags); + if (!il_grab_nic_access(il)) + il_release_nic_access(il); + spin_unlock_irqrestore(&il->reg_lock, flags); } /* Handle notification from uCode that card's power state is changing * due to software, hardware, or critical temperature RFKILL */ -static void il4965_rx_card_state_notif(struct il_priv *priv, +static void il4965_rx_card_state_notif(struct il_priv *il, struct il_rx_mem_buffer *rxb) { struct il_rx_packet *pkt = rxb_addr(rxb); u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags); - unsigned long status = priv->status; + unsigned long status = il->status; - IL_DEBUG_RF_KILL(priv, "Card state received: HW:%s SW:%s CT:%s\n", + IL_DEBUG_RF_KILL(il, "Card state received: HW:%s SW:%s CT:%s\n", (flags & HW_CARD_DISABLED) ? "Kill" : "On", (flags & SW_CARD_DISABLED) ? "Kill" : "On", (flags & CT_CARD_DISABLED) ? @@ -545,37 +545,37 @@ static void il4965_rx_card_state_notif(struct il_priv *priv, if (flags & (SW_CARD_DISABLED | HW_CARD_DISABLED | CT_CARD_DISABLED)) { - il_write32(priv, CSR_UCODE_DRV_GP1_SET, + il_write32(il, CSR_UCODE_DRV_GP1_SET, CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); - il_write_direct32(priv, HBUS_TARG_MBX_C, + il_write_direct32(il, HBUS_TARG_MBX_C, HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); if (!(flags & RXON_CARD_DISABLED)) { - il_write32(priv, CSR_UCODE_DRV_GP1_CLR, + il_write32(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); - il_write_direct32(priv, HBUS_TARG_MBX_C, + il_write_direct32(il, HBUS_TARG_MBX_C, HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); } } if (flags & CT_CARD_DISABLED) - il4965_perform_ct_kill_task(priv); + il4965_perform_ct_kill_task(il); if (flags & HW_CARD_DISABLED) - set_bit(STATUS_RF_KILL_HW, &priv->status); + set_bit(STATUS_RF_KILL_HW, &il->status); else - clear_bit(STATUS_RF_KILL_HW, &priv->status); + clear_bit(STATUS_RF_KILL_HW, &il->status); if (!(flags & RXON_CARD_DISABLED)) - il_scan_cancel(priv); + il_scan_cancel(il); if ((test_bit(STATUS_RF_KILL_HW, &status) != - test_bit(STATUS_RF_KILL_HW, &priv->status))) - wiphy_rfkill_set_hw_state(priv->hw->wiphy, - test_bit(STATUS_RF_KILL_HW, &priv->status)); + test_bit(STATUS_RF_KILL_HW, &il->status))) + wiphy_rfkill_set_hw_state(il->hw->wiphy, + test_bit(STATUS_RF_KILL_HW, &il->status)); else - wake_up(&priv->wait_command_queue); + wake_up(&il->wait_command_queue); } /** @@ -587,55 +587,55 @@ static void il4965_rx_card_state_notif(struct il_priv *priv, * This function chains into the hardware specific files for them to setup * any hardware specific handlers as well. */ -static void il4965_setup_rx_handlers(struct il_priv *priv) +static void il4965_setup_rx_handlers(struct il_priv *il) { - priv->rx_handlers[REPLY_ALIVE] = il4965_rx_reply_alive; - priv->rx_handlers[REPLY_ERROR] = il_rx_reply_error; - priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = il_rx_csa; - priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] = + il->rx_handlers[REPLY_ALIVE] = il4965_rx_reply_alive; + il->rx_handlers[REPLY_ERROR] = il_rx_reply_error; + il->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = il_rx_csa; + il->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] = il_rx_spectrum_measure_notif; - priv->rx_handlers[PM_SLEEP_NOTIFICATION] = il_rx_pm_sleep_notif; - priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] = + il->rx_handlers[PM_SLEEP_NOTIFICATION] = il_rx_pm_sleep_notif; + il->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] = il_rx_pm_debug_statistics_notif; - priv->rx_handlers[BEACON_NOTIFICATION] = il4965_rx_beacon_notif; + il->rx_handlers[BEACON_NOTIFICATION] = il4965_rx_beacon_notif; /* * The same handler is used for both the REPLY to a discrete * statistics request from the host as well as for the periodic * statistics notifications (after received beacons) from the uCode. */ - priv->rx_handlers[REPLY_STATISTICS_CMD] = il4965_reply_statistics; - priv->rx_handlers[STATISTICS_NOTIFICATION] = il4965_rx_statistics; + il->rx_handlers[REPLY_STATISTICS_CMD] = il4965_reply_statistics; + il->rx_handlers[STATISTICS_NOTIFICATION] = il4965_rx_statistics; - il_setup_rx_scan_handlers(priv); + il_setup_rx_scan_handlers(il); /* status change handler */ - priv->rx_handlers[CARD_STATE_NOTIFICATION] = + il->rx_handlers[CARD_STATE_NOTIFICATION] = il4965_rx_card_state_notif; - priv->rx_handlers[MISSED_BEACONS_NOTIFICATION] = + il->rx_handlers[MISSED_BEACONS_NOTIFICATION] = il4965_rx_missed_beacon_notif; /* Rx handlers */ - priv->rx_handlers[REPLY_RX_PHY_CMD] = il4965_rx_reply_rx_phy; - priv->rx_handlers[REPLY_RX_MPDU_CMD] = il4965_rx_reply_rx; + il->rx_handlers[REPLY_RX_PHY_CMD] = il4965_rx_reply_rx_phy; + il->rx_handlers[REPLY_RX_MPDU_CMD] = il4965_rx_reply_rx; /* block ack */ - priv->rx_handlers[REPLY_COMPRESSED_BA] = il4965_rx_reply_compressed_ba; + il->rx_handlers[REPLY_COMPRESSED_BA] = il4965_rx_reply_compressed_ba; /* Set up hardware specific Rx handlers */ - priv->cfg->ops->lib->rx_handler_setup(priv); + il->cfg->ops->lib->rx_handler_setup(il); } /** * il4965_rx_handle - Main entry function for receiving responses from uCode * - * Uses the priv->rx_handlers callback function array to invoke + * Uses the il->rx_handlers callback function array to invoke * the appropriate handlers, including command responses, * frame-received notifications, and other notifications. */ -void il4965_rx_handle(struct il_priv *priv) +void il4965_rx_handle(struct il_priv *il) { struct il_rx_mem_buffer *rxb; struct il_rx_packet *pkt; - struct il_rx_queue *rxq = &priv->rxq; + struct il_rx_queue *rxq = &il->rxq; u32 r, i; int reclaim; unsigned long flags; @@ -650,7 +650,7 @@ void il4965_rx_handle(struct il_priv *priv) /* Rx interrupt, but nothing sent from uCode */ if (i == r) - IL_DEBUG_RX(priv, "r = %d, i = %d\n", r, i); + IL_DEBUG_RX(il, "r = %d, i = %d\n", r, i); /* calculate total frames need to be restock after handling RX */ total_empty = r - rxq->write_actual; @@ -672,8 +672,8 @@ void il4965_rx_handle(struct il_priv *priv) rxq->queue[i] = NULL; - pci_unmap_page(priv->pci_dev, rxb->page_dma, - PAGE_SIZE << priv->hw_params.rx_page_order, + pci_unmap_page(il->pci_dev, rxb->page_dma, + PAGE_SIZE << il->hw_params.rx_page_order, PCI_DMA_FROMDEVICE); pkt = rxb_addr(rxb); @@ -697,15 +697,15 @@ void il4965_rx_handle(struct il_priv *priv) /* Based on type of command response or notification, * handle those that need handling via function in * rx_handlers table. See il4965_setup_rx_handlers() */ - if (priv->rx_handlers[pkt->hdr.cmd]) { - IL_DEBUG_RX(priv, "r = %d, i = %d, %s, 0x%02x\n", r, + if (il->rx_handlers[pkt->hdr.cmd]) { + IL_DEBUG_RX(il, "r = %d, i = %d, %s, 0x%02x\n", r, i, il_get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); - priv->isr_stats.rx_handlers[pkt->hdr.cmd]++; - priv->rx_handlers[pkt->hdr.cmd] (priv, rxb); + il->isr_stats.rx_handlers[pkt->hdr.cmd]++; + il->rx_handlers[pkt->hdr.cmd] (il, rxb); } else { /* No handling needed */ - IL_DEBUG_RX(priv, + IL_DEBUG_RX(il, "r %d i %d No handler needed for %s, 0x%02x\n", r, i, il_get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); @@ -723,9 +723,9 @@ void il4965_rx_handle(struct il_priv *priv) * and fire off the (possibly) blocking il_send_cmd() * as we reclaim the driver command queue */ if (rxb->page) - il_tx_cmd_complete(priv, rxb); + il_tx_cmd_complete(il, rxb); else - IL_WARN(priv, "Claim null rxb?\n"); + IL_WARN(il, "Claim null rxb?\n"); } /* Reuse the page if possible. For notification packets and @@ -733,8 +733,8 @@ void il4965_rx_handle(struct il_priv *priv) * rx_free list for reuse later. */ spin_lock_irqsave(&rxq->lock, flags); if (rxb->page != NULL) { - rxb->page_dma = pci_map_page(priv->pci_dev, rxb->page, - 0, PAGE_SIZE << priv->hw_params.rx_page_order, + rxb->page_dma = pci_map_page(il->pci_dev, rxb->page, + 0, PAGE_SIZE << il->hw_params.rx_page_order, PCI_DMA_FROMDEVICE); list_add_tail(&rxb->list, &rxq->rx_free); rxq->free_count++; @@ -750,7 +750,7 @@ void il4965_rx_handle(struct il_priv *priv) count++; if (count >= 8) { rxq->read = i; - il4965_rx_replenish_now(priv); + il4965_rx_replenish_now(il); count = 0; } } @@ -759,20 +759,20 @@ void il4965_rx_handle(struct il_priv *priv) /* Backtrack one entry */ rxq->read = i; if (fill_rx) - il4965_rx_replenish_now(priv); + il4965_rx_replenish_now(il); else - il4965_rx_queue_restock(priv); + il4965_rx_queue_restock(il); } /* call this function to flush any scheduled tasklet */ -static inline void il4965_synchronize_irq(struct il_priv *priv) +static inline void il4965_synchronize_irq(struct il_priv *il) { /* wait to make sure we flush pending tasklet*/ - synchronize_irq(priv->pci_dev->irq); - tasklet_kill(&priv->irq_tasklet); + synchronize_irq(il->pci_dev->irq); + tasklet_kill(&il->irq_tasklet); } -static void il4965_irq_tasklet(struct il_priv *priv) +static void il4965_irq_tasklet(struct il_priv *il) { u32 inta, handled = 0; u32 inta_fh; @@ -782,30 +782,30 @@ static void il4965_irq_tasklet(struct il_priv *priv) u32 inta_mask; #endif - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); /* Ack/clear/reset pending uCode interrupts. * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS, * and will clear only when CSR_FH_INT_STATUS gets cleared. */ - inta = il_read32(priv, CSR_INT); - il_write32(priv, CSR_INT, inta); + inta = il_read32(il, CSR_INT); + il_write32(il, CSR_INT, inta); /* Ack/clear/reset pending flow-handler (DMA) interrupts. * Any new interrupts that happen after this, either while we're * in this tasklet, or later, will show up in next ISR/tasklet. */ - inta_fh = il_read32(priv, CSR_FH_INT_STATUS); - il_write32(priv, CSR_FH_INT_STATUS, inta_fh); + inta_fh = il_read32(il, CSR_FH_INT_STATUS); + il_write32(il, CSR_FH_INT_STATUS, inta_fh); #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG - if (il_get_debug_level(priv) & IL_DL_ISR) { + if (il_get_debug_level(il) & IL_DL_ISR) { /* just for debug */ - inta_mask = il_read32(priv, CSR_INT_MASK); - IL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", + inta_mask = il_read32(il, CSR_INT_MASK); + IL_DEBUG_ISR(il, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", inta, inta_mask, inta_fh); } #endif - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&il->lock, flags); /* Since CSR_INT and CSR_FH_INT_STATUS reads and clears are not * atomic, make sure that inta covers all the interrupts that @@ -818,13 +818,13 @@ static void il4965_irq_tasklet(struct il_priv *priv) /* Now service all interrupt bits discovered above. */ if (inta & CSR_INT_BIT_HW_ERR) { - IL_ERR(priv, "Hardware error detected. Restarting.\n"); + IL_ERR(il, "Hardware error detected. Restarting.\n"); /* Tell the device to stop sending interrupts */ - il_disable_interrupts(priv); + il_disable_interrupts(il); - priv->isr_stats.hw++; - il_irq_handle_error(priv); + il->isr_stats.hw++; + il_irq_handle_error(il); handled |= CSR_INT_BIT_HW_ERR; @@ -832,18 +832,18 @@ static void il4965_irq_tasklet(struct il_priv *priv) } #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG - if (il_get_debug_level(priv) & (IL_DL_ISR)) { + if (il_get_debug_level(il) & (IL_DL_ISR)) { /* NIC fires this, but we don't use it, redundant with WAKEUP */ if (inta & CSR_INT_BIT_SCD) { - IL_DEBUG_ISR(priv, "Scheduler finished to transmit " + IL_DEBUG_ISR(il, "Scheduler finished to transmit " "the frame/frames.\n"); - priv->isr_stats.sch++; + il->isr_stats.sch++; } /* Alive notification via Rx interrupt will do the real work */ if (inta & CSR_INT_BIT_ALIVE) { - IL_DEBUG_ISR(priv, "Alive interrupt\n"); - priv->isr_stats.alive++; + IL_DEBUG_ISR(il, "Alive interrupt\n"); + il->isr_stats.alive++; } } #endif @@ -853,26 +853,26 @@ static void il4965_irq_tasklet(struct il_priv *priv) /* HW RF KILL switch toggled */ if (inta & CSR_INT_BIT_RF_KILL) { int hw_rf_kill = 0; - if (!(il_read32(priv, CSR_GP_CNTRL) & + if (!(il_read32(il, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) hw_rf_kill = 1; - IL_WARN(priv, "RF_KILL bit toggled to %s.\n", + IL_WARN(il, "RF_KILL bit toggled to %s.\n", hw_rf_kill ? "disable radio" : "enable radio"); - priv->isr_stats.rfkill++; + il->isr_stats.rfkill++; /* driver only loads ucode once setting the interface up. * the driver allows loading the ucode even if the radio * is killed. Hence update the killswitch state here. The * rfkill handler will care about restarting if needed. */ - if (!test_bit(STATUS_ALIVE, &priv->status)) { + if (!test_bit(STATUS_ALIVE, &il->status)) { if (hw_rf_kill) - set_bit(STATUS_RF_KILL_HW, &priv->status); + set_bit(STATUS_RF_KILL_HW, &il->status); else - clear_bit(STATUS_RF_KILL_HW, &priv->status); - wiphy_rfkill_set_hw_state(priv->hw->wiphy, hw_rf_kill); + clear_bit(STATUS_RF_KILL_HW, &il->status); + wiphy_rfkill_set_hw_state(il->hw->wiphy, hw_rf_kill); } handled |= CSR_INT_BIT_RF_KILL; @@ -880,17 +880,17 @@ static void il4965_irq_tasklet(struct il_priv *priv) /* Chip got too hot and stopped itself */ if (inta & CSR_INT_BIT_CT_KILL) { - IL_ERR(priv, "Microcode CT kill error detected.\n"); - priv->isr_stats.ctkill++; + IL_ERR(il, "Microcode CT kill error detected.\n"); + il->isr_stats.ctkill++; handled |= CSR_INT_BIT_CT_KILL; } /* Error detected by uCode */ if (inta & CSR_INT_BIT_SW_ERR) { - IL_ERR(priv, "Microcode SW error detected. " + IL_ERR(il, "Microcode SW error detected. " " Restarting 0x%X.\n", inta); - priv->isr_stats.sw++; - il_irq_handle_error(priv); + il->isr_stats.sw++; + il_irq_handle_error(il); handled |= CSR_INT_BIT_SW_ERR; } @@ -900,11 +900,11 @@ static void il4965_irq_tasklet(struct il_priv *priv) * and about any Rx buffers made available while asleep. */ if (inta & CSR_INT_BIT_WAKEUP) { - IL_DEBUG_ISR(priv, "Wakeup interrupt\n"); - il_rx_queue_update_write_ptr(priv, &priv->rxq); - for (i = 0; i < priv->hw_params.max_txq_num; i++) - il_txq_update_write_ptr(priv, &priv->txq[i]); - priv->isr_stats.wakeup++; + IL_DEBUG_ISR(il, "Wakeup interrupt\n"); + il_rx_queue_update_write_ptr(il, &il->rxq); + for (i = 0; i < il->hw_params.max_txq_num; i++) + il_txq_update_write_ptr(il, &il->txq[i]); + il->isr_stats.wakeup++; handled |= CSR_INT_BIT_WAKEUP; } @@ -912,46 +912,46 @@ static void il4965_irq_tasklet(struct il_priv *priv) * Rx "responses" (frame-received notification), and other * notifications from uCode come through here*/ if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) { - il4965_rx_handle(priv); - priv->isr_stats.rx++; + il4965_rx_handle(il); + il->isr_stats.rx++; handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX); } /* This "Tx" DMA channel is used only for loading uCode */ if (inta & CSR_INT_BIT_FH_TX) { - IL_DEBUG_ISR(priv, "uCode load interrupt\n"); - priv->isr_stats.tx++; + IL_DEBUG_ISR(il, "uCode load interrupt\n"); + il->isr_stats.tx++; handled |= CSR_INT_BIT_FH_TX; /* Wake up uCode load routine, now that load is complete */ - priv->ucode_write_complete = 1; - wake_up(&priv->wait_command_queue); + il->ucode_write_complete = 1; + wake_up(&il->wait_command_queue); } if (inta & ~handled) { - IL_ERR(priv, "Unhandled INTA bits 0x%08x\n", inta & ~handled); - priv->isr_stats.unhandled++; + IL_ERR(il, "Unhandled INTA bits 0x%08x\n", inta & ~handled); + il->isr_stats.unhandled++; } - if (inta & ~(priv->inta_mask)) { - IL_WARN(priv, "Disabled INTA bits 0x%08x were pending\n", - inta & ~priv->inta_mask); - IL_WARN(priv, " with FH_INT = 0x%08x\n", inta_fh); + if (inta & ~(il->inta_mask)) { + IL_WARN(il, "Disabled INTA bits 0x%08x were pending\n", + inta & ~il->inta_mask); + IL_WARN(il, " with FH_INT = 0x%08x\n", inta_fh); } /* Re-enable all interrupts */ /* only Re-enable if disabled by irq */ - if (test_bit(STATUS_INT_ENABLED, &priv->status)) - il_enable_interrupts(priv); + if (test_bit(STATUS_INT_ENABLED, &il->status)) + il_enable_interrupts(il); /* Re-enable RF_KILL if it occurred */ else if (handled & CSR_INT_BIT_RF_KILL) - il_enable_rfkill_int(priv); + il_enable_rfkill_int(il); #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG - if (il_get_debug_level(priv) & (IL_DL_ISR)) { - inta = il_read32(priv, CSR_INT); - inta_mask = il_read32(priv, CSR_INT_MASK); - inta_fh = il_read32(priv, CSR_FH_INT_STATUS); - IL_DEBUG_ISR(priv, + if (il_get_debug_level(il) & (IL_DL_ISR)) { + inta = il_read32(il, CSR_INT); + inta_mask = il_read32(il, CSR_INT_MASK); + inta_fh = il_read32(il, CSR_FH_INT_STATUS); + IL_DEBUG_ISR(il, "End inta 0x%08x, enabled 0x%08x, fh 0x%08x, " "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags); } @@ -980,24 +980,24 @@ static void il4965_irq_tasklet(struct il_priv *priv) static ssize_t il4965_show_debug_level(struct device *d, struct device_attribute *attr, char *buf) { - struct il_priv *priv = dev_get_drvdata(d); - return sprintf(buf, "0x%08X\n", il_get_debug_level(priv)); + struct il_priv *il = dev_get_drvdata(d); + return sprintf(buf, "0x%08X\n", il_get_debug_level(il)); } static ssize_t il4965_store_debug_level(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct il_priv *priv = dev_get_drvdata(d); + struct il_priv *il = dev_get_drvdata(d); unsigned long val; int ret; ret = strict_strtoul(buf, 0, &val); if (ret) - IL_ERR(priv, "%s is not in hex or decimal form.\n", buf); + IL_ERR(il, "%s is not in hex or decimal form.\n", buf); else { - priv->debug_level = val; - if (il_alloc_traffic_mem(priv)) - IL_ERR(priv, + il->debug_level = val; + if (il_alloc_traffic_mem(il)) + IL_ERR(il, "Not enough memory to generate traffic log\n"); } return strnlen(buf, count); @@ -1013,12 +1013,12 @@ static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO, static ssize_t il4965_show_temperature(struct device *d, struct device_attribute *attr, char *buf) { - struct il_priv *priv = dev_get_drvdata(d); + struct il_priv *il = dev_get_drvdata(d); - if (!il_is_alive(priv)) + if (!il_is_alive(il)) return -EAGAIN; - return sprintf(buf, "%d\n", priv->temperature); + return sprintf(buf, "%d\n", il->temperature); } static DEVICE_ATTR(temperature, S_IRUGO, il4965_show_temperature, NULL); @@ -1026,29 +1026,29 @@ static DEVICE_ATTR(temperature, S_IRUGO, il4965_show_temperature, NULL); static ssize_t il4965_show_tx_power(struct device *d, struct device_attribute *attr, char *buf) { - struct il_priv *priv = dev_get_drvdata(d); + struct il_priv *il = dev_get_drvdata(d); - if (!il_is_ready_rf(priv)) + if (!il_is_ready_rf(il)) return sprintf(buf, "off\n"); else - return sprintf(buf, "%d\n", priv->tx_power_user_lmt); + return sprintf(buf, "%d\n", il->tx_power_user_lmt); } static ssize_t il4965_store_tx_power(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { - struct il_priv *priv = dev_get_drvdata(d); + struct il_priv *il = dev_get_drvdata(d); unsigned long val; int ret; ret = strict_strtoul(buf, 10, &val); if (ret) - IL_INFO(priv, "%s is not in decimal form.\n", buf); + IL_INFO(il, "%s is not in decimal form.\n", buf); else { - ret = il_set_tx_power(priv, val, false); + ret = il_set_tx_power(il, val, false); if (ret) - IL_ERR(priv, "failed setting tx power (0x%d).\n", + IL_ERR(il, "failed setting tx power (0x%d).\n", ret); else ret = count; @@ -1079,52 +1079,52 @@ static struct attribute_group il_attribute_group = { * ******************************************************************************/ -static void il4965_dealloc_ucode_pci(struct il_priv *priv) +static void il4965_dealloc_ucode_pci(struct il_priv *il) { - il_free_fw_desc(priv->pci_dev, &priv->ucode_code); - il_free_fw_desc(priv->pci_dev, &priv->ucode_data); - il_free_fw_desc(priv->pci_dev, &priv->ucode_data_backup); - il_free_fw_desc(priv->pci_dev, &priv->ucode_init); - il_free_fw_desc(priv->pci_dev, &priv->ucode_init_data); - il_free_fw_desc(priv->pci_dev, &priv->ucode_boot); + il_free_fw_desc(il->pci_dev, &il->ucode_code); + il_free_fw_desc(il->pci_dev, &il->ucode_data); + il_free_fw_desc(il->pci_dev, &il->ucode_data_backup); + il_free_fw_desc(il->pci_dev, &il->ucode_init); + il_free_fw_desc(il->pci_dev, &il->ucode_init_data); + il_free_fw_desc(il->pci_dev, &il->ucode_boot); } -static void il4965_nic_start(struct il_priv *priv) +static void il4965_nic_start(struct il_priv *il) { /* Remove all resets to allow NIC to operate */ - il_write32(priv, CSR_RESET, 0); + il_write32(il, CSR_RESET, 0); } static void il4965_ucode_callback(const struct firmware *ucode_raw, void *context); -static int il4965_mac_setup_register(struct il_priv *priv, +static int il4965_mac_setup_register(struct il_priv *il, u32 max_probe_length); -static int __must_check il4965_request_firmware(struct il_priv *priv, bool first) +static int __must_check il4965_request_firmware(struct il_priv *il, bool first) { - const char *name_pre = priv->cfg->fw_name_pre; + const char *name_pre = il->cfg->fw_name_pre; char tag[8]; if (first) { - priv->fw_index = priv->cfg->ucode_api_max; - sprintf(tag, "%d", priv->fw_index); + il->fw_index = il->cfg->ucode_api_max; + sprintf(tag, "%d", il->fw_index); } else { - priv->fw_index--; - sprintf(tag, "%d", priv->fw_index); + il->fw_index--; + sprintf(tag, "%d", il->fw_index); } - if (priv->fw_index < priv->cfg->ucode_api_min) { - IL_ERR(priv, "no suitable firmware found!\n"); + if (il->fw_index < il->cfg->ucode_api_min) { + IL_ERR(il, "no suitable firmware found!\n"); return -ENOENT; } - sprintf(priv->firmware_name, "%s%s%s", name_pre, tag, ".ucode"); + sprintf(il->firmware_name, "%s%s%s", name_pre, tag, ".ucode"); - IL_DEBUG_INFO(priv, "attempting to load firmware '%s'\n", - priv->firmware_name); + IL_DEBUG_INFO(il, "attempting to load firmware '%s'\n", + il->firmware_name); - return request_firmware_nowait(THIS_MODULE, 1, priv->firmware_name, - &priv->pci_dev->dev, GFP_KERNEL, priv, + return request_firmware_nowait(THIS_MODULE, 1, il->firmware_name, + &il->pci_dev->dev, GFP_KERNEL, il, il4965_ucode_callback); } @@ -1133,7 +1133,7 @@ struct il4965_firmware_pieces { size_t inst_size, data_size, init_size, init_data_size, boot_size; }; -static int il4965_load_firmware(struct il_priv *priv, +static int il4965_load_firmware(struct il_priv *il, const struct firmware *ucode_raw, struct il4965_firmware_pieces *pieces) { @@ -1141,8 +1141,8 @@ static int il4965_load_firmware(struct il_priv *priv, u32 api_ver, hdr_size; const u8 *src; - priv->ucode_ver = le32_to_cpu(ucode->ver); - api_ver = IL_UCODE_API(priv->ucode_ver); + il->ucode_ver = le32_to_cpu(ucode->ver); + api_ver = IL_UCODE_API(il->ucode_ver); switch (api_ver) { default: @@ -1151,7 +1151,7 @@ static int il4965_load_firmware(struct il_priv *priv, case 2: hdr_size = 24; if (ucode_raw->size < hdr_size) { - IL_ERR(priv, "File size too small!\n"); + IL_ERR(il, "File size too small!\n"); return -EINVAL; } pieces->inst_size = le32_to_cpu(ucode->v1.inst_size); @@ -1169,7 +1169,7 @@ static int il4965_load_firmware(struct il_priv *priv, pieces->data_size + pieces->init_size + pieces->init_data_size + pieces->boot_size) { - IL_ERR(priv, + IL_ERR(il, "uCode file size %d does not match expected size\n", (int)ucode_raw->size); return -EINVAL; @@ -1198,12 +1198,12 @@ static int il4965_load_firmware(struct il_priv *priv, static void il4965_ucode_callback(const struct firmware *ucode_raw, void *context) { - struct il_priv *priv = context; + struct il_priv *il = context; struct il_ucode_header *ucode; int err; struct il4965_firmware_pieces pieces; - const unsigned int api_max = priv->cfg->ucode_api_max; - const unsigned int api_min = priv->cfg->ucode_api_min; + const unsigned int api_max = il->cfg->ucode_api_max; + const unsigned int api_min = il->cfg->ucode_api_min; u32 api_ver; u32 max_probe_length = 200; @@ -1213,31 +1213,31 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context) memset(&pieces, 0, sizeof(pieces)); if (!ucode_raw) { - if (priv->fw_index <= priv->cfg->ucode_api_max) - IL_ERR(priv, + if (il->fw_index <= il->cfg->ucode_api_max) + IL_ERR(il, "request for firmware file '%s' failed.\n", - priv->firmware_name); + il->firmware_name); goto try_again; } - IL_DEBUG_INFO(priv, "Loaded firmware file '%s' (%zd bytes).\n", - priv->firmware_name, ucode_raw->size); + IL_DEBUG_INFO(il, "Loaded firmware file '%s' (%zd bytes).\n", + il->firmware_name, ucode_raw->size); /* Make sure that we got at least the API version number */ if (ucode_raw->size < 4) { - IL_ERR(priv, "File size way too small!\n"); + IL_ERR(il, "File size way too small!\n"); goto try_again; } /* Data from ucode file: header followed by uCode images */ ucode = (struct il_ucode_header *)ucode_raw->data; - err = il4965_load_firmware(priv, ucode_raw, &pieces); + err = il4965_load_firmware(il, ucode_raw, &pieces); if (err) goto try_again; - api_ver = IL_UCODE_API(priv->ucode_ver); + api_ver = IL_UCODE_API(il->ucode_ver); /* * api_ver should match the api version forming part of the @@ -1245,7 +1245,7 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context) * on the API version read from firmware header from here on forward */ if (api_ver < api_min || api_ver > api_max) { - IL_ERR(priv, + IL_ERR(il, "Driver unable to support your firmware API. " "Driver supports v%u, firmware is v%u.\n", api_max, api_ver); @@ -1253,25 +1253,25 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context) } if (api_ver != api_max) - IL_ERR(priv, + IL_ERR(il, "Firmware has old API version. Expected v%u, " "got v%u. New firmware can be obtained " "from http://www.intellinuxwireless.org.\n", api_max, api_ver); - IL_INFO(priv, "loaded firmware version %u.%u.%u.%u\n", - IL_UCODE_MAJOR(priv->ucode_ver), - IL_UCODE_MINOR(priv->ucode_ver), - IL_UCODE_API(priv->ucode_ver), - IL_UCODE_SERIAL(priv->ucode_ver)); + IL_INFO(il, "loaded firmware version %u.%u.%u.%u\n", + IL_UCODE_MAJOR(il->ucode_ver), + IL_UCODE_MINOR(il->ucode_ver), + IL_UCODE_API(il->ucode_ver), + IL_UCODE_SERIAL(il->ucode_ver)); - snprintf(priv->hw->wiphy->fw_version, - sizeof(priv->hw->wiphy->fw_version), + snprintf(il->hw->wiphy->fw_version, + sizeof(il->hw->wiphy->fw_version), "%u.%u.%u.%u", - IL_UCODE_MAJOR(priv->ucode_ver), - IL_UCODE_MINOR(priv->ucode_ver), - IL_UCODE_API(priv->ucode_ver), - IL_UCODE_SERIAL(priv->ucode_ver)); + IL_UCODE_MAJOR(il->ucode_ver), + IL_UCODE_MINOR(il->ucode_ver), + IL_UCODE_API(il->ucode_ver), + IL_UCODE_SERIAL(il->ucode_ver)); /* * For any of the failures below (before allocating pci memory) @@ -1279,46 +1279,46 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context) * user just got a corrupted version of the latest API. */ - IL_DEBUG_INFO(priv, "f/w package hdr ucode version raw = 0x%x\n", - priv->ucode_ver); - IL_DEBUG_INFO(priv, "f/w package hdr runtime inst size = %Zd\n", + IL_DEBUG_INFO(il, "f/w package hdr ucode version raw = 0x%x\n", + il->ucode_ver); + IL_DEBUG_INFO(il, "f/w package hdr runtime inst size = %Zd\n", pieces.inst_size); - IL_DEBUG_INFO(priv, "f/w package hdr runtime data size = %Zd\n", + IL_DEBUG_INFO(il, "f/w package hdr runtime data size = %Zd\n", pieces.data_size); - IL_DEBUG_INFO(priv, "f/w package hdr init inst size = %Zd\n", + IL_DEBUG_INFO(il, "f/w package hdr init inst size = %Zd\n", pieces.init_size); - IL_DEBUG_INFO(priv, "f/w package hdr init data size = %Zd\n", + IL_DEBUG_INFO(il, "f/w package hdr init data size = %Zd\n", pieces.init_data_size); - IL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %Zd\n", + IL_DEBUG_INFO(il, "f/w package hdr boot inst size = %Zd\n", pieces.boot_size); /* Verify that uCode images will fit in card's SRAM */ - if (pieces.inst_size > priv->hw_params.max_inst_size) { - IL_ERR(priv, "uCode instr len %Zd too large to fit in\n", + if (pieces.inst_size > il->hw_params.max_inst_size) { + IL_ERR(il, "uCode instr len %Zd too large to fit in\n", pieces.inst_size); goto try_again; } - if (pieces.data_size > priv->hw_params.max_data_size) { - IL_ERR(priv, "uCode data len %Zd too large to fit in\n", + if (pieces.data_size > il->hw_params.max_data_size) { + IL_ERR(il, "uCode data len %Zd too large to fit in\n", pieces.data_size); goto try_again; } - if (pieces.init_size > priv->hw_params.max_inst_size) { - IL_ERR(priv, "uCode init instr len %Zd too large to fit in\n", + if (pieces.init_size > il->hw_params.max_inst_size) { + IL_ERR(il, "uCode init instr len %Zd too large to fit in\n", pieces.init_size); goto try_again; } - if (pieces.init_data_size > priv->hw_params.max_data_size) { - IL_ERR(priv, "uCode init data len %Zd too large to fit in\n", + if (pieces.init_data_size > il->hw_params.max_data_size) { + IL_ERR(il, "uCode init data len %Zd too large to fit in\n", pieces.init_data_size); goto try_again; } - if (pieces.boot_size > priv->hw_params.max_bsm_size) { - IL_ERR(priv, "uCode boot instr len %Zd too large to fit in\n", + if (pieces.boot_size > il->hw_params.max_bsm_size) { + IL_ERR(il, "uCode boot instr len %Zd too large to fit in\n", pieces.boot_size); goto try_again; } @@ -1328,92 +1328,92 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context) /* Runtime instructions and 2 copies of data: * 1) unmodified from disk * 2) backup cache for save/restore during power-downs */ - priv->ucode_code.len = pieces.inst_size; - il_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); + il->ucode_code.len = pieces.inst_size; + il_alloc_fw_desc(il->pci_dev, &il->ucode_code); - priv->ucode_data.len = pieces.data_size; - il_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); + il->ucode_data.len = pieces.data_size; + il_alloc_fw_desc(il->pci_dev, &il->ucode_data); - priv->ucode_data_backup.len = pieces.data_size; - il_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); + il->ucode_data_backup.len = pieces.data_size; + il_alloc_fw_desc(il->pci_dev, &il->ucode_data_backup); - if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr || - !priv->ucode_data_backup.v_addr) + if (!il->ucode_code.v_addr || !il->ucode_data.v_addr || + !il->ucode_data_backup.v_addr) goto err_pci_alloc; /* Initialization instructions and data */ if (pieces.init_size && pieces.init_data_size) { - priv->ucode_init.len = pieces.init_size; - il_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); + il->ucode_init.len = pieces.init_size; + il_alloc_fw_desc(il->pci_dev, &il->ucode_init); - priv->ucode_init_data.len = pieces.init_data_size; - il_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); + il->ucode_init_data.len = pieces.init_data_size; + il_alloc_fw_desc(il->pci_dev, &il->ucode_init_data); - if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr) + if (!il->ucode_init.v_addr || !il->ucode_init_data.v_addr) goto err_pci_alloc; } /* Bootstrap (instructions only, no data) */ if (pieces.boot_size) { - priv->ucode_boot.len = pieces.boot_size; - il_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); + il->ucode_boot.len = pieces.boot_size; + il_alloc_fw_desc(il->pci_dev, &il->ucode_boot); - if (!priv->ucode_boot.v_addr) + if (!il->ucode_boot.v_addr) goto err_pci_alloc; } /* Now that we can no longer fail, copy information */ - priv->sta_key_max_num = STA_KEY_MAX_NUM; + il->sta_key_max_num = STA_KEY_MAX_NUM; /* Copy images into buffers for card's bus-master reads ... */ /* Runtime instructions (first block of data in file) */ - IL_DEBUG_INFO(priv, "Copying (but not loading) uCode instr len %Zd\n", + IL_DEBUG_INFO(il, "Copying (but not loading) uCode instr len %Zd\n", pieces.inst_size); - memcpy(priv->ucode_code.v_addr, pieces.inst, pieces.inst_size); + memcpy(il->ucode_code.v_addr, pieces.inst, pieces.inst_size); - IL_DEBUG_INFO(priv, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n", - priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr); + IL_DEBUG_INFO(il, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n", + il->ucode_code.v_addr, (u32)il->ucode_code.p_addr); /* * Runtime data * NOTE: Copy into backup buffer will be done in il_up() */ - IL_DEBUG_INFO(priv, "Copying (but not loading) uCode data len %Zd\n", + IL_DEBUG_INFO(il, "Copying (but not loading) uCode data len %Zd\n", pieces.data_size); - memcpy(priv->ucode_data.v_addr, pieces.data, pieces.data_size); - memcpy(priv->ucode_data_backup.v_addr, pieces.data, pieces.data_size); + memcpy(il->ucode_data.v_addr, pieces.data, pieces.data_size); + memcpy(il->ucode_data_backup.v_addr, pieces.data, pieces.data_size); /* Initialization instructions */ if (pieces.init_size) { - IL_DEBUG_INFO(priv, + IL_DEBUG_INFO(il, "Copying (but not loading) init instr len %Zd\n", pieces.init_size); - memcpy(priv->ucode_init.v_addr, pieces.init, pieces.init_size); + memcpy(il->ucode_init.v_addr, pieces.init, pieces.init_size); } /* Initialization data */ if (pieces.init_data_size) { - IL_DEBUG_INFO(priv, + IL_DEBUG_INFO(il, "Copying (but not loading) init data len %Zd\n", pieces.init_data_size); - memcpy(priv->ucode_init_data.v_addr, pieces.init_data, + memcpy(il->ucode_init_data.v_addr, pieces.init_data, pieces.init_data_size); } /* Bootstrap instructions */ - IL_DEBUG_INFO(priv, "Copying (but not loading) boot instr len %Zd\n", + IL_DEBUG_INFO(il, "Copying (but not loading) boot instr len %Zd\n", pieces.boot_size); - memcpy(priv->ucode_boot.v_addr, pieces.boot, pieces.boot_size); + memcpy(il->ucode_boot.v_addr, pieces.boot, pieces.boot_size); /* * figure out the offset of chain noise reset and gain commands * base on the size of standard phy calibration commands table size */ - priv->_4965.phy_calib_chain_noise_reset_cmd = + il->_4965.phy_calib_chain_noise_reset_cmd = standard_phy_calibration_size; - priv->_4965.phy_calib_chain_noise_gain_cmd = + il->_4965.phy_calib_chain_noise_gain_cmd = standard_phy_calibration_size + 1; /************************************************** @@ -1421,40 +1421,40 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context) * * 9. Setup and register with mac80211 and debugfs **************************************************/ - err = il4965_mac_setup_register(priv, max_probe_length); + err = il4965_mac_setup_register(il, max_probe_length); if (err) goto out_unbind; - err = il_dbgfs_register(priv, DRV_NAME); + err = il_dbgfs_register(il, DRV_NAME); if (err) - IL_ERR(priv, + IL_ERR(il, "failed to create debugfs files. Ignoring error: %d\n", err); - err = sysfs_create_group(&priv->pci_dev->dev.kobj, + err = sysfs_create_group(&il->pci_dev->dev.kobj, &il_attribute_group); if (err) { - IL_ERR(priv, "failed to create sysfs device attributes\n"); + IL_ERR(il, "failed to create sysfs device attributes\n"); goto out_unbind; } /* We have our copies now, allow OS release its copies */ release_firmware(ucode_raw); - complete(&priv->_4965.firmware_loading_complete); + complete(&il->_4965.firmware_loading_complete); return; try_again: /* try next, if any */ - if (il4965_request_firmware(priv, false)) + if (il4965_request_firmware(il, false)) goto out_unbind; release_firmware(ucode_raw); return; err_pci_alloc: - IL_ERR(priv, "failed to allocate pci memory\n"); - il4965_dealloc_ucode_pci(priv); + IL_ERR(il, "failed to allocate pci memory\n"); + il4965_dealloc_ucode_pci(il); out_unbind: - complete(&priv->_4965.firmware_loading_complete); - device_release_driver(&priv->pci_dev->dev); + complete(&il->_4965.firmware_loading_complete); + device_release_driver(&il->pci_dev->dev); release_firmware(ucode_raw); } @@ -1527,79 +1527,79 @@ static const char *il4965_desc_lookup(u32 num) #define ERROR_START_OFFSET (1 * sizeof(u32)) #define ERROR_ELEM_SIZE (7 * sizeof(u32)) -void il4965_dump_nic_error_log(struct il_priv *priv) +void il4965_dump_nic_error_log(struct il_priv *il) { u32 data2, line; u32 desc, time, count, base, data1; u32 blink1, blink2, ilink1, ilink2; u32 pc, hcmd; - if (priv->ucode_type == UCODE_INIT) { - base = le32_to_cpu(priv->card_alive_init.error_event_table_ptr); + if (il->ucode_type == UCODE_INIT) { + base = le32_to_cpu(il->card_alive_init.error_event_table_ptr); } else { - base = le32_to_cpu(priv->card_alive.error_event_table_ptr); + base = le32_to_cpu(il->card_alive.error_event_table_ptr); } - if (!priv->cfg->ops->lib->is_valid_rtc_data_addr(base)) { - IL_ERR(priv, + if (!il->cfg->ops->lib->is_valid_rtc_data_addr(base)) { + IL_ERR(il, "Not valid error log pointer 0x%08X for %s uCode\n", - base, (priv->ucode_type == UCODE_INIT) ? "Init" : "RT"); + base, (il->ucode_type == UCODE_INIT) ? "Init" : "RT"); return; } - count = il_read_targ_mem(priv, base); + count = il_read_targ_mem(il, base); if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { - IL_ERR(priv, "Start IWL Error Log Dump:\n"); - IL_ERR(priv, "Status: 0x%08lX, count: %d\n", - priv->status, count); - } - - desc = il_read_targ_mem(priv, base + 1 * sizeof(u32)); - priv->isr_stats.err_code = desc; - pc = il_read_targ_mem(priv, base + 2 * sizeof(u32)); - blink1 = il_read_targ_mem(priv, base + 3 * sizeof(u32)); - blink2 = il_read_targ_mem(priv, base + 4 * sizeof(u32)); - ilink1 = il_read_targ_mem(priv, base + 5 * sizeof(u32)); - ilink2 = il_read_targ_mem(priv, base + 6 * sizeof(u32)); - data1 = il_read_targ_mem(priv, base + 7 * sizeof(u32)); - data2 = il_read_targ_mem(priv, base + 8 * sizeof(u32)); - line = il_read_targ_mem(priv, base + 9 * sizeof(u32)); - time = il_read_targ_mem(priv, base + 11 * sizeof(u32)); - hcmd = il_read_targ_mem(priv, base + 22 * sizeof(u32)); - - IL_ERR(priv, "Desc Time " + IL_ERR(il, "Start IWL Error Log Dump:\n"); + IL_ERR(il, "Status: 0x%08lX, count: %d\n", + il->status, count); + } + + desc = il_read_targ_mem(il, base + 1 * sizeof(u32)); + il->isr_stats.err_code = desc; + pc = il_read_targ_mem(il, base + 2 * sizeof(u32)); + blink1 = il_read_targ_mem(il, base + 3 * sizeof(u32)); + blink2 = il_read_targ_mem(il, base + 4 * sizeof(u32)); + ilink1 = il_read_targ_mem(il, base + 5 * sizeof(u32)); + ilink2 = il_read_targ_mem(il, base + 6 * sizeof(u32)); + data1 = il_read_targ_mem(il, base + 7 * sizeof(u32)); + data2 = il_read_targ_mem(il, base + 8 * sizeof(u32)); + line = il_read_targ_mem(il, base + 9 * sizeof(u32)); + time = il_read_targ_mem(il, base + 11 * sizeof(u32)); + hcmd = il_read_targ_mem(il, base + 22 * sizeof(u32)); + + IL_ERR(il, "Desc Time " "data1 data2 line\n"); - IL_ERR(priv, "%-28s (0x%04X) %010u 0x%08X 0x%08X %u\n", + IL_ERR(il, "%-28s (0x%04X) %010u 0x%08X 0x%08X %u\n", il4965_desc_lookup(desc), desc, time, data1, data2, line); - IL_ERR(priv, "pc blink1 blink2 ilink1 ilink2 hcmd\n"); - IL_ERR(priv, "0x%05X 0x%05X 0x%05X 0x%05X 0x%05X 0x%05X\n", + IL_ERR(il, "pc blink1 blink2 ilink1 ilink2 hcmd\n"); + IL_ERR(il, "0x%05X 0x%05X 0x%05X 0x%05X 0x%05X 0x%05X\n", pc, blink1, blink2, ilink1, ilink2, hcmd); } -static void il4965_rf_kill_ct_config(struct il_priv *priv) +static void il4965_rf_kill_ct_config(struct il_priv *il) { struct il_ct_kill_config cmd; unsigned long flags; int ret = 0; - spin_lock_irqsave(&priv->lock, flags); - il_write32(priv, CSR_UCODE_DRV_GP1_CLR, + spin_lock_irqsave(&il->lock, flags); + il_write32(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&il->lock, flags); cmd.critical_temperature_R = - cpu_to_le32(priv->hw_params.ct_kill_threshold); + cpu_to_le32(il->hw_params.ct_kill_threshold); - ret = il_send_cmd_pdu(priv, REPLY_CT_KILL_CONFIG_CMD, + ret = il_send_cmd_pdu(il, REPLY_CT_KILL_CONFIG_CMD, sizeof(cmd), &cmd); if (ret) - IL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n"); + IL_ERR(il, "REPLY_CT_KILL_CONFIG_CMD failed\n"); else - IL_DEBUG_INFO(priv, "REPLY_CT_KILL_CONFIG_CMD " + IL_DEBUG_INFO(il, "REPLY_CT_KILL_CONFIG_CMD " "succeeded, " "critical temperature is %d\n", - priv->hw_params.ct_kill_threshold); + il->hw_params.ct_kill_threshold); } static const s8 default_queue_to_tx_fifo[] = { @@ -1612,62 +1612,62 @@ static const s8 default_queue_to_tx_fifo[] = { IL_TX_FIFO_UNUSED, }; -static int il4965_alive_notify(struct il_priv *priv) +static int il4965_alive_notify(struct il_priv *il) { u32 a; unsigned long flags; int i, chan; u32 reg_val; - spin_lock_irqsave(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); /* Clear 4965's internal Tx Scheduler data base */ - priv->scd_base_addr = il_read_prph(priv, + il->scd_base_addr = il_read_prph(il, IWL49_SCD_SRAM_BASE_ADDR); - a = priv->scd_base_addr + IWL49_SCD_CONTEXT_DATA_OFFSET; - for (; a < priv->scd_base_addr + IWL49_SCD_TX_STTS_BITMAP_OFFSET; a += 4) - il_write_targ_mem(priv, a, 0); - for (; a < priv->scd_base_addr + IWL49_SCD_TRANSLATE_TBL_OFFSET; a += 4) - il_write_targ_mem(priv, a, 0); - for (; a < priv->scd_base_addr + - IWL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(priv->hw_params.max_txq_num); a += 4) - il_write_targ_mem(priv, a, 0); + a = il->scd_base_addr + IWL49_SCD_CONTEXT_DATA_OFFSET; + for (; a < il->scd_base_addr + IWL49_SCD_TX_STTS_BITMAP_OFFSET; a += 4) + il_write_targ_mem(il, a, 0); + for (; a < il->scd_base_addr + IWL49_SCD_TRANSLATE_TBL_OFFSET; a += 4) + il_write_targ_mem(il, a, 0); + for (; a < il->scd_base_addr + + IWL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(il->hw_params.max_txq_num); a += 4) + il_write_targ_mem(il, a, 0); /* Tel 4965 where to find Tx byte count tables */ - il_write_prph(priv, IWL49_SCD_DRAM_BASE_ADDR, - priv->scd_bc_tbls.dma >> 10); + il_write_prph(il, IWL49_SCD_DRAM_BASE_ADDR, + il->scd_bc_tbls.dma >> 10); /* Enable DMA channel */ for (chan = 0; chan < FH49_TCSR_CHNL_NUM ; chan++) - il_write_direct32(priv, + il_write_direct32(il, FH_TCSR_CHNL_TX_CONFIG_REG(chan), FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE); /* Update FH chicken bits */ - reg_val = il_read_direct32(priv, FH_TX_CHICKEN_BITS_REG); - il_write_direct32(priv, FH_TX_CHICKEN_BITS_REG, + reg_val = il_read_direct32(il, FH_TX_CHICKEN_BITS_REG); + il_write_direct32(il, FH_TX_CHICKEN_BITS_REG, reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN); /* Disable chain mode for all queues */ - il_write_prph(priv, IWL49_SCD_QUEUECHAIN_SEL, 0); + il_write_prph(il, IWL49_SCD_QUEUECHAIN_SEL, 0); /* Initialize each Tx queue (including the command queue) */ - for (i = 0; i < priv->hw_params.max_txq_num; i++) { + for (i = 0; i < il->hw_params.max_txq_num; i++) { /* TFD circular buffer read/write indexes */ - il_write_prph(priv, IWL49_SCD_QUEUE_RDPTR(i), 0); - il_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8)); + il_write_prph(il, IWL49_SCD_QUEUE_RDPTR(i), 0); + il_write_direct32(il, HBUS_TARG_WRPTR, 0 | (i << 8)); /* Max Tx Window size for Scheduler-ACK mode */ - il_write_targ_mem(priv, priv->scd_base_addr + + il_write_targ_mem(il, il->scd_base_addr + IWL49_SCD_CONTEXT_QUEUE_OFFSET(i), (SCD_WIN_SIZE << IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK); /* Frame limit */ - il_write_targ_mem(priv, priv->scd_base_addr + + il_write_targ_mem(il, il->scd_base_addr + IWL49_SCD_CONTEXT_QUEUE_OFFSET(i) + sizeof(u32), (SCD_FRAME_LIMIT << @@ -1675,36 +1675,36 @@ static int il4965_alive_notify(struct il_priv *priv) IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); } - il_write_prph(priv, IWL49_SCD_INTERRUPT_MASK, - (1 << priv->hw_params.max_txq_num) - 1); + il_write_prph(il, IWL49_SCD_INTERRUPT_MASK, + (1 << il->hw_params.max_txq_num) - 1); /* Activate all Tx DMA/FIFO channels */ - il4965_txq_set_sched(priv, IL_MASK(0, 6)); + il4965_txq_set_sched(il, IL_MASK(0, 6)); - il4965_set_wr_ptrs(priv, IL_DEFAULT_CMD_QUEUE_NUM, 0); + il4965_set_wr_ptrs(il, IL_DEFAULT_CMD_QUEUE_NUM, 0); /* make sure all queue are not stopped */ - memset(&priv->queue_stopped[0], 0, sizeof(priv->queue_stopped)); + memset(&il->queue_stopped[0], 0, sizeof(il->queue_stopped)); for (i = 0; i < 4; i++) - atomic_set(&priv->queue_stop_count[i], 0); + atomic_set(&il->queue_stop_count[i], 0); /* reset to 0 to enable all the queue first */ - priv->txq_ctx_active_msk = 0; + il->txq_ctx_active_msk = 0; /* Map each Tx/cmd queue to its corresponding fifo */ BUILD_BUG_ON(ARRAY_SIZE(default_queue_to_tx_fifo) != 7); for (i = 0; i < ARRAY_SIZE(default_queue_to_tx_fifo); i++) { int ac = default_queue_to_tx_fifo[i]; - il_txq_ctx_activate(priv, i); + il_txq_ctx_activate(il, i); if (ac == IL_TX_FIFO_UNUSED) continue; - il4965_tx_queue_set_status(priv, &priv->txq[i], ac, 0); + il4965_tx_queue_set_status(il, &il->txq[i], ac, 0); } - spin_unlock_irqrestore(&priv->lock, flags); + spin_unlock_irqrestore(&il->lock, flags); return 0; } @@ -1714,50 +1714,50 @@ static int il4965_alive_notify(struct il_priv *priv) * from protocol/runtime uCode (initialization uCode's * Alive gets handled by il_init_alive_start()). */ -static void il4965_alive_start(struct il_priv *priv) +static void il4965_alive_start(struct il_priv *il) { int ret = 0; - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; - IL_DEBUG_INFO(priv, "Runtime Alive received.\n"); + IL_DEBUG_INFO(il, "Runtime Alive received.\n"); - if (priv->card_alive.is_valid != UCODE_VALID_OK) { + if (il->card_alive.is_valid != UCODE_VALID_OK) { /* We had an error bringing up the hardware, so take it * all the way back down so we can try again */ - IL_DEBUG_INFO(priv, "Alive failed.\n"); + IL_DEBUG_INFO(il, "Alive failed.\n"); goto restart; } /* Initialize uCode has loaded Runtime uCode ... verify inst image. * This is a paranoid check, because we would not have gotten the * "runtime" alive if code weren't properly loaded. */ - if (il4965_verify_ucode(priv)) { + if (il4965_verify_ucode(il)) { /* Runtime instruction load was bad; * take it all the way back down so we can try again */ - IL_DEBUG_INFO(priv, "Bad runtime uCode load.\n"); + IL_DEBUG_INFO(il, "Bad runtime uCode load.\n"); goto restart; } - ret = il4965_alive_notify(priv); + ret = il4965_alive_notify(il); if (ret) { - IL_WARN(priv, + IL_WARN(il, "Could not complete ALIVE transition [ntf]: %d\n", ret); goto restart; } /* After the ALIVE response, we can send host commands to the uCode */ - set_bit(STATUS_ALIVE, &priv->status); + set_bit(STATUS_ALIVE, &il->status); /* Enable watchdog to monitor the driver tx queues */ - il_setup_watchdog(priv); + il_setup_watchdog(il); - if (il_is_rfkill(priv)) + if (il_is_rfkill(il)) return; - ieee80211_wake_queues(priv->hw); + ieee80211_wake_queues(il->hw); - priv->active_rate = IL_RATES_MASK; + il->active_rate = IL_RATES_MASK; if (il_is_associated_ctx(ctx)) { struct il_rxon_cmd *active_rxon = @@ -1768,290 +1768,290 @@ static void il4965_alive_start(struct il_priv *priv) } else { struct il_rxon_context *tmp; /* Initialize our rx_config data */ - for_each_context(priv, tmp) - il_connection_init_rx_config(priv, tmp); + for_each_context(il, tmp) + il_connection_init_rx_config(il, tmp); - if (priv->cfg->ops->hcmd->set_rxon_chain) - priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); + if (il->cfg->ops->hcmd->set_rxon_chain) + il->cfg->ops->hcmd->set_rxon_chain(il, ctx); } /* Configure bluetooth coexistence if enabled */ - il_send_bt_config(priv); + il_send_bt_config(il); - il4965_reset_run_time_calib(priv); + il4965_reset_run_time_calib(il); - set_bit(STATUS_READY, &priv->status); + set_bit(STATUS_READY, &il->status); /* Configure the adapter for unassociated operation */ - il_commit_rxon(priv, ctx); + il_commit_rxon(il, ctx); /* At this point, the NIC is initialized and operational */ - il4965_rf_kill_ct_config(priv); + il4965_rf_kill_ct_config(il); - IL_DEBUG_INFO(priv, "ALIVE processing complete.\n"); - wake_up(&priv->wait_command_queue); + IL_DEBUG_INFO(il, "ALIVE processing complete.\n"); + wake_up(&il->wait_command_queue); - il_power_update_mode(priv, true); - IL_DEBUG_INFO(priv, "Updated power mode\n"); + il_power_update_mode(il, true); + IL_DEBUG_INFO(il, "Updated power mode\n"); return; restart: - queue_work(priv->workqueue, &priv->restart); + queue_work(il->workqueue, &il->restart); } -static void il4965_cancel_deferred_work(struct il_priv *priv); +static void il4965_cancel_deferred_work(struct il_priv *il); -static void __il4965_down(struct il_priv *priv) +static void __il4965_down(struct il_priv *il) { unsigned long flags; int exit_pending; - IL_DEBUG_INFO(priv, DRV_NAME " is going down\n"); + IL_DEBUG_INFO(il, DRV_NAME " is going down\n"); - il_scan_cancel_timeout(priv, 200); + il_scan_cancel_timeout(il, 200); - exit_pending = test_and_set_bit(STATUS_EXIT_PENDING, &priv->status); + exit_pending = test_and_set_bit(STATUS_EXIT_PENDING, &il->status); /* Stop TX queues watchdog. We need to have STATUS_EXIT_PENDING bit set * to prevent rearm timer */ - del_timer_sync(&priv->watchdog); + del_timer_sync(&il->watchdog); - il_clear_ucode_stations(priv, NULL); - il_dealloc_bcast_stations(priv); - il_clear_driver_stations(priv); + il_clear_ucode_stations(il, NULL); + il_dealloc_bcast_stations(il); + il_clear_driver_stations(il); /* Unblock any waiting calls */ - wake_up_all(&priv->wait_command_queue); + wake_up_all(&il->wait_command_queue); /* Wipe out the EXIT_PENDING status bit if we are not actually * exiting the module */ if (!exit_pending) - clear_bit(STATUS_EXIT_PENDING, &priv->status); + clear_bit(STATUS_EXIT_PENDING, &il->status); /* stop and reset the on-board processor */ - il_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); + il_write32(il, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); /* tell the device to stop sending interrupts */ - spin_lock_irqsave(&priv->lock, flags); - il_disable_interrupts(priv); - spin_unlock_irqrestore(&priv->lock, flags); - il4965_synchronize_irq(priv); + spin_lock_irqsave(&il->lock, flags); + il_disable_interrupts(il); + spin_unlock_irqrestore(&il->lock, flags); + il4965_synchronize_irq(il); - if (priv->mac80211_registered) - ieee80211_stop_queues(priv->hw); + if (il->mac80211_registered) + ieee80211_stop_queues(il->hw); /* If we have not previously called il_init() then * clear all bits but the RF Kill bit and return */ - if (!il_is_init(priv)) { - priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << + if (!il_is_init(il)) { + il->status = test_bit(STATUS_RF_KILL_HW, &il->status) << STATUS_RF_KILL_HW | - test_bit(STATUS_GEO_CONFIGURED, &priv->status) << + test_bit(STATUS_GEO_CONFIGURED, &il->status) << STATUS_GEO_CONFIGURED | - test_bit(STATUS_EXIT_PENDING, &priv->status) << + test_bit(STATUS_EXIT_PENDING, &il->status) << STATUS_EXIT_PENDING; goto exit; } /* ...otherwise clear out all the status bits but the RF Kill * bit and continue taking the NIC down. */ - priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) << + il->status &= test_bit(STATUS_RF_KILL_HW, &il->status) << STATUS_RF_KILL_HW | - test_bit(STATUS_GEO_CONFIGURED, &priv->status) << + test_bit(STATUS_GEO_CONFIGURED, &il->status) << STATUS_GEO_CONFIGURED | - test_bit(STATUS_FW_ERROR, &priv->status) << + test_bit(STATUS_FW_ERROR, &il->status) << STATUS_FW_ERROR | - test_bit(STATUS_EXIT_PENDING, &priv->status) << + test_bit(STATUS_EXIT_PENDING, &il->status) << STATUS_EXIT_PENDING; - il4965_txq_ctx_stop(priv); - il4965_rxq_stop(priv); + il4965_txq_ctx_stop(il); + il4965_rxq_stop(il); /* Power-down device's busmaster DMA clocks */ - il_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); + il_write_prph(il, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); udelay(5); /* Make sure (redundant) we've released our request to stay awake */ - il_clear_bit(priv, CSR_GP_CNTRL, + il_clear_bit(il, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); /* Stop the device, and put it in low power state */ - il_apm_stop(priv); + il_apm_stop(il); exit: - memset(&priv->card_alive, 0, sizeof(struct il_alive_resp)); + memset(&il->card_alive, 0, sizeof(struct il_alive_resp)); - dev_kfree_skb(priv->beacon_skb); - priv->beacon_skb = NULL; + dev_kfree_skb(il->beacon_skb); + il->beacon_skb = NULL; /* clear out any free frames */ - il4965_clear_free_frames(priv); + il4965_clear_free_frames(il); } -static void il4965_down(struct il_priv *priv) +static void il4965_down(struct il_priv *il) { - mutex_lock(&priv->mutex); - __il4965_down(priv); - mutex_unlock(&priv->mutex); + mutex_lock(&il->mutex); + __il4965_down(il); + mutex_unlock(&il->mutex); - il4965_cancel_deferred_work(priv); + il4965_cancel_deferred_work(il); } #define HW_READY_TIMEOUT (50) -static int il4965_set_hw_ready(struct il_priv *priv) +static int il4965_set_hw_ready(struct il_priv *il) { int ret = 0; - il_set_bit(priv, CSR_HW_IF_CONFIG_REG, + il_set_bit(il, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_BIT_NIC_READY); /* 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_NIC_READY, CSR_HW_IF_CONFIG_REG_BIT_NIC_READY, HW_READY_TIMEOUT); if (ret != -ETIMEDOUT) - priv->hw_ready = true; + il->hw_ready = true; else - priv->hw_ready = false; + il->hw_ready = false; - IL_DEBUG_INFO(priv, "hardware %s\n", - (priv->hw_ready == 1) ? "ready" : "not ready"); + IL_DEBUG_INFO(il, "hardware %s\n", + (il->hw_ready == 1) ? "ready" : "not ready"); return ret; } -static int il4965_prepare_card_hw(struct il_priv *priv) +static int il4965_prepare_card_hw(struct il_priv *il) { int ret = 0; - IL_DEBUG_INFO(priv, "il4965_prepare_card_hw enter\n"); + IL_DEBUG_INFO(il, "il4965_prepare_card_hw enter\n"); - ret = il4965_set_hw_ready(priv); - if (priv->hw_ready) + ret = il4965_set_hw_ready(il); + if (il->hw_ready) return ret; /* If HW is not ready, prepare the conditions to check again */ - il_set_bit(priv, CSR_HW_IF_CONFIG_REG, + il_set_bit(il, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_PREPARE); - 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_NIC_PREPARE_DONE, CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, 150000); /* HW should be ready by now, check again. */ if (ret != -ETIMEDOUT) - il4965_set_hw_ready(priv); + il4965_set_hw_ready(il); return ret; } #define MAX_HW_RESTARTS 5 -static int __il4965_up(struct il_priv *priv) +static int __il4965_up(struct il_priv *il) { struct il_rxon_context *ctx; int i; int ret; - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { - IL_WARN(priv, "Exit pending; will not bring the NIC up\n"); + if (test_bit(STATUS_EXIT_PENDING, &il->status)) { + IL_WARN(il, "Exit pending; will not bring the NIC up\n"); return -EIO; } - if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) { - IL_ERR(priv, "ucode not available for device bringup\n"); + if (!il->ucode_data_backup.v_addr || !il->ucode_data.v_addr) { + IL_ERR(il, "ucode not available for device bringup\n"); return -EIO; } - for_each_context(priv, ctx) { - ret = il4965_alloc_bcast_station(priv, ctx); + for_each_context(il, ctx) { + ret = il4965_alloc_bcast_station(il, ctx); if (ret) { - il_dealloc_bcast_stations(priv); + il_dealloc_bcast_stations(il); return ret; } } - il4965_prepare_card_hw(priv); + il4965_prepare_card_hw(il); - if (!priv->hw_ready) { - IL_WARN(priv, "Exit HW not ready\n"); + if (!il->hw_ready) { + IL_WARN(il, "Exit HW not ready\n"); return -EIO; } /* If platform's RF_KILL switch is NOT set to KILL */ - if (il_read32(priv, + if (il_read32(il, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) - clear_bit(STATUS_RF_KILL_HW, &priv->status); + clear_bit(STATUS_RF_KILL_HW, &il->status); else - set_bit(STATUS_RF_KILL_HW, &priv->status); + set_bit(STATUS_RF_KILL_HW, &il->status); - if (il_is_rfkill(priv)) { - wiphy_rfkill_set_hw_state(priv->hw->wiphy, true); + if (il_is_rfkill(il)) { + wiphy_rfkill_set_hw_state(il->hw->wiphy, true); - il_enable_interrupts(priv); - IL_WARN(priv, "Radio disabled by HW RF Kill switch\n"); + il_enable_interrupts(il); + IL_WARN(il, "Radio disabled by HW RF Kill switch\n"); return 0; } - il_write32(priv, CSR_INT, 0xFFFFFFFF); + il_write32(il, CSR_INT, 0xFFFFFFFF); /* must be initialised before il_hw_nic_init */ - priv->cmd_queue = IL_DEFAULT_CMD_QUEUE_NUM; + il->cmd_queue = IL_DEFAULT_CMD_QUEUE_NUM; - ret = il4965_hw_nic_init(priv); + ret = il4965_hw_nic_init(il); if (ret) { - IL_ERR(priv, "Unable to init nic\n"); + IL_ERR(il, "Unable to init nic\n"); return ret; } /* make sure rfkill handshake bits are cleared */ - il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - il_write32(priv, CSR_UCODE_DRV_GP1_CLR, + il_write32(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + il_write32(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); /* clear (again), then enable host interrupts */ - il_write32(priv, CSR_INT, 0xFFFFFFFF); - il_enable_interrupts(priv); + il_write32(il, CSR_INT, 0xFFFFFFFF); + il_enable_interrupts(il); /* really make sure rfkill handshake bits are cleared */ - il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + il_write32(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); + il_write32(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); /* Copy original ucode data image from disk into backup cache. * This will be used to initialize the on-board processor's * data SRAM for a clean start when the runtime program first loads. */ - memcpy(priv->ucode_data_backup.v_addr, priv->ucode_data.v_addr, - priv->ucode_data.len); + memcpy(il->ucode_data_backup.v_addr, il->ucode_data.v_addr, + il->ucode_data.len); for (i = 0; i < MAX_HW_RESTARTS; i++) { /* load bootstrap state machine, * load bootstrap program into processor's memory, * prepare to load the "initialize" uCode */ - ret = priv->cfg->ops->lib->load_ucode(priv); + ret = il->cfg->ops->lib->load_ucode(il); if (ret) { - IL_ERR(priv, "Unable to set up bootstrap uCode: %d\n", + IL_ERR(il, "Unable to set up bootstrap uCode: %d\n", ret); continue; } /* start card; "initialize" will load runtime ucode */ - il4965_nic_start(priv); + il4965_nic_start(il); - IL_DEBUG_INFO(priv, DRV_NAME " is coming up\n"); + IL_DEBUG_INFO(il, DRV_NAME " is coming up\n"); return 0; } - set_bit(STATUS_EXIT_PENDING, &priv->status); - __il4965_down(priv); - clear_bit(STATUS_EXIT_PENDING, &priv->status); + set_bit(STATUS_EXIT_PENDING, &il->status); + __il4965_down(il); + clear_bit(STATUS_EXIT_PENDING, &il->status); /* tried to restart and config the device for as long as our * patience could withstand */ - IL_ERR(priv, "Unable to initialize device after %d attempts.\n", i); + IL_ERR(il, "Unable to initialize device after %d attempts.\n", i); return -EIO; } @@ -2064,100 +2064,100 @@ static int __il4965_up(struct il_priv *priv) static void il4965_bg_init_alive_start(struct work_struct *data) { - struct il_priv *priv = + struct il_priv *il = container_of(data, struct il_priv, init_alive_start.work); - mutex_lock(&priv->mutex); - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) + mutex_lock(&il->mutex); + if (test_bit(STATUS_EXIT_PENDING, &il->status)) goto out; - priv->cfg->ops->lib->init_alive_start(priv); + il->cfg->ops->lib->init_alive_start(il); out: - mutex_unlock(&priv->mutex); + mutex_unlock(&il->mutex); } static void il4965_bg_alive_start(struct work_struct *data) { - struct il_priv *priv = + struct il_priv *il = container_of(data, struct il_priv, alive_start.work); - mutex_lock(&priv->mutex); - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) + mutex_lock(&il->mutex); + if (test_bit(STATUS_EXIT_PENDING, &il->status)) goto out; - il4965_alive_start(priv); + il4965_alive_start(il); out: - mutex_unlock(&priv->mutex); + mutex_unlock(&il->mutex); } static void il4965_bg_run_time_calib_work(struct work_struct *work) { - struct il_priv *priv = container_of(work, struct il_priv, + struct il_priv *il = container_of(work, struct il_priv, run_time_calib_work); - mutex_lock(&priv->mutex); + mutex_lock(&il->mutex); - if (test_bit(STATUS_EXIT_PENDING, &priv->status) || - test_bit(STATUS_SCANNING, &priv->status)) { - mutex_unlock(&priv->mutex); + if (test_bit(STATUS_EXIT_PENDING, &il->status) || + test_bit(STATUS_SCANNING, &il->status)) { + mutex_unlock(&il->mutex); return; } - if (priv->start_calib) { - il4965_chain_noise_calibration(priv, - (void *)&priv->_4965.statistics); - il4965_sensitivity_calibration(priv, - (void *)&priv->_4965.statistics); + if (il->start_calib) { + il4965_chain_noise_calibration(il, + (void *)&il->_4965.statistics); + il4965_sensitivity_calibration(il, + (void *)&il->_4965.statistics); } - mutex_unlock(&priv->mutex); + mutex_unlock(&il->mutex); } static void il4965_bg_restart(struct work_struct *data) { - struct il_priv *priv = container_of(data, struct il_priv, restart); + struct il_priv *il = container_of(data, struct il_priv, restart); - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) + if (test_bit(STATUS_EXIT_PENDING, &il->status)) return; - if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) { + if (test_and_clear_bit(STATUS_FW_ERROR, &il->status)) { struct il_rxon_context *ctx; - mutex_lock(&priv->mutex); - for_each_context(priv, ctx) + mutex_lock(&il->mutex); + for_each_context(il, ctx) ctx->vif = NULL; - priv->is_open = 0; + il->is_open = 0; - __il4965_down(priv); + __il4965_down(il); - mutex_unlock(&priv->mutex); - il4965_cancel_deferred_work(priv); - ieee80211_restart_hw(priv->hw); + mutex_unlock(&il->mutex); + il4965_cancel_deferred_work(il); + ieee80211_restart_hw(il->hw); } else { - il4965_down(priv); + il4965_down(il); - mutex_lock(&priv->mutex); - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { - mutex_unlock(&priv->mutex); + mutex_lock(&il->mutex); + if (test_bit(STATUS_EXIT_PENDING, &il->status)) { + mutex_unlock(&il->mutex); return; } - __il4965_up(priv); - mutex_unlock(&priv->mutex); + __il4965_up(il); + mutex_unlock(&il->mutex); } } static void il4965_bg_rx_replenish(struct work_struct *data) { - struct il_priv *priv = + struct il_priv *il = container_of(data, struct il_priv, rx_replenish); - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) + if (test_bit(STATUS_EXIT_PENDING, &il->status)) return; - mutex_lock(&priv->mutex); - il4965_rx_replenish(priv); - mutex_unlock(&priv->mutex); + mutex_lock(&il->mutex); + il4965_rx_replenish(il); + mutex_unlock(&il->mutex); } /***************************************************************************** @@ -2172,11 +2172,11 @@ static void il4965_bg_rx_replenish(struct work_struct *data) * Not a mac80211 entry point function, but it fits in with all the * other mac80211 functions grouped here. */ -static int il4965_mac_setup_register(struct il_priv *priv, +static int il4965_mac_setup_register(struct il_priv *il, u32 max_probe_length) { int ret; - struct ieee80211_hw *hw = priv->hw; + struct ieee80211_hw *hw = il->hw; struct il_rxon_context *ctx; hw->rate_control_algorithm = "iwl-4965-rs"; @@ -2188,14 +2188,14 @@ static int il4965_mac_setup_register(struct il_priv *priv, IEEE80211_HW_SPECTRUM_MGMT | IEEE80211_HW_REPORTS_TX_ACK_STATUS; - if (priv->cfg->sku & IL_SKU_N) + if (il->cfg->sku & IL_SKU_N) hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | IEEE80211_HW_SUPPORTS_STATIC_SMPS; hw->sta_data_size = sizeof(struct il_station_priv); hw->vif_data_size = sizeof(struct il_vif_priv); - for_each_context(priv, ctx) { + for_each_context(il, ctx) { hw->wiphy->interface_modes |= ctx->interface_modes; hw->wiphy->interface_modes |= ctx->exclusive_interface_modes; } @@ -2218,21 +2218,21 @@ static int il4965_mac_setup_register(struct il_priv *priv, hw->max_listen_interval = IL_CONN_MAX_LISTEN_INTERVAL; - if (priv->bands[IEEE80211_BAND_2GHZ].n_channels) - priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = - &priv->bands[IEEE80211_BAND_2GHZ]; - if (priv->bands[IEEE80211_BAND_5GHZ].n_channels) - priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = - &priv->bands[IEEE80211_BAND_5GHZ]; + if (il->bands[IEEE80211_BAND_2GHZ].n_channels) + il->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = + &il->bands[IEEE80211_BAND_2GHZ]; + if (il->bands[IEEE80211_BAND_5GHZ].n_channels) + il->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = + &il->bands[IEEE80211_BAND_5GHZ]; - il_leds_init(priv); + il_leds_init(il); - ret = ieee80211_register_hw(priv->hw); + ret = ieee80211_register_hw(il->hw); if (ret) { - IL_ERR(priv, "Failed to register hw (error %d)\n", ret); + IL_ERR(il, "Failed to register hw (error %d)\n", ret); return ret; } - priv->mac80211_registered = 1; + il->mac80211_registered = 1; return 0; } @@ -2240,81 +2240,81 @@ static int il4965_mac_setup_register(struct il_priv *priv, int il4965_mac_start(struct ieee80211_hw *hw) { - 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"); /* we should be verifying the device is ready to be opened */ - mutex_lock(&priv->mutex); - ret = __il4965_up(priv); - mutex_unlock(&priv->mutex); + mutex_lock(&il->mutex); + ret = __il4965_up(il); + mutex_unlock(&il->mutex); if (ret) return ret; - if (il_is_rfkill(priv)) + if (il_is_rfkill(il)) goto out; - IL_DEBUG_INFO(priv, "Start UP work done.\n"); + IL_DEBUG_INFO(il, "Start UP work done.\n"); /* Wait for START_ALIVE from Run Time ucode. Otherwise callbacks from * mac80211 will not be run successfully. */ - ret = wait_event_timeout(priv->wait_command_queue, - test_bit(STATUS_READY, &priv->status), + ret = wait_event_timeout(il->wait_command_queue, + test_bit(STATUS_READY, &il->status), UCODE_READY_TIMEOUT); if (!ret) { - if (!test_bit(STATUS_READY, &priv->status)) { - IL_ERR(priv, "START_ALIVE timeout after %dms.\n", + if (!test_bit(STATUS_READY, &il->status)) { + IL_ERR(il, "START_ALIVE timeout after %dms.\n", jiffies_to_msecs(UCODE_READY_TIMEOUT)); return -ETIMEDOUT; } } - il4965_led_enable(priv); + il4965_led_enable(il); out: - priv->is_open = 1; - IL_DEBUG_MAC80211(priv, "leave\n"); + il->is_open = 1; + IL_DEBUG_MAC80211(il, "leave\n"); return 0; } void il4965_mac_stop(struct ieee80211_hw *hw) { - struct il_priv *priv = hw->priv; + struct il_priv *il = hw->priv; - IL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(il, "enter\n"); - if (!priv->is_open) + if (!il->is_open) return; - priv->is_open = 0; + il->is_open = 0; - il4965_down(priv); + il4965_down(il); - flush_workqueue(priv->workqueue); + flush_workqueue(il->workqueue); /* User space software may expect getting rfkill changes * even if interface is down */ - il_write32(priv, CSR_INT, 0xFFFFFFFF); - il_enable_rfkill_int(priv); + il_write32(il, CSR_INT, 0xFFFFFFFF); + il_enable_rfkill_int(il); - IL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(il, "leave\n"); } void il4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) { - struct il_priv *priv = hw->priv; + struct il_priv *il = hw->priv; - IL_DEBUG_MACDUMP(priv, "enter\n"); + IL_DEBUG_MACDUMP(il, "enter\n"); - IL_DEBUG_TX(priv, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, + IL_DEBUG_TX(il, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); - if (il4965_tx_skb(priv, skb)) + if (il4965_tx_skb(il, skb)) dev_kfree_skb_any(skb); - IL_DEBUG_MACDUMP(priv, "leave\n"); + IL_DEBUG_MACDUMP(il, "leave\n"); } void il4965_mac_update_tkip_key(struct ieee80211_hw *hw, @@ -2323,41 +2323,41 @@ void il4965_mac_update_tkip_key(struct ieee80211_hw *hw, struct ieee80211_sta *sta, u32 iv32, u16 *phase1key) { - struct il_priv *priv = hw->priv; + struct il_priv *il = hw->priv; struct il_vif_priv *vif_priv = (void *)vif->drv_priv; - IL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(il, "enter\n"); - il4965_update_tkip_key(priv, vif_priv->ctx, keyconf, sta, + il4965_update_tkip_key(il, vif_priv->ctx, keyconf, sta, iv32, phase1key); - IL_DEBUG_MAC80211(priv, "leave\n"); + IL_DEBUG_MAC80211(il, "leave\n"); } int il4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct ieee80211_key_conf *key) { - struct il_priv *priv = hw->priv; + struct il_priv *il = hw->priv; struct il_vif_priv *vif_priv = (void *)vif->drv_priv; struct il_rxon_context *ctx = vif_priv->ctx; int ret; u8 sta_id; bool is_default_wep_key = false; - IL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(il, "enter\n"); - if (priv->cfg->mod_params->sw_crypto) { - IL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n"); + if (il->cfg->mod_params->sw_crypto) { + IL_DEBUG_MAC80211(il, "leave - hwcrypto disabled\n"); return -EOPNOTSUPP; } - sta_id = il_sta_id_or_broadcast(priv, vif_priv->ctx, sta); + sta_id = il_sta_id_or_broadcast(il, vif_priv->ctx, sta); if (sta_id == IL_INVALID_STATION) return -EINVAL; - mutex_lock(&priv->mutex); - il_scan_cancel_timeout(priv, 100); + mutex_lock(&il->mutex); + il_scan_cancel_timeout(il, 100); /* * If we are getting WEP group key and we didn't receive any key mapping @@ -2378,29 +2378,29 @@ int il4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, switch (cmd) { case SET_KEY: if (is_default_wep_key) - ret = il4965_set_default_wep_key(priv, + ret = il4965_set_default_wep_key(il, vif_priv->ctx, key); else - ret = il4965_set_dynamic_key(priv, vif_priv->ctx, + ret = il4965_set_dynamic_key(il, vif_priv->ctx, key, sta_id); - IL_DEBUG_MAC80211(priv, "enable hwcrypto key\n"); + IL_DEBUG_MAC80211(il, "enable hwcrypto key\n"); break; case DISABLE_KEY: if (is_default_wep_key) - ret = il4965_remove_default_wep_key(priv, ctx, key); + ret = il4965_remove_default_wep_key(il, ctx, key); else - ret = il4965_remove_dynamic_key(priv, ctx, + ret = il4965_remove_dynamic_key(il, ctx, key, sta_id); - IL_DEBUG_MAC80211(priv, "disable hwcrypto key\n"); + IL_DEBUG_MAC80211(il, "disable hwcrypto key\n"); break; default: ret = -EINVAL; } - mutex_unlock(&priv->mutex); - IL_DEBUG_MAC80211(priv, "leave\n"); + mutex_unlock(&il->mutex); + IL_DEBUG_MAC80211(il, "leave\n"); return ret; } @@ -2411,43 +2411,43 @@ int il4965_mac_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_sta *sta, u16 tid, u16 *ssn, u8 buf_size) { - struct il_priv *priv = hw->priv; + struct il_priv *il = hw->priv; int ret = -EINVAL; - IL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n", + IL_DEBUG_HT(il, "A-MPDU action on addr %pM tid %d\n", sta->addr, tid); - if (!(priv->cfg->sku & IL_SKU_N)) + if (!(il->cfg->sku & IL_SKU_N)) return -EACCES; - mutex_lock(&priv->mutex); + mutex_lock(&il->mutex); switch (action) { case IEEE80211_AMPDU_RX_START: - IL_DEBUG_HT(priv, "start Rx\n"); - ret = il4965_sta_rx_agg_start(priv, sta, tid, *ssn); + IL_DEBUG_HT(il, "start Rx\n"); + ret = il4965_sta_rx_agg_start(il, sta, tid, *ssn); break; case IEEE80211_AMPDU_RX_STOP: - IL_DEBUG_HT(priv, "stop Rx\n"); - ret = il4965_sta_rx_agg_stop(priv, sta, tid); - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) + IL_DEBUG_HT(il, "stop Rx\n"); + ret = il4965_sta_rx_agg_stop(il, sta, tid); + if (test_bit(STATUS_EXIT_PENDING, &il->status)) ret = 0; break; case IEEE80211_AMPDU_TX_START: - IL_DEBUG_HT(priv, "start Tx\n"); - ret = il4965_tx_agg_start(priv, vif, sta, tid, ssn); + IL_DEBUG_HT(il, "start Tx\n"); + ret = il4965_tx_agg_start(il, vif, sta, tid, ssn); break; case IEEE80211_AMPDU_TX_STOP: - IL_DEBUG_HT(priv, "stop Tx\n"); - ret = il4965_tx_agg_stop(priv, vif, sta, tid); - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) + IL_DEBUG_HT(il, "stop Tx\n"); + ret = il4965_tx_agg_stop(il, vif, sta, tid); + if (test_bit(STATUS_EXIT_PENDING, &il->status)) ret = 0; break; case IEEE80211_AMPDU_TX_OPERATIONAL: ret = 0; break; } - mutex_unlock(&priv->mutex); + mutex_unlock(&il->mutex); return ret; } @@ -2456,39 +2456,39 @@ int il4965_mac_sta_add(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 *sta_priv = (void *)sta->drv_priv; struct il_vif_priv *vif_priv = (void *)vif->drv_priv; bool is_ap = vif->type == NL80211_IFTYPE_STATION; int ret; u8 sta_id; - IL_DEBUG_INFO(priv, "received request to add station %pM\n", + IL_DEBUG_INFO(il, "received request to add station %pM\n", sta->addr); - mutex_lock(&priv->mutex); - IL_DEBUG_INFO(priv, "proceeding to add station %pM\n", + mutex_lock(&il->mutex); + IL_DEBUG_INFO(il, "proceeding to add station %pM\n", sta->addr); sta_priv->common.sta_id = IL_INVALID_STATION; atomic_set(&sta_priv->pending_frames, 0); - ret = il_add_station_common(priv, vif_priv->ctx, sta->addr, + ret = il_add_station_common(il, vif_priv->ctx, sta->addr, is_ap, sta, &sta_id); if (ret) { - IL_ERR(priv, "Unable to add station %pM (%d)\n", + IL_ERR(il, "Unable to add station %pM (%d)\n", sta->addr, ret); /* Should we return success if return code is EEXIST ? */ - mutex_unlock(&priv->mutex); + mutex_unlock(&il->mutex); return ret; } sta_priv->common.sta_id = sta_id; /* Initialize rate scaling */ - IL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", + IL_DEBUG_INFO(il, "Initializing rate scaling for station %pM\n", sta->addr); - il4965_rs_rate_init(priv, sta, sta_id); - mutex_unlock(&priv->mutex); + il4965_rs_rate_init(il, sta, sta_id); + mutex_unlock(&il->mutex); return 0; } @@ -2496,46 +2496,46 @@ int il4965_mac_sta_add(struct ieee80211_hw *hw, void il4965_mac_channel_switch(struct ieee80211_hw *hw, struct ieee80211_channel_switch *ch_switch) { - struct il_priv *priv = hw->priv; + struct il_priv *il = hw->priv; const struct il_channel_info *ch_info; struct ieee80211_conf *conf = &hw->conf; struct ieee80211_channel *channel = ch_switch->channel; - struct il_ht_config *ht_conf = &priv->current_ht_config; + struct il_ht_config *ht_conf = &il->current_ht_config; - struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; + struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; u16 ch; - IL_DEBUG_MAC80211(priv, "enter\n"); + IL_DEBUG_MAC80211(il, "enter\n"); - mutex_lock(&priv->mutex); + mutex_lock(&il->mutex); - if (il_is_rfkill(priv)) + if (il_is_rfkill(il)) goto out; - if (test_bit(STATUS_EXIT_PENDING, &priv->status) || - test_bit(STATUS_SCANNING, &priv->status) || - test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) + if (test_bit(STATUS_EXIT_PENDING, &il->status) || + test_bit(STATUS_SCANNING, &il->status) || + test_bit(STATUS_CHANNEL_SWITCH_PENDING, &il->status)) goto out; if (!il_is_associated_ctx(ctx)) goto out; - if (!priv->cfg->ops->lib->set_channel_switch) + if (!il->cfg->ops->lib->set_channel_switch) goto out; ch = channel->hw_value; if (le16_to_cpu(ctx->active.channel) == ch) goto out; - ch_info = il_get_channel_info(priv, channel->band, ch); + ch_info = il_get_channel_info(il, channel->band, ch); if (!il_is_channel_valid(ch_info)) { - IL_DEBUG_MAC80211(priv, "invalid channel\n"); + IL_DEBUG_MAC80211(il, "invalid channel\n"); goto out; } - spin_lock_irq(&priv->lock); + spin_lock_irq(&il->lock); - priv->current_ht_config.smps = conf->smps_mode; + il->current_ht_config.smps = conf->smps_mode; /* Configure HT40 channels */ ctx->ht.enabled = conf_is_ht(conf); @@ -2559,28 +2559,28 @@ void il4965_mac_channel_switch(struct ieee80211_hw *hw, if ((le16_to_cpu(ctx->staging.channel) != ch)) ctx->staging.flags = 0; - il_set_rxon_channel(priv, channel, ctx); - il_set_rxon_ht(priv, ht_conf); - il_set_flags_for_band(priv, ctx, channel->band, ctx->vif); + il_set_rxon_channel(il, channel, ctx); + il_set_rxon_ht(il, ht_conf); + il_set_flags_for_band(il, ctx, channel->band, ctx->vif); - spin_unlock_irq(&priv->lock); + spin_unlock_irq(&il->lock); - il_set_rate(priv); + il_set_rate(il); /* * at this point, staging_rxon has the * configuration for channel switch */ - set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status); - priv->switch_channel = cpu_to_le16(ch); - if (priv->cfg->ops->lib->set_channel_switch(priv, ch_switch)) { - clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status); - priv->switch_channel = 0; + set_bit(STATUS_CHANNEL_SWITCH_PENDING, &il->status); + il->switch_channel = cpu_to_le16(ch); + if (il->cfg->ops->lib->set_channel_switch(il, ch_switch)) { + clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &il->status); + il->switch_channel = 0; ieee80211_chswitch_done(ctx->vif, false); } out: - mutex_unlock(&priv->mutex); - IL_DEBUG_MAC80211(priv, "leave\n"); + mutex_unlock(&il->mutex); + IL_DEBUG_MAC80211(il, "leave\n"); } void il4965_configure_filter(struct ieee80211_hw *hw, @@ -2588,7 +2588,7 @@ void il4965_configure_filter(struct ieee80211_hw *hw, unsigned int *total_flags, u64 multicast) { - struct il_priv *priv = hw->priv; + struct il_priv *il = hw->priv; __le32 filter_or = 0, filter_nand = 0; struct il_rxon_context *ctx; @@ -2599,7 +2599,7 @@ void il4965_configure_filter(struct ieee80211_hw *hw, filter_nand |= (flag); \ } while (0) - IL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", + IL_DEBUG_MAC80211(il, "Enter: changed: 0x%x, total: 0x%x\n", changed_flags, *total_flags); CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); @@ -2609,9 +2609,9 @@ void il4965_configure_filter(struct ieee80211_hw *hw, #undef CHK - mutex_lock(&priv->mutex); + mutex_lock(&il->mutex); - for_each_context(priv, ctx) { + for_each_context(il, ctx) { ctx->staging.filter_flags &= ~filter_nand; ctx->staging.filter_flags |= filter_or; @@ -2621,7 +2621,7 @@ void il4965_configure_filter(struct ieee80211_hw *hw, */ } - mutex_unlock(&priv->mutex); + mutex_unlock(&il->mutex); /* * Receiving all multicast frames is always enabled by the @@ -2641,72 +2641,72 @@ void il4965_configure_filter(struct ieee80211_hw *hw, static void il4965_bg_txpower_work(struct work_struct *work) { - struct il_priv *priv = container_of(work, struct il_priv, + struct il_priv *il = container_of(work, struct il_priv, txpower_work); - mutex_lock(&priv->mutex); + mutex_lock(&il->mutex); /* If a scan happened to start before we got here * then just return; the statistics notification will * kick off another scheduled work to compensate for * any temperature delta we missed here. */ - if (test_bit(STATUS_EXIT_PENDING, &priv->status) || - test_bit(STATUS_SCANNING, &priv->status)) + if (test_bit(STATUS_EXIT_PENDING, &il->status) || + test_bit(STATUS_SCANNING, &il->status)) goto out; /* Regardless of if we are associated, we must reconfigure the * TX power since frames can be sent on non-radar channels while * not associated */ - priv->cfg->ops->lib->send_tx_power(priv); + il->cfg->ops->lib->send_tx_power(il); /* Update last_temperature to keep is_calib_needed from running * when it isn't needed... */ - priv->last_temperature = priv->temperature; + il->last_temperature = il->temperature; out: - mutex_unlock(&priv->mutex); + mutex_unlock(&il->mutex); } -static void il4965_setup_deferred_work(struct il_priv *priv) +static void il4965_setup_deferred_work(struct il_priv *il) { - priv->workqueue = create_singlethread_workqueue(DRV_NAME); + il->workqueue = create_singlethread_workqueue(DRV_NAME); - init_waitqueue_head(&priv->wait_command_queue); + init_waitqueue_head(&il->wait_command_queue); - INIT_WORK(&priv->restart, il4965_bg_restart); - INIT_WORK(&priv->rx_replenish, il4965_bg_rx_replenish); - INIT_WORK(&priv->run_time_calib_work, il4965_bg_run_time_calib_work); - INIT_DELAYED_WORK(&priv->init_alive_start, il4965_bg_init_alive_start); - INIT_DELAYED_WORK(&priv->alive_start, il4965_bg_alive_start); + INIT_WORK(&il->restart, il4965_bg_restart); + INIT_WORK(&il->rx_replenish, il4965_bg_rx_replenish); + INIT_WORK(&il->run_time_calib_work, il4965_bg_run_time_calib_work); + INIT_DELAYED_WORK(&il->init_alive_start, il4965_bg_init_alive_start); + INIT_DELAYED_WORK(&il->alive_start, il4965_bg_alive_start); - il_setup_scan_deferred_work(priv); + il_setup_scan_deferred_work(il); - INIT_WORK(&priv->txpower_work, il4965_bg_txpower_work); + INIT_WORK(&il->txpower_work, il4965_bg_txpower_work); - init_timer(&priv->statistics_periodic); - priv->statistics_periodic.data = (unsigned long)priv; - priv->statistics_periodic.function = il4965_bg_statistics_periodic; + init_timer(&il->statistics_periodic); + il->statistics_periodic.data = (unsigned long)il; + il->statistics_periodic.function = il4965_bg_statistics_periodic; - init_timer(&priv->watchdog); - priv->watchdog.data = (unsigned long)priv; - priv->watchdog.function = il_bg_watchdog; + init_timer(&il->watchdog); + il->watchdog.data = (unsigned long)il; + il->watchdog.function = il_bg_watchdog; - tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) - il4965_irq_tasklet, (unsigned long)priv); + tasklet_init(&il->irq_tasklet, (void (*)(unsigned long)) + il4965_irq_tasklet, (unsigned long)il); } -static void il4965_cancel_deferred_work(struct il_priv *priv) +static void il4965_cancel_deferred_work(struct il_priv *il) { - cancel_work_sync(&priv->txpower_work); - cancel_delayed_work_sync(&priv->init_alive_start); - cancel_delayed_work(&priv->alive_start); - cancel_work_sync(&priv->run_time_calib_work); + cancel_work_sync(&il->txpower_work); + cancel_delayed_work_sync(&il->init_alive_start); + cancel_delayed_work(&il->alive_start); + cancel_work_sync(&il->run_time_calib_work); - il_cancel_scan_deferred_work(priv); + il_cancel_scan_deferred_work(il); - del_timer_sync(&priv->statistics_periodic); + del_timer_sync(&il->statistics_periodic); } -static void il4965_init_hw_rates(struct il_priv *priv, +static void il4965_init_hw_rates(struct il_priv *il, struct ieee80211_rate *rates) { int i; @@ -2727,26 +2727,26 @@ static void il4965_init_hw_rates(struct il_priv *priv, } } /* - * 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) { - il_write_direct32(priv, HBUS_TARG_WRPTR, + il_write_direct32(il, HBUS_TARG_WRPTR, (index & 0xff) | (txq_id << 8)); - il_write_prph(priv, IWL49_SCD_QUEUE_RDPTR(txq_id), index); + il_write_prph(il, IWL49_SCD_QUEUE_RDPTR(txq_id), index); } -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) { int txq_id = txq->q.id; /* Find out whether to activate Tx queue */ - int active = test_bit(txq_id, &priv->txq_ctx_active_msk) ? 1 : 0; + int active = test_bit(txq_id, &il->txq_ctx_active_msk) ? 1 : 0; /* Set up and activate */ - il_write_prph(priv, IWL49_SCD_QUEUE_STATUS_BITS(txq_id), + il_write_prph(il, IWL49_SCD_QUEUE_STATUS_BITS(txq_id), (active << IWL49_SCD_QUEUE_STTS_REG_POS_ACTIVE) | (tx_fifo_id << IWL49_SCD_QUEUE_STTS_REG_POS_TXF) | (scd_retry << IWL49_SCD_QUEUE_STTS_REG_POS_WSL) | @@ -2755,94 +2755,94 @@ void il4965_tx_queue_set_status(struct il_priv *priv, txq->sched_retry = scd_retry; - IL_DEBUG_INFO(priv, "%s %s Queue %d on AC %d\n", + IL_DEBUG_INFO(il, "%s %s Queue %d on AC %d\n", active ? "Activate" : "Deactivate", scd_retry ? "BA" : "AC", txq_id, tx_fifo_id); } -static int il4965_init_drv(struct il_priv *priv) +static int il4965_init_drv(struct il_priv *il) { int ret; - spin_lock_init(&priv->sta_lock); - spin_lock_init(&priv->hcmd_lock); + spin_lock_init(&il->sta_lock); + spin_lock_init(&il->hcmd_lock); - INIT_LIST_HEAD(&priv->free_frames); + INIT_LIST_HEAD(&il->free_frames); - mutex_init(&priv->mutex); + mutex_init(&il->mutex); - priv->ieee_channels = NULL; - priv->ieee_rates = NULL; - priv->band = IEEE80211_BAND_2GHZ; + il->ieee_channels = NULL; + il->ieee_rates = NULL; + il->band = IEEE80211_BAND_2GHZ; - priv->iw_mode = NL80211_IFTYPE_STATION; - priv->current_ht_config.smps = IEEE80211_SMPS_STATIC; - priv->missed_beacon_threshold = IL_MISSED_BEACON_THRESHOLD_DEF; + il->iw_mode = NL80211_IFTYPE_STATION; + il->current_ht_config.smps = IEEE80211_SMPS_STATIC; + il->missed_beacon_threshold = IL_MISSED_BEACON_THRESHOLD_DEF; /* initialize force reset */ - priv->force_reset.reset_duration = IL_DELAY_NEXT_FORCE_FW_RELOAD; + il->force_reset.reset_duration = IL_DELAY_NEXT_FORCE_FW_RELOAD; /* Choose which receivers/antennas to use */ - if (priv->cfg->ops->hcmd->set_rxon_chain) - priv->cfg->ops->hcmd->set_rxon_chain(priv, - &priv->contexts[IL_RXON_CTX_BSS]); + if (il->cfg->ops->hcmd->set_rxon_chain) + il->cfg->ops->hcmd->set_rxon_chain(il, + &il->contexts[IL_RXON_CTX_BSS]); - il_init_scan_params(priv); + il_init_scan_params(il); - ret = il_init_channel_map(priv); + ret = il_init_channel_map(il); if (ret) { - IL_ERR(priv, "initializing regulatory failed: %d\n", ret); + IL_ERR(il, "initializing regulatory failed: %d\n", ret); goto err; } - ret = il_init_geos(priv); + ret = il_init_geos(il); if (ret) { - IL_ERR(priv, "initializing geos failed: %d\n", ret); + IL_ERR(il, "initializing geos failed: %d\n", ret); goto err_free_channel_map; } - il4965_init_hw_rates(priv, priv->ieee_rates); + il4965_init_hw_rates(il, il->ieee_rates); return 0; err_free_channel_map: - il_free_channel_map(priv); + il_free_channel_map(il); err: return ret; } -static void il4965_uninit_drv(struct il_priv *priv) +static void il4965_uninit_drv(struct il_priv *il) { - il4965_calib_free_results(priv); - il_free_geos(priv); - il_free_channel_map(priv); - kfree(priv->scan_cmd); + il4965_calib_free_results(il); + il_free_geos(il); + il_free_channel_map(il); + kfree(il->scan_cmd); } -static void il4965_hw_detect(struct il_priv *priv) +static void il4965_hw_detect(struct il_priv *il) { - priv->hw_rev = _il_read32(priv, CSR_HW_REV); - priv->hw_wa_rev = _il_read32(priv, CSR_HW_REV_WA_REG); - priv->rev_id = priv->pci_dev->revision; - IL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n", priv->rev_id); + il->hw_rev = _il_read32(il, CSR_HW_REV); + il->hw_wa_rev = _il_read32(il, CSR_HW_REV_WA_REG); + il->rev_id = il->pci_dev->revision; + IL_DEBUG_INFO(il, "HW Revision ID = 0x%X\n", il->rev_id); } -static int il4965_set_hw_params(struct il_priv *priv) +static int il4965_set_hw_params(struct il_priv *il) { - priv->hw_params.max_rxq_size = RX_QUEUE_SIZE; - priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG; - if (priv->cfg->mod_params->amsdu_size_8K) - priv->hw_params.rx_page_order = get_order(IL_RX_BUF_SIZE_8K); + il->hw_params.max_rxq_size = RX_QUEUE_SIZE; + il->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG; + if (il->cfg->mod_params->amsdu_size_8K) + il->hw_params.rx_page_order = get_order(IL_RX_BUF_SIZE_8K); else - priv->hw_params.rx_page_order = get_order(IL_RX_BUF_SIZE_4K); + il->hw_params.rx_page_order = get_order(IL_RX_BUF_SIZE_4K); - priv->hw_params.max_beacon_itrvl = IL_MAX_UCODE_BEACON_INTERVAL; + il->hw_params.max_beacon_itrvl = IL_MAX_UCODE_BEACON_INTERVAL; - if (priv->cfg->mod_params->disable_11n) - priv->cfg->sku &= ~IL_SKU_N; + if (il->cfg->mod_params->disable_11n) + il->cfg->sku &= ~IL_SKU_N; /* Device-specific setup */ - return priv->cfg->ops->lib->set_hw_params(priv); + return il->cfg->ops->lib->set_hw_params(il); } static const u8 il4965_bss_ac_to_fifo[] = { @@ -2860,7 +2860,7 @@ static int il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { int err = 0, i; - struct il_priv *priv; + struct il_priv *il; struct ieee80211_hw *hw; struct il_cfg *cfg = (struct il_cfg *)(ent->driver_data); unsigned long flags; @@ -2875,49 +2875,49 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) err = -ENOMEM; goto out; } - priv = hw->priv; - /* At this point both hw and priv are allocated. */ + il = hw->priv; + /* At this point both hw and il are allocated. */ /* * The default context is always valid, * more may be discovered when firmware * is loaded. */ - priv->valid_contexts = BIT(IL_RXON_CTX_BSS); + il->valid_contexts = BIT(IL_RXON_CTX_BSS); for (i = 0; i < NUM_IL_RXON_CTX; i++) - priv->contexts[i].ctxid = i; - - priv->contexts[IL_RXON_CTX_BSS].always_active = true; - priv->contexts[IL_RXON_CTX_BSS].is_active = true; - priv->contexts[IL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON; - priv->contexts[IL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING; - priv->contexts[IL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC; - priv->contexts[IL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM; - priv->contexts[IL_RXON_CTX_BSS].ap_sta_id = IL_AP_ID; - priv->contexts[IL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY; - priv->contexts[IL_RXON_CTX_BSS].ac_to_fifo = il4965_bss_ac_to_fifo; - priv->contexts[IL_RXON_CTX_BSS].ac_to_queue = il4965_bss_ac_to_queue; - priv->contexts[IL_RXON_CTX_BSS].exclusive_interface_modes = + il->contexts[i].ctxid = i; + + il->contexts[IL_RXON_CTX_BSS].always_active = true; + il->contexts[IL_RXON_CTX_BSS].is_active = true; + il->contexts[IL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON; + il->contexts[IL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING; + il->contexts[IL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC; + il->contexts[IL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM; + il->contexts[IL_RXON_CTX_BSS].ap_sta_id = IL_AP_ID; + il->contexts[IL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY; + il->contexts[IL_RXON_CTX_BSS].ac_to_fifo = il4965_bss_ac_to_fifo; + il->contexts[IL_RXON_CTX_BSS].ac_to_queue = il4965_bss_ac_to_queue; + il->contexts[IL_RXON_CTX_BSS].exclusive_interface_modes = BIT(NL80211_IFTYPE_ADHOC); - priv->contexts[IL_RXON_CTX_BSS].interface_modes = + il->contexts[IL_RXON_CTX_BSS].interface_modes = BIT(NL80211_IFTYPE_STATION); - priv->contexts[IL_RXON_CTX_BSS].ap_devtype = RXON_DEV_TYPE_AP; - priv->contexts[IL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS; - priv->contexts[IL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS; - priv->contexts[IL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS; + il->contexts[IL_RXON_CTX_BSS].ap_devtype = RXON_DEV_TYPE_AP; + il->contexts[IL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS; + il->contexts[IL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS; + il->contexts[IL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS; BUILD_BUG_ON(NUM_IL_RXON_CTX != 1); SET_IEEE80211_DEV(hw, &pdev->dev); - IL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n"); - priv->cfg = cfg; - priv->pci_dev = pdev; - priv->inta_mask = CSR_INI_SET_MASK; + IL_DEBUG_INFO(il, "*** LOAD DRIVER ***\n"); + il->cfg = cfg; + il->pci_dev = pdev; + il->inta_mask = CSR_INI_SET_MASK; - if (il_alloc_traffic_mem(priv)) - IL_ERR(priv, "Not enough memory to generate traffic log\n"); + if (il_alloc_traffic_mem(il)) + IL_ERR(il, "Not enough memory to generate traffic log\n"); /************************** * 2. Initializing PCI bus @@ -2942,7 +2942,7 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) DMA_BIT_MASK(32)); /* both attempts failed: */ if (err) { - IL_WARN(priv, "No suitable DMA available.\n"); + IL_WARN(il, "No suitable DMA available.\n"); goto out_pci_disable_device; } } @@ -2951,46 +2951,46 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (err) goto out_pci_disable_device; - pci_set_drvdata(pdev, priv); + pci_set_drvdata(pdev, il); /*********************** * 3. Read REV register ***********************/ - priv->hw_base = pci_iomap(pdev, 0, 0); - if (!priv->hw_base) { + il->hw_base = pci_iomap(pdev, 0, 0); + if (!il->hw_base) { err = -ENODEV; goto out_pci_release_regions; } - IL_DEBUG_INFO(priv, "pci_resource_len = 0x%08llx\n", + IL_DEBUG_INFO(il, "pci_resource_len = 0x%08llx\n", (unsigned long long) pci_resource_len(pdev, 0)); - IL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base); + IL_DEBUG_INFO(il, "pci_resource_base = %p\n", il->hw_base); /* these spin locks will be used in apm_ops.init and EEPROM access * we should init now */ - spin_lock_init(&priv->reg_lock); - spin_lock_init(&priv->lock); + spin_lock_init(&il->reg_lock); + spin_lock_init(&il->lock); /* * stop and reset the on-board processor just in case it is in a * strange state ... like being left stranded by a primary kernel * and this is now the kdump kernel trying to start up */ - il_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); + il_write32(il, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); - il4965_hw_detect(priv); - IL_INFO(priv, "Detected %s, REV=0x%X\n", - priv->cfg->name, priv->hw_rev); + il4965_hw_detect(il); + IL_INFO(il, "Detected %s, REV=0x%X\n", + il->cfg->name, il->hw_rev); /* We disable the RETRY_TIMEOUT register (0x41) to keep * PCI Tx retries from interfering with C3 CPU state */ pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); - il4965_prepare_card_hw(priv); - if (!priv->hw_ready) { - IL_WARN(priv, "Failed, HW not ready\n"); + il4965_prepare_card_hw(il); + if (!il->hw_ready) { + IL_WARN(il, "Failed, HW not ready\n"); goto out_iounmap; } @@ -2998,12 +2998,12 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) * 4. Read EEPROM *****************/ /* Read the EEPROM */ - err = il_eeprom_init(priv); + err = il_eeprom_init(il); if (err) { - IL_ERR(priv, "Unable to init EEPROM\n"); + IL_ERR(il, "Unable to init EEPROM\n"); goto out_iounmap; } - err = il4965_eeprom_check_version(priv); + err = il4965_eeprom_check_version(il); if (err) goto out_free_eeprom; @@ -3011,131 +3011,131 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto out_free_eeprom; /* extract MAC Address */ - il4965_eeprom_get_mac(priv, priv->addresses[0].addr); - IL_DEBUG_INFO(priv, "MAC address: %pM\n", priv->addresses[0].addr); - priv->hw->wiphy->addresses = priv->addresses; - priv->hw->wiphy->n_addresses = 1; + il4965_eeprom_get_mac(il, il->addresses[0].addr); + IL_DEBUG_INFO(il, "MAC address: %pM\n", il->addresses[0].addr); + il->hw->wiphy->addresses = il->addresses; + il->hw->wiphy->n_addresses = 1; /************************ * 5. Setup HW constants ************************/ - if (il4965_set_hw_params(priv)) { - IL_ERR(priv, "failed to set hw parameters\n"); + if (il4965_set_hw_params(il)) { + IL_ERR(il, "failed to set hw parameters\n"); goto out_free_eeprom; } /******************* - * 6. Setup priv + * 6. Setup il *******************/ - err = il4965_init_drv(priv); + err = il4965_init_drv(il); if (err) goto out_free_eeprom; - /* At this point both hw and priv are initialized. */ + /* At this point both hw and il are initialized. */ /******************** * 7. Setup services ********************/ - spin_lock_irqsave(&priv->lock, flags); - il_disable_interrupts(priv); - spin_unlock_irqrestore(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); + il_disable_interrupts(il); + spin_unlock_irqrestore(&il->lock, flags); - pci_enable_msi(priv->pci_dev); + pci_enable_msi(il->pci_dev); - err = request_irq(priv->pci_dev->irq, il_isr, - IRQF_SHARED, DRV_NAME, priv); + err = request_irq(il->pci_dev->irq, il_isr, + IRQF_SHARED, DRV_NAME, il); if (err) { - IL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq); + IL_ERR(il, "Error allocating IRQ %d\n", il->pci_dev->irq); goto out_disable_msi; } - il4965_setup_deferred_work(priv); - il4965_setup_rx_handlers(priv); + il4965_setup_deferred_work(il); + il4965_setup_rx_handlers(il); /********************************************* * 8. Enable interrupts and read RFKILL state *********************************************/ /* enable rfkill interrupt: hw bug w/a */ - pci_read_config_word(priv->pci_dev, PCI_COMMAND, &pci_cmd); + pci_read_config_word(il->pci_dev, PCI_COMMAND, &pci_cmd); if (pci_cmd & PCI_COMMAND_INTX_DISABLE) { pci_cmd &= ~PCI_COMMAND_INTX_DISABLE; - pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd); + pci_write_config_word(il->pci_dev, PCI_COMMAND, pci_cmd); } - il_enable_rfkill_int(priv); + il_enable_rfkill_int(il); /* If platform's RF_KILL switch is NOT set to KILL */ - if (il_read32(priv, CSR_GP_CNTRL) & + if (il_read32(il, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) - clear_bit(STATUS_RF_KILL_HW, &priv->status); + clear_bit(STATUS_RF_KILL_HW, &il->status); else - set_bit(STATUS_RF_KILL_HW, &priv->status); + set_bit(STATUS_RF_KILL_HW, &il->status); - wiphy_rfkill_set_hw_state(priv->hw->wiphy, - test_bit(STATUS_RF_KILL_HW, &priv->status)); + wiphy_rfkill_set_hw_state(il->hw->wiphy, + test_bit(STATUS_RF_KILL_HW, &il->status)); - il_power_initialize(priv); + il_power_initialize(il); - init_completion(&priv->_4965.firmware_loading_complete); + init_completion(&il->_4965.firmware_loading_complete); - err = il4965_request_firmware(priv, true); + err = il4965_request_firmware(il, true); if (err) goto out_destroy_workqueue; return 0; out_destroy_workqueue: - destroy_workqueue(priv->workqueue); - priv->workqueue = NULL; - free_irq(priv->pci_dev->irq, priv); + destroy_workqueue(il->workqueue); + il->workqueue = NULL; + free_irq(il->pci_dev->irq, il); out_disable_msi: - pci_disable_msi(priv->pci_dev); - il4965_uninit_drv(priv); + pci_disable_msi(il->pci_dev); + il4965_uninit_drv(il); out_free_eeprom: - il_eeprom_free(priv); + il_eeprom_free(il); out_iounmap: - pci_iounmap(pdev, priv->hw_base); + pci_iounmap(pdev, il->hw_base); out_pci_release_regions: pci_set_drvdata(pdev, NULL); pci_release_regions(pdev); out_pci_disable_device: pci_disable_device(pdev); out_ieee80211_free_hw: - il_free_traffic_mem(priv); - ieee80211_free_hw(priv->hw); + il_free_traffic_mem(il); + ieee80211_free_hw(il->hw); out: return err; } static void __devexit il4965_pci_remove(struct pci_dev *pdev) { - struct il_priv *priv = pci_get_drvdata(pdev); + struct il_priv *il = pci_get_drvdata(pdev); unsigned long flags; - if (!priv) + if (!il) return; - wait_for_completion(&priv->_4965.firmware_loading_complete); + wait_for_completion(&il->_4965.firmware_loading_complete); - IL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); + IL_DEBUG_INFO(il, "*** UNLOAD DRIVER ***\n"); - il_dbgfs_unregister(priv); + il_dbgfs_unregister(il); sysfs_remove_group(&pdev->dev.kobj, &il_attribute_group); /* ieee80211_unregister_hw call wil cause il_mac_stop to * to be called and il4965_down since we are removing the device * we need to set STATUS_EXIT_PENDING bit. */ - set_bit(STATUS_EXIT_PENDING, &priv->status); + set_bit(STATUS_EXIT_PENDING, &il->status); - il_leds_exit(priv); + il_leds_exit(il); - if (priv->mac80211_registered) { - ieee80211_unregister_hw(priv->hw); - priv->mac80211_registered = 0; + if (il->mac80211_registered) { + ieee80211_unregister_hw(il->hw); + il->mac80211_registered = 0; } else { - il4965_down(priv); + il4965_down(il); } /* @@ -3145,57 +3145,57 @@ static void __devexit il4965_pci_remove(struct pci_dev *pdev) * paths to avoid running il4965_down() at all before leaving driver. * This (inexpensive) call *makes sure* device is reset. */ - il_apm_stop(priv); + il_apm_stop(il); /* make sure we flush any pending irq or * tasklet for the driver */ - spin_lock_irqsave(&priv->lock, flags); - il_disable_interrupts(priv); - spin_unlock_irqrestore(&priv->lock, flags); + spin_lock_irqsave(&il->lock, flags); + il_disable_interrupts(il); + spin_unlock_irqrestore(&il->lock, flags); - il4965_synchronize_irq(priv); + il4965_synchronize_irq(il); - il4965_dealloc_ucode_pci(priv); + il4965_dealloc_ucode_pci(il); - if (priv->rxq.bd) - il4965_rx_queue_free(priv, &priv->rxq); - il4965_hw_txq_ctx_free(priv); + if (il->rxq.bd) + il4965_rx_queue_free(il, &il->rxq); + il4965_hw_txq_ctx_free(il); - il_eeprom_free(priv); + il_eeprom_free(il); /*netif_stop_queue(dev); */ - flush_workqueue(priv->workqueue); + flush_workqueue(il->workqueue); /* ieee80211_unregister_hw calls il_mac_stop, which flushes - * priv->workqueue... so we can't take down the workqueue + * il->workqueue... so we can't take down the workqueue * until now... */ - destroy_workqueue(priv->workqueue); - priv->workqueue = NULL; - il_free_traffic_mem(priv); + destroy_workqueue(il->workqueue); + il->workqueue = NULL; + il_free_traffic_mem(il); - free_irq(priv->pci_dev->irq, priv); - pci_disable_msi(priv->pci_dev); - pci_iounmap(pdev, priv->hw_base); + free_irq(il->pci_dev->irq, il); + pci_disable_msi(il->pci_dev); + pci_iounmap(pdev, il->hw_base); pci_release_regions(pdev); pci_disable_device(pdev); pci_set_drvdata(pdev, NULL); - il4965_uninit_drv(priv); + il4965_uninit_drv(il); - dev_kfree_skb(priv->beacon_skb); + dev_kfree_skb(il->beacon_skb); - ieee80211_free_hw(priv->hw); + ieee80211_free_hw(il->hw); } /* * Activate/Deactivate Tx DMA/FIFO channels according tx fifos mask - * must be called under priv->lock and mac access + * must be called under il->lock and mac access */ -void il4965_txq_set_sched(struct il_priv *priv, u32 mask) +void il4965_txq_set_sched(struct il_priv *il, u32 mask) { - il_write_prph(priv, IWL49_SCD_TXFACT, mask); + il_write_prph(il, IWL49_SCD_TXFACT, mask); } /***************************************************************************** |