diff options
author | Stanislaw Gruszka <sgruszka@redhat.com> | 2011-10-24 10:49:25 -0400 |
---|---|---|
committer | Stanislaw Gruszka <sgruszka@redhat.com> | 2011-11-15 05:17:00 -0500 |
commit | 46bc8d4b0e73ac75de323646d75a2333f47b84c3 (patch) | |
tree | a11a89b1a3480135e1510aacd5909485ab2e5be7 /drivers/net/wireless/iwlegacy | |
parent | e2ebc8337d116acdc25469ec8547ae665f50a4c1 (diff) |
iwlegacy: rename priv to il
Make code shorter.
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Diffstat (limited to 'drivers/net/wireless/iwlegacy')
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 954aed4e7b3..b767979c5db 100644 --- a/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c +++ b/drivers/net/wireless/iwlegacy/iwl-3945-debugfs.c | |||
@@ -29,22 +29,22 @@ | |||
29 | #include "iwl-3945-debugfs.h" | 29 | #include "iwl-3945-debugfs.h" |
30 | 30 | ||
31 | 31 | ||
32 | static int il3945_statistics_flag(struct il_priv *priv, char *buf, int bufsz) | 32 | static int il3945_statistics_flag(struct il_priv *il, char *buf, int bufsz) |
33 | { | 33 | { |
34 | int p = 0; | 34 | int p = 0; |
35 | 35 | ||
36 | p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n", | 36 | p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n", |
37 | le32_to_cpu(priv->_3945.statistics.flag)); | 37 | le32_to_cpu(il->_3945.statistics.flag)); |
38 | if (le32_to_cpu(priv->_3945.statistics.flag) & | 38 | if (le32_to_cpu(il->_3945.statistics.flag) & |
39 | UCODE_STATISTICS_CLEAR_MSK) | 39 | UCODE_STATISTICS_CLEAR_MSK) |
40 | p += scnprintf(buf + p, bufsz - p, | 40 | p += scnprintf(buf + p, bufsz - p, |
41 | "\tStatistics have been cleared\n"); | 41 | "\tStatistics have been cleared\n"); |
42 | p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n", | 42 | p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n", |
43 | (le32_to_cpu(priv->_3945.statistics.flag) & | 43 | (le32_to_cpu(il->_3945.statistics.flag) & |
44 | UCODE_STATISTICS_FREQUENCY_MSK) | 44 | UCODE_STATISTICS_FREQUENCY_MSK) |
45 | ? "2.4 GHz" : "5.2 GHz"); | 45 | ? "2.4 GHz" : "5.2 GHz"); |
46 | p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n", | 46 | p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n", |
47 | (le32_to_cpu(priv->_3945.statistics.flag) & | 47 | (le32_to_cpu(il->_3945.statistics.flag) & |
48 | UCODE_STATISTICS_NARROW_BAND_MSK) | 48 | UCODE_STATISTICS_NARROW_BAND_MSK) |
49 | ? "enabled" : "disabled"); | 49 | ? "enabled" : "disabled"); |
50 | return p; | 50 | return p; |
@@ -54,7 +54,7 @@ ssize_t il3945_ucode_rx_stats_read(struct file *file, | |||
54 | char __user *user_buf, | 54 | char __user *user_buf, |
55 | size_t count, loff_t *ppos) | 55 | size_t count, loff_t *ppos) |
56 | { | 56 | { |
57 | struct il_priv *priv = file->private_data; | 57 | struct il_priv *il = file->private_data; |
58 | int pos = 0; | 58 | int pos = 0; |
59 | char *buf; | 59 | char *buf; |
60 | int bufsz = sizeof(struct iwl39_statistics_rx_phy) * 40 + | 60 | int bufsz = sizeof(struct iwl39_statistics_rx_phy) * 40 + |
@@ -66,12 +66,12 @@ ssize_t il3945_ucode_rx_stats_read(struct file *file, | |||
66 | struct iwl39_statistics_rx_non_phy *general, *accum_general; | 66 | struct iwl39_statistics_rx_non_phy *general, *accum_general; |
67 | struct iwl39_statistics_rx_non_phy *delta_general, *max_general; | 67 | struct iwl39_statistics_rx_non_phy *delta_general, *max_general; |
68 | 68 | ||
69 | if (!il_is_alive(priv)) | 69 | if (!il_is_alive(il)) |
70 | return -EAGAIN; | 70 | return -EAGAIN; |
71 | 71 | ||
72 | buf = kzalloc(bufsz, GFP_KERNEL); | 72 | buf = kzalloc(bufsz, GFP_KERNEL); |
73 | if (!buf) { | 73 | if (!buf) { |
74 | IL_ERR(priv, "Can not allocate Buffer\n"); | 74 | IL_ERR(il, "Can not allocate Buffer\n"); |
75 | return -ENOMEM; | 75 | return -ENOMEM; |
76 | } | 76 | } |
77 | 77 | ||
@@ -80,20 +80,20 @@ ssize_t il3945_ucode_rx_stats_read(struct file *file, | |||
80 | * the last statistics notification from uCode | 80 | * the last statistics notification from uCode |
81 | * might not reflect the current uCode activity | 81 | * might not reflect the current uCode activity |
82 | */ | 82 | */ |
83 | ofdm = &priv->_3945.statistics.rx.ofdm; | 83 | ofdm = &il->_3945.statistics.rx.ofdm; |
84 | cck = &priv->_3945.statistics.rx.cck; | 84 | cck = &il->_3945.statistics.rx.cck; |
85 | general = &priv->_3945.statistics.rx.general; | 85 | general = &il->_3945.statistics.rx.general; |
86 | accum_ofdm = &priv->_3945.accum_statistics.rx.ofdm; | 86 | accum_ofdm = &il->_3945.accum_statistics.rx.ofdm; |
87 | accum_cck = &priv->_3945.accum_statistics.rx.cck; | 87 | accum_cck = &il->_3945.accum_statistics.rx.cck; |
88 | accum_general = &priv->_3945.accum_statistics.rx.general; | 88 | accum_general = &il->_3945.accum_statistics.rx.general; |
89 | delta_ofdm = &priv->_3945.delta_statistics.rx.ofdm; | 89 | delta_ofdm = &il->_3945.delta_statistics.rx.ofdm; |
90 | delta_cck = &priv->_3945.delta_statistics.rx.cck; | 90 | delta_cck = &il->_3945.delta_statistics.rx.cck; |
91 | delta_general = &priv->_3945.delta_statistics.rx.general; | 91 | delta_general = &il->_3945.delta_statistics.rx.general; |
92 | max_ofdm = &priv->_3945.max_delta.rx.ofdm; | 92 | max_ofdm = &il->_3945.max_delta.rx.ofdm; |
93 | max_cck = &priv->_3945.max_delta.rx.cck; | 93 | max_cck = &il->_3945.max_delta.rx.cck; |
94 | max_general = &priv->_3945.max_delta.rx.general; | 94 | max_general = &il->_3945.max_delta.rx.general; |
95 | 95 | ||
96 | pos += il3945_statistics_flag(priv, buf, bufsz); | 96 | pos += il3945_statistics_flag(il, buf, bufsz); |
97 | pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" | 97 | pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" |
98 | "acumulative delta max\n", | 98 | "acumulative delta max\n", |
99 | "Statistics_Rx - OFDM:"); | 99 | "Statistics_Rx - OFDM:"); |
@@ -329,19 +329,19 @@ ssize_t il3945_ucode_tx_stats_read(struct file *file, | |||
329 | char __user *user_buf, | 329 | char __user *user_buf, |
330 | size_t count, loff_t *ppos) | 330 | size_t count, loff_t *ppos) |
331 | { | 331 | { |
332 | struct il_priv *priv = file->private_data; | 332 | struct il_priv *il = file->private_data; |
333 | int pos = 0; | 333 | int pos = 0; |
334 | char *buf; | 334 | char *buf; |
335 | int bufsz = (sizeof(struct iwl39_statistics_tx) * 48) + 250; | 335 | int bufsz = (sizeof(struct iwl39_statistics_tx) * 48) + 250; |
336 | ssize_t ret; | 336 | ssize_t ret; |
337 | struct iwl39_statistics_tx *tx, *accum_tx, *delta_tx, *max_tx; | 337 | struct iwl39_statistics_tx *tx, *accum_tx, *delta_tx, *max_tx; |
338 | 338 | ||
339 | if (!il_is_alive(priv)) | 339 | if (!il_is_alive(il)) |
340 | return -EAGAIN; | 340 | return -EAGAIN; |
341 | 341 | ||
342 | buf = kzalloc(bufsz, GFP_KERNEL); | 342 | buf = kzalloc(bufsz, GFP_KERNEL); |
343 | if (!buf) { | 343 | if (!buf) { |
344 | IL_ERR(priv, "Can not allocate Buffer\n"); | 344 | IL_ERR(il, "Can not allocate Buffer\n"); |
345 | return -ENOMEM; | 345 | return -ENOMEM; |
346 | } | 346 | } |
347 | 347 | ||
@@ -350,11 +350,11 @@ ssize_t il3945_ucode_tx_stats_read(struct file *file, | |||
350 | * the last statistics notification from uCode | 350 | * the last statistics notification from uCode |
351 | * might not reflect the current uCode activity | 351 | * might not reflect the current uCode activity |
352 | */ | 352 | */ |
353 | tx = &priv->_3945.statistics.tx; | 353 | tx = &il->_3945.statistics.tx; |
354 | accum_tx = &priv->_3945.accum_statistics.tx; | 354 | accum_tx = &il->_3945.accum_statistics.tx; |
355 | delta_tx = &priv->_3945.delta_statistics.tx; | 355 | delta_tx = &il->_3945.delta_statistics.tx; |
356 | max_tx = &priv->_3945.max_delta.tx; | 356 | max_tx = &il->_3945.max_delta.tx; |
357 | pos += il3945_statistics_flag(priv, buf, bufsz); | 357 | pos += il3945_statistics_flag(il, buf, bufsz); |
358 | pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" | 358 | pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" |
359 | "acumulative delta max\n", | 359 | "acumulative delta max\n", |
360 | "Statistics_Tx:"); | 360 | "Statistics_Tx:"); |
@@ -425,7 +425,7 @@ ssize_t il3945_ucode_general_stats_read(struct file *file, | |||
425 | char __user *user_buf, | 425 | char __user *user_buf, |
426 | size_t count, loff_t *ppos) | 426 | size_t count, loff_t *ppos) |
427 | { | 427 | { |
428 | struct il_priv *priv = file->private_data; | 428 | struct il_priv *il = file->private_data; |
429 | int pos = 0; | 429 | int pos = 0; |
430 | char *buf; | 430 | char *buf; |
431 | int bufsz = sizeof(struct iwl39_statistics_general) * 10 + 300; | 431 | int bufsz = sizeof(struct iwl39_statistics_general) * 10 + 300; |
@@ -435,12 +435,12 @@ ssize_t il3945_ucode_general_stats_read(struct file *file, | |||
435 | struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg; | 435 | struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg; |
436 | struct iwl39_statistics_div *div, *accum_div, *delta_div, *max_div; | 436 | struct iwl39_statistics_div *div, *accum_div, *delta_div, *max_div; |
437 | 437 | ||
438 | if (!il_is_alive(priv)) | 438 | if (!il_is_alive(il)) |
439 | return -EAGAIN; | 439 | return -EAGAIN; |
440 | 440 | ||
441 | buf = kzalloc(bufsz, GFP_KERNEL); | 441 | buf = kzalloc(bufsz, GFP_KERNEL); |
442 | if (!buf) { | 442 | if (!buf) { |
443 | IL_ERR(priv, "Can not allocate Buffer\n"); | 443 | IL_ERR(il, "Can not allocate Buffer\n"); |
444 | return -ENOMEM; | 444 | return -ENOMEM; |
445 | } | 445 | } |
446 | 446 | ||
@@ -449,19 +449,19 @@ ssize_t il3945_ucode_general_stats_read(struct file *file, | |||
449 | * the last statistics notification from uCode | 449 | * the last statistics notification from uCode |
450 | * might not reflect the current uCode activity | 450 | * might not reflect the current uCode activity |
451 | */ | 451 | */ |
452 | general = &priv->_3945.statistics.general; | 452 | general = &il->_3945.statistics.general; |
453 | dbg = &priv->_3945.statistics.general.dbg; | 453 | dbg = &il->_3945.statistics.general.dbg; |
454 | div = &priv->_3945.statistics.general.div; | 454 | div = &il->_3945.statistics.general.div; |
455 | accum_general = &priv->_3945.accum_statistics.general; | 455 | accum_general = &il->_3945.accum_statistics.general; |
456 | delta_general = &priv->_3945.delta_statistics.general; | 456 | delta_general = &il->_3945.delta_statistics.general; |
457 | max_general = &priv->_3945.max_delta.general; | 457 | max_general = &il->_3945.max_delta.general; |
458 | accum_dbg = &priv->_3945.accum_statistics.general.dbg; | 458 | accum_dbg = &il->_3945.accum_statistics.general.dbg; |
459 | delta_dbg = &priv->_3945.delta_statistics.general.dbg; | 459 | delta_dbg = &il->_3945.delta_statistics.general.dbg; |
460 | max_dbg = &priv->_3945.max_delta.general.dbg; | 460 | max_dbg = &il->_3945.max_delta.general.dbg; |
461 | accum_div = &priv->_3945.accum_statistics.general.div; | 461 | accum_div = &il->_3945.accum_statistics.general.div; |
462 | delta_div = &priv->_3945.delta_statistics.general.div; | 462 | delta_div = &il->_3945.delta_statistics.general.div; |
463 | max_div = &priv->_3945.max_delta.general.div; | 463 | max_div = &il->_3945.max_delta.general.div; |
464 | pos += il3945_statistics_flag(priv, buf, bufsz); | 464 | pos += il3945_statistics_flag(il, buf, bufsz); |
465 | pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" | 465 | pos += scnprintf(buf + pos, bufsz - pos, "%-32s current" |
466 | "acumulative delta max\n", | 466 | "acumulative delta max\n", |
467 | "Statistics_General:"); | 467 | "Statistics_General:"); |
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-led.c b/drivers/net/wireless/iwlegacy/iwl-3945-led.c index 69703b07bd6..53ec4637015 100644 --- a/drivers/net/wireless/iwlegacy/iwl-3945-led.c +++ b/drivers/net/wireless/iwlegacy/iwl-3945-led.c | |||
@@ -44,7 +44,7 @@ | |||
44 | 44 | ||
45 | 45 | ||
46 | /* Send led command */ | 46 | /* Send led command */ |
47 | static int il3945_send_led_cmd(struct il_priv *priv, | 47 | static int il3945_send_led_cmd(struct il_priv *il, |
48 | struct il_led_cmd *led_cmd) | 48 | struct il_led_cmd *led_cmd) |
49 | { | 49 | { |
50 | struct il_host_cmd cmd = { | 50 | struct il_host_cmd cmd = { |
@@ -55,7 +55,7 @@ static int il3945_send_led_cmd(struct il_priv *priv, | |||
55 | .callback = NULL, | 55 | .callback = NULL, |
56 | }; | 56 | }; |
57 | 57 | ||
58 | return il_send_cmd(priv, &cmd); | 58 | return il_send_cmd(il, &cmd); |
59 | } | 59 | } |
60 | 60 | ||
61 | const struct il_led_ops il3945_led_ops = { | 61 | 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 d97f24bfc45..38f1b825af1 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) | |||
153 | int unflushed = 0; | 153 | int unflushed = 0; |
154 | int i; | 154 | int i; |
155 | unsigned long flags; | 155 | unsigned long flags; |
156 | struct il_priv *priv __maybe_unused = rs_sta->priv; | 156 | struct il_priv *il __maybe_unused = rs_sta->il; |
157 | 157 | ||
158 | /* | 158 | /* |
159 | * For each rate, if we have collected data on that rate | 159 | * For each rate, if we have collected data on that rate |
@@ -167,7 +167,7 @@ static int il3945_rate_scale_flush_windows(struct il3945_rs_sta *rs_sta) | |||
167 | spin_lock_irqsave(&rs_sta->lock, flags); | 167 | spin_lock_irqsave(&rs_sta->lock, flags); |
168 | if (time_after(jiffies, rs_sta->win[i].stamp + | 168 | if (time_after(jiffies, rs_sta->win[i].stamp + |
169 | IL_RATE_WIN_FLUSH)) { | 169 | IL_RATE_WIN_FLUSH)) { |
170 | IL_DEBUG_RATE(priv, "flushing %d samples of rate " | 170 | IL_DEBUG_RATE(il, "flushing %d samples of rate " |
171 | "index %d\n", | 171 | "index %d\n", |
172 | rs_sta->win[i].counter, i); | 172 | rs_sta->win[i].counter, i); |
173 | il3945_clear_window(&rs_sta->win[i]); | 173 | il3945_clear_window(&rs_sta->win[i]); |
@@ -186,12 +186,12 @@ static int il3945_rate_scale_flush_windows(struct il3945_rs_sta *rs_sta) | |||
186 | static void il3945_bg_rate_scale_flush(unsigned long data) | 186 | static void il3945_bg_rate_scale_flush(unsigned long data) |
187 | { | 187 | { |
188 | struct il3945_rs_sta *rs_sta = (void *)data; | 188 | struct il3945_rs_sta *rs_sta = (void *)data; |
189 | struct il_priv *priv __maybe_unused = rs_sta->priv; | 189 | struct il_priv *il __maybe_unused = rs_sta->il; |
190 | int unflushed = 0; | 190 | int unflushed = 0; |
191 | unsigned long flags; | 191 | unsigned long flags; |
192 | u32 packet_count, duration, pps; | 192 | u32 packet_count, duration, pps; |
193 | 193 | ||
194 | IL_DEBUG_RATE(priv, "enter\n"); | 194 | IL_DEBUG_RATE(il, "enter\n"); |
195 | 195 | ||
196 | unflushed = il3945_rate_scale_flush_windows(rs_sta); | 196 | unflushed = il3945_rate_scale_flush_windows(rs_sta); |
197 | 197 | ||
@@ -206,7 +206,7 @@ static void il3945_bg_rate_scale_flush(unsigned long data) | |||
206 | duration = | 206 | duration = |
207 | jiffies_to_msecs(jiffies - rs_sta->last_partial_flush); | 207 | jiffies_to_msecs(jiffies - rs_sta->last_partial_flush); |
208 | 208 | ||
209 | IL_DEBUG_RATE(priv, "Tx'd %d packets in %dms\n", | 209 | IL_DEBUG_RATE(il, "Tx'd %d packets in %dms\n", |
210 | packet_count, duration); | 210 | packet_count, duration); |
211 | 211 | ||
212 | /* Determine packets per second */ | 212 | /* Determine packets per second */ |
@@ -226,7 +226,7 @@ static void il3945_bg_rate_scale_flush(unsigned long data) | |||
226 | 226 | ||
227 | rs_sta->flush_time = msecs_to_jiffies(duration); | 227 | rs_sta->flush_time = msecs_to_jiffies(duration); |
228 | 228 | ||
229 | IL_DEBUG_RATE(priv, "new flush period: %d msec ave %d\n", | 229 | IL_DEBUG_RATE(il, "new flush period: %d msec ave %d\n", |
230 | duration, packet_count); | 230 | duration, packet_count); |
231 | 231 | ||
232 | mod_timer(&rs_sta->rate_scale_flush, jiffies + | 232 | mod_timer(&rs_sta->rate_scale_flush, jiffies + |
@@ -244,7 +244,7 @@ static void il3945_bg_rate_scale_flush(unsigned long data) | |||
244 | 244 | ||
245 | spin_unlock_irqrestore(&rs_sta->lock, flags); | 245 | spin_unlock_irqrestore(&rs_sta->lock, flags); |
246 | 246 | ||
247 | IL_DEBUG_RATE(priv, "leave\n"); | 247 | IL_DEBUG_RATE(il, "leave\n"); |
248 | } | 248 | } |
249 | 249 | ||
250 | /** | 250 | /** |
@@ -260,10 +260,10 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta, | |||
260 | { | 260 | { |
261 | unsigned long flags; | 261 | unsigned long flags; |
262 | s32 fail_count; | 262 | s32 fail_count; |
263 | struct il_priv *priv __maybe_unused = rs_sta->priv; | 263 | struct il_priv *il __maybe_unused = rs_sta->il; |
264 | 264 | ||
265 | if (!retries) { | 265 | if (!retries) { |
266 | IL_DEBUG_RATE(priv, "leave: retries == 0 -- should be at least 1\n"); | 266 | IL_DEBUG_RATE(il, "leave: retries == 0 -- should be at least 1\n"); |
267 | return; | 267 | return; |
268 | } | 268 | } |
269 | 269 | ||
@@ -332,24 +332,24 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta, | |||
332 | /* | 332 | /* |
333 | * Called after adding a new station to initialize rate scaling | 333 | * Called after adding a new station to initialize rate scaling |
334 | */ | 334 | */ |
335 | void il3945_rs_rate_init(struct il_priv *priv, struct ieee80211_sta *sta, u8 sta_id) | 335 | void il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_id) |
336 | { | 336 | { |
337 | struct ieee80211_hw *hw = priv->hw; | 337 | struct ieee80211_hw *hw = il->hw; |
338 | struct ieee80211_conf *conf = &priv->hw->conf; | 338 | struct ieee80211_conf *conf = &il->hw->conf; |
339 | struct il3945_sta_priv *psta; | 339 | struct il3945_sta_priv *psta; |
340 | struct il3945_rs_sta *rs_sta; | 340 | struct il3945_rs_sta *rs_sta; |
341 | struct ieee80211_supported_band *sband; | 341 | struct ieee80211_supported_band *sband; |
342 | int i; | 342 | int i; |
343 | 343 | ||
344 | IL_DEBUG_INFO(priv, "enter\n"); | 344 | IL_DEBUG_INFO(il, "enter\n"); |
345 | if (sta_id == priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id) | 345 | if (sta_id == il->contexts[IL_RXON_CTX_BSS].bcast_sta_id) |
346 | goto out; | 346 | goto out; |
347 | 347 | ||
348 | psta = (struct il3945_sta_priv *) sta->drv_priv; | 348 | psta = (struct il3945_sta_priv *) sta->drv_priv; |
349 | rs_sta = &psta->rs_sta; | 349 | rs_sta = &psta->rs_sta; |
350 | sband = hw->wiphy->bands[conf->channel->band]; | 350 | sband = hw->wiphy->bands[conf->channel->band]; |
351 | 351 | ||
352 | rs_sta->priv = priv; | 352 | rs_sta->il = il; |
353 | 353 | ||
354 | rs_sta->start_rate = IL_RATE_INVALID; | 354 | rs_sta->start_rate = IL_RATE_INVALID; |
355 | 355 | ||
@@ -379,18 +379,18 @@ void il3945_rs_rate_init(struct il_priv *priv, struct ieee80211_sta *sta, u8 sta | |||
379 | } | 379 | } |
380 | } | 380 | } |
381 | 381 | ||
382 | priv->_3945.sta_supp_rates = sta->supp_rates[sband->band]; | 382 | il->_3945.sta_supp_rates = sta->supp_rates[sband->band]; |
383 | /* For 5 GHz band it start at IL_FIRST_OFDM_RATE */ | 383 | /* For 5 GHz band it start at IL_FIRST_OFDM_RATE */ |
384 | if (sband->band == IEEE80211_BAND_5GHZ) { | 384 | if (sband->band == IEEE80211_BAND_5GHZ) { |
385 | rs_sta->last_txrate_idx += IL_FIRST_OFDM_RATE; | 385 | rs_sta->last_txrate_idx += IL_FIRST_OFDM_RATE; |
386 | priv->_3945.sta_supp_rates = priv->_3945.sta_supp_rates << | 386 | il->_3945.sta_supp_rates = il->_3945.sta_supp_rates << |
387 | IL_FIRST_OFDM_RATE; | 387 | IL_FIRST_OFDM_RATE; |
388 | } | 388 | } |
389 | 389 | ||
390 | out: | 390 | out: |
391 | priv->stations[sta_id].used &= ~IL_STA_UCODE_INPROGRESS; | 391 | il->stations[sta_id].used &= ~IL_STA_UCODE_INPROGRESS; |
392 | 392 | ||
393 | IL_DEBUG_INFO(priv, "leave\n"); | 393 | IL_DEBUG_INFO(il, "leave\n"); |
394 | } | 394 | } |
395 | 395 | ||
396 | static void *il3945_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) | 396 | 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) | |||
399 | } | 399 | } |
400 | 400 | ||
401 | /* rate scale requires free function to be implemented */ | 401 | /* rate scale requires free function to be implemented */ |
402 | static void il3945_rs_free(void *priv) | 402 | static void il3945_rs_free(void *il) |
403 | { | 403 | { |
404 | return; | 404 | return; |
405 | } | 405 | } |
@@ -408,24 +408,24 @@ static void *il3945_rs_alloc_sta(void *il_priv, struct ieee80211_sta *sta, gfp_t | |||
408 | { | 408 | { |
409 | struct il3945_rs_sta *rs_sta; | 409 | struct il3945_rs_sta *rs_sta; |
410 | struct il3945_sta_priv *psta = (void *) sta->drv_priv; | 410 | struct il3945_sta_priv *psta = (void *) sta->drv_priv; |
411 | struct il_priv *priv __maybe_unused = il_priv; | 411 | struct il_priv *il __maybe_unused = il_priv; |
412 | 412 | ||
413 | IL_DEBUG_RATE(priv, "enter\n"); | 413 | IL_DEBUG_RATE(il, "enter\n"); |
414 | 414 | ||
415 | rs_sta = &psta->rs_sta; | 415 | rs_sta = &psta->rs_sta; |
416 | 416 | ||
417 | spin_lock_init(&rs_sta->lock); | 417 | spin_lock_init(&rs_sta->lock); |
418 | init_timer(&rs_sta->rate_scale_flush); | 418 | init_timer(&rs_sta->rate_scale_flush); |
419 | 419 | ||
420 | IL_DEBUG_RATE(priv, "leave\n"); | 420 | IL_DEBUG_RATE(il, "leave\n"); |
421 | 421 | ||
422 | return rs_sta; | 422 | return rs_sta; |
423 | } | 423 | } |
424 | 424 | ||
425 | static void il3945_rs_free_sta(void *il_priv, struct ieee80211_sta *sta, | 425 | static void il3945_rs_free_sta(void *il_priv, struct ieee80211_sta *sta, |
426 | void *priv_sta) | 426 | void *il_sta) |
427 | { | 427 | { |
428 | struct il3945_rs_sta *rs_sta = priv_sta; | 428 | struct il3945_rs_sta *rs_sta = il_sta; |
429 | 429 | ||
430 | /* | 430 | /* |
431 | * Be careful not to use any members of il3945_rs_sta (like trying | 431 | * 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, | |||
442 | * NOTE: Uses il_priv->retry_rate for the # of retries attempted by | 442 | * NOTE: Uses il_priv->retry_rate for the # of retries attempted by |
443 | * the hardware for each rate. | 443 | * the hardware for each rate. |
444 | */ | 444 | */ |
445 | static void il3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband, | 445 | static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *sband, |
446 | struct ieee80211_sta *sta, void *priv_sta, | 446 | struct ieee80211_sta *sta, void *il_sta, |
447 | struct sk_buff *skb) | 447 | struct sk_buff *skb) |
448 | { | 448 | { |
449 | s8 retries = 0, current_count; | 449 | s8 retries = 0, current_count; |
450 | int scale_rate_index, first_index, last_index; | 450 | int scale_rate_index, first_index, last_index; |
451 | unsigned long flags; | 451 | unsigned long flags; |
452 | struct il_priv *priv = (struct il_priv *)priv_rate; | 452 | struct il_priv *il = (struct il_priv *)il_rate; |
453 | struct il3945_rs_sta *rs_sta = priv_sta; | 453 | struct il3945_rs_sta *rs_sta = il_sta; |
454 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 454 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
455 | 455 | ||
456 | IL_DEBUG_RATE(priv, "enter\n"); | 456 | IL_DEBUG_RATE(il, "enter\n"); |
457 | 457 | ||
458 | retries = info->status.rates[0].count; | 458 | retries = info->status.rates[0].count; |
459 | /* Sanity Check for retries */ | 459 | /* Sanity Check for retries */ |
@@ -462,18 +462,18 @@ static void il3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_band | |||
462 | 462 | ||
463 | first_index = sband->bitrates[info->status.rates[0].idx].hw_value; | 463 | first_index = sband->bitrates[info->status.rates[0].idx].hw_value; |
464 | if ((first_index < 0) || (first_index >= IL_RATE_COUNT_3945)) { | 464 | if ((first_index < 0) || (first_index >= IL_RATE_COUNT_3945)) { |
465 | IL_DEBUG_RATE(priv, "leave: Rate out of bounds: %d\n", first_index); | 465 | IL_DEBUG_RATE(il, "leave: Rate out of bounds: %d\n", first_index); |
466 | return; | 466 | return; |
467 | } | 467 | } |
468 | 468 | ||
469 | if (!priv_sta) { | 469 | if (!il_sta) { |
470 | IL_DEBUG_RATE(priv, "leave: No STA priv data to update!\n"); | 470 | IL_DEBUG_RATE(il, "leave: No STA il data to update!\n"); |
471 | return; | 471 | return; |
472 | } | 472 | } |
473 | 473 | ||
474 | /* Treat uninitialized rate scaling data same as non-existing. */ | 474 | /* Treat uninitialized rate scaling data same as non-existing. */ |
475 | if (!rs_sta->priv) { | 475 | if (!rs_sta->il) { |
476 | IL_DEBUG_RATE(priv, "leave: STA priv data uninitialized!\n"); | 476 | IL_DEBUG_RATE(il, "leave: STA il data uninitialized!\n"); |
477 | return; | 477 | return; |
478 | } | 478 | } |
479 | 479 | ||
@@ -487,19 +487,19 @@ static void il3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_band | |||
487 | * Update the window for each rate. We determine which rates | 487 | * Update the window for each rate. We determine which rates |
488 | * were Tx'd based on the total number of retries vs. the number | 488 | * were Tx'd based on the total number of retries vs. the number |
489 | * of retries configured for each rate -- currently set to the | 489 | * of retries configured for each rate -- currently set to the |
490 | * priv value 'retry_rate' vs. rate specific | 490 | * il value 'retry_rate' vs. rate specific |
491 | * | 491 | * |
492 | * On exit from this while loop last_index indicates the rate | 492 | * On exit from this while loop last_index indicates the rate |
493 | * at which the frame was finally transmitted (or failed if no | 493 | * at which the frame was finally transmitted (or failed if no |
494 | * ACK) | 494 | * ACK) |
495 | */ | 495 | */ |
496 | while (retries > 1) { | 496 | while (retries > 1) { |
497 | if ((retries - 1) < priv->retry_rate) { | 497 | if ((retries - 1) < il->retry_rate) { |
498 | current_count = (retries - 1); | 498 | current_count = (retries - 1); |
499 | last_index = scale_rate_index; | 499 | last_index = scale_rate_index; |
500 | } else { | 500 | } else { |
501 | current_count = priv->retry_rate; | 501 | current_count = il->retry_rate; |
502 | last_index = il3945_rs_next_rate(priv, | 502 | last_index = il3945_rs_next_rate(il, |
503 | scale_rate_index); | 503 | scale_rate_index); |
504 | } | 504 | } |
505 | 505 | ||
@@ -508,7 +508,7 @@ static void il3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_band | |||
508 | il3945_collect_tx_data(rs_sta, | 508 | il3945_collect_tx_data(rs_sta, |
509 | &rs_sta->win[scale_rate_index], | 509 | &rs_sta->win[scale_rate_index], |
510 | 0, current_count, scale_rate_index); | 510 | 0, current_count, scale_rate_index); |
511 | IL_DEBUG_RATE(priv, "Update rate %d for %d retries.\n", | 511 | IL_DEBUG_RATE(il, "Update rate %d for %d retries.\n", |
512 | scale_rate_index, current_count); | 512 | scale_rate_index, current_count); |
513 | 513 | ||
514 | retries -= current_count; | 514 | retries -= current_count; |
@@ -518,7 +518,7 @@ static void il3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_band | |||
518 | 518 | ||
519 | 519 | ||
520 | /* Update the last index window with success/failure based on ACK */ | 520 | /* Update the last index window with success/failure based on ACK */ |
521 | IL_DEBUG_RATE(priv, "Update rate %d with %s.\n", | 521 | IL_DEBUG_RATE(il, "Update rate %d with %s.\n", |
522 | last_index, | 522 | last_index, |
523 | (info->flags & IEEE80211_TX_STAT_ACK) ? | 523 | (info->flags & IEEE80211_TX_STAT_ACK) ? |
524 | "success" : "failure"); | 524 | "success" : "failure"); |
@@ -543,7 +543,7 @@ static void il3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_band | |||
543 | 543 | ||
544 | spin_unlock_irqrestore(&rs_sta->lock, flags); | 544 | spin_unlock_irqrestore(&rs_sta->lock, flags); |
545 | 545 | ||
546 | IL_DEBUG_RATE(priv, "leave\n"); | 546 | IL_DEBUG_RATE(il, "leave\n"); |
547 | } | 547 | } |
548 | 548 | ||
549 | static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, | 549 | 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, | |||
551 | { | 551 | { |
552 | u8 high = IL_RATE_INVALID; | 552 | u8 high = IL_RATE_INVALID; |
553 | u8 low = IL_RATE_INVALID; | 553 | u8 low = IL_RATE_INVALID; |
554 | struct il_priv *priv __maybe_unused = rs_sta->priv; | 554 | struct il_priv *il __maybe_unused = rs_sta->il; |
555 | 555 | ||
556 | /* 802.11A walks to the next literal adjacent rate in | 556 | /* 802.11A walks to the next literal adjacent rate in |
557 | * the rate table */ | 557 | * the rate table */ |
@@ -591,7 +591,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, | |||
591 | break; | 591 | break; |
592 | if (rate_mask & (1 << low)) | 592 | if (rate_mask & (1 << low)) |
593 | break; | 593 | break; |
594 | IL_DEBUG_RATE(priv, "Skipping masked lower rate: %d\n", low); | 594 | IL_DEBUG_RATE(il, "Skipping masked lower rate: %d\n", low); |
595 | } | 595 | } |
596 | 596 | ||
597 | high = index; | 597 | high = index; |
@@ -604,7 +604,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, | |||
604 | break; | 604 | break; |
605 | if (rate_mask & (1 << high)) | 605 | if (rate_mask & (1 << high)) |
606 | break; | 606 | break; |
607 | IL_DEBUG_RATE(priv, "Skipping masked higher rate: %d\n", high); | 607 | IL_DEBUG_RATE(il, "Skipping masked higher rate: %d\n", high); |
608 | } | 608 | } |
609 | 609 | ||
610 | return (high << 8) | low; | 610 | return (high << 8) | low; |
@@ -626,8 +626,8 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, | |||
626 | * rate table and must reference the driver allocated rate table | 626 | * rate table and must reference the driver allocated rate table |
627 | * | 627 | * |
628 | */ | 628 | */ |
629 | static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | 629 | static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, |
630 | void *priv_sta, struct ieee80211_tx_rate_control *txrc) | 630 | void *il_sta, struct ieee80211_tx_rate_control *txrc) |
631 | { | 631 | { |
632 | struct ieee80211_supported_band *sband = txrc->sband; | 632 | struct ieee80211_supported_band *sband = txrc->sband; |
633 | struct sk_buff *skb = txrc->skb; | 633 | struct sk_buff *skb = txrc->skb; |
@@ -635,7 +635,7 @@ static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
635 | u8 high = IL_RATE_INVALID; | 635 | u8 high = IL_RATE_INVALID; |
636 | u16 high_low; | 636 | u16 high_low; |
637 | int index; | 637 | int index; |
638 | struct il3945_rs_sta *rs_sta = priv_sta; | 638 | struct il3945_rs_sta *rs_sta = il_sta; |
639 | struct il3945_rate_scale_data *window = NULL; | 639 | struct il3945_rate_scale_data *window = NULL; |
640 | int current_tpt = IL_INVALID_VALUE; | 640 | int current_tpt = IL_INVALID_VALUE; |
641 | int low_tpt = IL_INVALID_VALUE; | 641 | int low_tpt = IL_INVALID_VALUE; |
@@ -645,18 +645,18 @@ static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
645 | unsigned long flags; | 645 | unsigned long flags; |
646 | u16 rate_mask; | 646 | u16 rate_mask; |
647 | s8 max_rate_idx = -1; | 647 | s8 max_rate_idx = -1; |
648 | struct il_priv *priv __maybe_unused = (struct il_priv *)priv_r; | 648 | struct il_priv *il __maybe_unused = (struct il_priv *)il_r; |
649 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 649 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
650 | 650 | ||
651 | IL_DEBUG_RATE(priv, "enter\n"); | 651 | IL_DEBUG_RATE(il, "enter\n"); |
652 | 652 | ||
653 | /* Treat uninitialized rate scaling data same as non-existing. */ | 653 | /* Treat uninitialized rate scaling data same as non-existing. */ |
654 | if (rs_sta && !rs_sta->priv) { | 654 | if (rs_sta && !rs_sta->il) { |
655 | IL_DEBUG_RATE(priv, "Rate scaling information not initialized yet.\n"); | 655 | IL_DEBUG_RATE(il, "Rate scaling information not initialized yet.\n"); |
656 | priv_sta = NULL; | 656 | il_sta = NULL; |
657 | } | 657 | } |
658 | 658 | ||
659 | if (rate_control_send_low(sta, priv_sta, txrc)) | 659 | if (rate_control_send_low(sta, il_sta, txrc)) |
660 | return; | 660 | return; |
661 | 661 | ||
662 | rate_mask = sta->supp_rates[sband->band]; | 662 | rate_mask = sta->supp_rates[sband->band]; |
@@ -699,7 +699,7 @@ static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
699 | (window->success_counter < IL_RATE_MIN_SUCCESS_TH))) { | 699 | (window->success_counter < IL_RATE_MIN_SUCCESS_TH))) { |
700 | spin_unlock_irqrestore(&rs_sta->lock, flags); | 700 | spin_unlock_irqrestore(&rs_sta->lock, flags); |
701 | 701 | ||
702 | IL_DEBUG_RATE(priv, "Invalid average_tpt on rate %d: " | 702 | IL_DEBUG_RATE(il, "Invalid average_tpt on rate %d: " |
703 | "counter: %d, success_counter: %d, " | 703 | "counter: %d, success_counter: %d, " |
704 | "expected_tpt is %sNULL\n", | 704 | "expected_tpt is %sNULL\n", |
705 | index, | 705 | index, |
@@ -737,7 +737,7 @@ static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
737 | 737 | ||
738 | /* Low success ratio , need to drop the rate */ | 738 | /* Low success ratio , need to drop the rate */ |
739 | if ((window->success_ratio < IL_RATE_DECREASE_TH) || !current_tpt) { | 739 | if ((window->success_ratio < IL_RATE_DECREASE_TH) || !current_tpt) { |
740 | IL_DEBUG_RATE(priv, "decrease rate because of low success_ratio\n"); | 740 | IL_DEBUG_RATE(il, "decrease rate because of low success_ratio\n"); |
741 | scale_action = -1; | 741 | scale_action = -1; |
742 | /* No throughput measured yet for adjacent rates, | 742 | /* No throughput measured yet for adjacent rates, |
743 | * try increase */ | 743 | * try increase */ |
@@ -756,7 +756,7 @@ static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
756 | (high_tpt != IL_INVALID_VALUE) && | 756 | (high_tpt != IL_INVALID_VALUE) && |
757 | (low_tpt < current_tpt) && (high_tpt < current_tpt)) { | 757 | (low_tpt < current_tpt) && (high_tpt < current_tpt)) { |
758 | 758 | ||
759 | IL_DEBUG_RATE(priv, "No action -- low [%d] & high [%d] < " | 759 | IL_DEBUG_RATE(il, "No action -- low [%d] & high [%d] < " |
760 | "current_tpt [%d]\n", | 760 | "current_tpt [%d]\n", |
761 | low_tpt, high_tpt, current_tpt); | 761 | low_tpt, high_tpt, current_tpt); |
762 | scale_action = 0; | 762 | scale_action = 0; |
@@ -771,13 +771,13 @@ static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
771 | window->success_ratio >= IL_RATE_INCREASE_TH) | 771 | window->success_ratio >= IL_RATE_INCREASE_TH) |
772 | scale_action = 1; | 772 | scale_action = 1; |
773 | else { | 773 | else { |
774 | IL_DEBUG_RATE(priv, | 774 | IL_DEBUG_RATE(il, |
775 | "decrease rate because of high tpt\n"); | 775 | "decrease rate because of high tpt\n"); |
776 | scale_action = 0; | 776 | scale_action = 0; |
777 | } | 777 | } |
778 | } else if (low_tpt != IL_INVALID_VALUE) { | 778 | } else if (low_tpt != IL_INVALID_VALUE) { |
779 | if (low_tpt > current_tpt) { | 779 | if (low_tpt > current_tpt) { |
780 | IL_DEBUG_RATE(priv, | 780 | IL_DEBUG_RATE(il, |
781 | "decrease rate because of low tpt\n"); | 781 | "decrease rate because of low tpt\n"); |
782 | scale_action = -1; | 782 | scale_action = -1; |
783 | } else if (window->success_ratio >= IL_RATE_INCREASE_TH) { | 783 | } 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, | |||
816 | break; | 816 | break; |
817 | } | 817 | } |
818 | 818 | ||
819 | IL_DEBUG_RATE(priv, "Selected %d (action %d) - low %d high %d\n", | 819 | IL_DEBUG_RATE(il, "Selected %d (action %d) - low %d high %d\n", |
820 | index, scale_action, low, high); | 820 | index, scale_action, low, high); |
821 | 821 | ||
822 | out: | 822 | out: |
@@ -831,7 +831,7 @@ static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
831 | info->control.rates[0].idx = rs_sta->last_txrate_idx; | 831 | info->control.rates[0].idx = rs_sta->last_txrate_idx; |
832 | } | 832 | } |
833 | 833 | ||
834 | IL_DEBUG_RATE(priv, "leave: %d\n", index); | 834 | IL_DEBUG_RATE(il, "leave: %d\n", index); |
835 | } | 835 | } |
836 | 836 | ||
837 | #ifdef CONFIG_MAC80211_DEBUGFS | 837 | #ifdef CONFIG_MAC80211_DEBUGFS |
@@ -878,10 +878,10 @@ static const struct file_operations rs_sta_dbgfs_stats_table_ops = { | |||
878 | .llseek = default_llseek, | 878 | .llseek = default_llseek, |
879 | }; | 879 | }; |
880 | 880 | ||
881 | static void il3945_add_debugfs(void *priv, void *priv_sta, | 881 | static void il3945_add_debugfs(void *il, void *il_sta, |
882 | struct dentry *dir) | 882 | struct dentry *dir) |
883 | { | 883 | { |
884 | struct il3945_rs_sta *lq_sta = priv_sta; | 884 | struct il3945_rs_sta *lq_sta = il_sta; |
885 | 885 | ||
886 | lq_sta->rs_sta_dbgfs_stats_table_file = | 886 | lq_sta->rs_sta_dbgfs_stats_table_file = |
887 | debugfs_create_file("rate_stats_table", 0600, dir, | 887 | debugfs_create_file("rate_stats_table", 0600, dir, |
@@ -889,9 +889,9 @@ static void il3945_add_debugfs(void *priv, void *priv_sta, | |||
889 | 889 | ||
890 | } | 890 | } |
891 | 891 | ||
892 | static void il3945_remove_debugfs(void *priv, void *priv_sta) | 892 | static void il3945_remove_debugfs(void *il, void *il_sta) |
893 | { | 893 | { |
894 | struct il3945_rs_sta *lq_sta = priv_sta; | 894 | struct il3945_rs_sta *lq_sta = il_sta; |
895 | debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); | 895 | debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); |
896 | } | 896 | } |
897 | #endif | 897 | #endif |
@@ -901,9 +901,9 @@ static void il3945_remove_debugfs(void *priv, void *priv_sta) | |||
901 | * the station is added. Since mac80211 calls this function before a | 901 | * the station is added. Since mac80211 calls this function before a |
902 | * station is added we ignore it. | 902 | * station is added we ignore it. |
903 | */ | 903 | */ |
904 | static void il3945_rs_rate_init_stub(void *priv_r, | 904 | static void il3945_rs_rate_init_stub(void *il_r, |
905 | struct ieee80211_supported_band *sband, | 905 | struct ieee80211_supported_band *sband, |
906 | struct ieee80211_sta *sta, void *priv_sta) | 906 | struct ieee80211_sta *sta, void *il_sta) |
907 | { | 907 | { |
908 | } | 908 | } |
909 | 909 | ||
@@ -925,21 +925,21 @@ static struct rate_control_ops rs_ops = { | |||
925 | }; | 925 | }; |
926 | void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) | 926 | void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) |
927 | { | 927 | { |
928 | struct il_priv *priv = hw->priv; | 928 | struct il_priv *il = hw->priv; |
929 | s32 rssi = 0; | 929 | s32 rssi = 0; |
930 | unsigned long flags; | 930 | unsigned long flags; |
931 | struct il3945_rs_sta *rs_sta; | 931 | struct il3945_rs_sta *rs_sta; |
932 | struct ieee80211_sta *sta; | 932 | struct ieee80211_sta *sta; |
933 | struct il3945_sta_priv *psta; | 933 | struct il3945_sta_priv *psta; |
934 | 934 | ||
935 | IL_DEBUG_RATE(priv, "enter\n"); | 935 | IL_DEBUG_RATE(il, "enter\n"); |
936 | 936 | ||
937 | rcu_read_lock(); | 937 | rcu_read_lock(); |
938 | 938 | ||
939 | sta = ieee80211_find_sta(priv->contexts[IL_RXON_CTX_BSS].vif, | 939 | sta = ieee80211_find_sta(il->contexts[IL_RXON_CTX_BSS].vif, |
940 | priv->stations[sta_id].sta.sta.addr); | 940 | il->stations[sta_id].sta.sta.addr); |
941 | if (!sta) { | 941 | if (!sta) { |
942 | IL_DEBUG_RATE(priv, "Unable to find station to initialize rate scaling.\n"); | 942 | IL_DEBUG_RATE(il, "Unable to find station to initialize rate scaling.\n"); |
943 | rcu_read_unlock(); | 943 | rcu_read_unlock(); |
944 | return; | 944 | return; |
945 | } | 945 | } |
@@ -950,10 +950,10 @@ void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) | |||
950 | spin_lock_irqsave(&rs_sta->lock, flags); | 950 | spin_lock_irqsave(&rs_sta->lock, flags); |
951 | 951 | ||
952 | rs_sta->tgg = 0; | 952 | rs_sta->tgg = 0; |
953 | switch (priv->band) { | 953 | switch (il->band) { |
954 | case IEEE80211_BAND_2GHZ: | 954 | case IEEE80211_BAND_2GHZ: |
955 | /* TODO: this always does G, not a regression */ | 955 | /* TODO: this always does G, not a regression */ |
956 | if (priv->contexts[IL_RXON_CTX_BSS].active.flags & | 956 | if (il->contexts[IL_RXON_CTX_BSS].active.flags & |
957 | RXON_FLG_TGG_PROTECT_MSK) { | 957 | RXON_FLG_TGG_PROTECT_MSK) { |
958 | rs_sta->tgg = 1; | 958 | rs_sta->tgg = 1; |
959 | rs_sta->expected_tpt = il3945_expected_tpt_g_prot; | 959 | 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) | |||
971 | 971 | ||
972 | spin_unlock_irqrestore(&rs_sta->lock, flags); | 972 | spin_unlock_irqrestore(&rs_sta->lock, flags); |
973 | 973 | ||
974 | rssi = priv->_3945.last_rx_rssi; | 974 | rssi = il->_3945.last_rx_rssi; |
975 | if (rssi == 0) | 975 | if (rssi == 0) |
976 | rssi = IL_MIN_RSSI_VAL; | 976 | rssi = IL_MIN_RSSI_VAL; |
977 | 977 | ||
978 | IL_DEBUG_RATE(priv, "Network RSSI: %d\n", rssi); | 978 | IL_DEBUG_RATE(il, "Network RSSI: %d\n", rssi); |
979 | 979 | ||
980 | rs_sta->start_rate = il3945_get_rate_index_by_rssi(rssi, priv->band); | 980 | rs_sta->start_rate = il3945_get_rate_index_by_rssi(rssi, il->band); |
981 | 981 | ||
982 | IL_DEBUG_RATE(priv, "leave: rssi %d assign rate index: " | 982 | IL_DEBUG_RATE(il, "leave: rssi %d assign rate index: " |
983 | "%d (plcp 0x%x)\n", rssi, rs_sta->start_rate, | 983 | "%d (plcp 0x%x)\n", rssi, rs_sta->start_rate, |
984 | il3945_rates[rs_sta->start_rate].plcp); | 984 | il3945_rates[rs_sta->start_rate].plcp); |
985 | rcu_read_unlock(); | 985 | rcu_read_unlock(); |
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945.c b/drivers/net/wireless/iwlegacy/iwl-3945.c index 6d1740b051d..c9b5dcf446b 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) | |||
108 | * Use for only special debugging. This function is just a placeholder as-is, | 108 | * Use for only special debugging. This function is just a placeholder as-is, |
109 | * you'll need to provide the special bits! ... | 109 | * you'll need to provide the special bits! ... |
110 | * ... and set IL_EVT_DISABLE to 1. */ | 110 | * ... and set IL_EVT_DISABLE to 1. */ |
111 | void il3945_disable_events(struct il_priv *priv) | 111 | void il3945_disable_events(struct il_priv *il) |
112 | { | 112 | { |
113 | int i; | 113 | int i; |
114 | u32 base; /* SRAM address of event log header */ | 114 | u32 base; /* SRAM address of event log header */ |
@@ -164,27 +164,27 @@ void il3945_disable_events(struct il_priv *priv) | |||
164 | 0x00000000, /* 1503 - 1472 */ | 164 | 0x00000000, /* 1503 - 1472 */ |
165 | }; | 165 | }; |
166 | 166 | ||
167 | base = le32_to_cpu(priv->card_alive.log_event_table_ptr); | 167 | base = le32_to_cpu(il->card_alive.log_event_table_ptr); |
168 | if (!il3945_hw_valid_rtc_data_addr(base)) { | 168 | if (!il3945_hw_valid_rtc_data_addr(base)) { |
169 | IL_ERR(priv, "Invalid event log pointer 0x%08X\n", base); | 169 | IL_ERR(il, "Invalid event log pointer 0x%08X\n", base); |
170 | return; | 170 | return; |
171 | } | 171 | } |
172 | 172 | ||
173 | disable_ptr = il_read_targ_mem(priv, base + (4 * sizeof(u32))); | 173 | disable_ptr = il_read_targ_mem(il, base + (4 * sizeof(u32))); |
174 | array_size = il_read_targ_mem(priv, base + (5 * sizeof(u32))); | 174 | array_size = il_read_targ_mem(il, base + (5 * sizeof(u32))); |
175 | 175 | ||
176 | if (IL_EVT_DISABLE && (array_size == IL_EVT_DISABLE_SIZE)) { | 176 | if (IL_EVT_DISABLE && (array_size == IL_EVT_DISABLE_SIZE)) { |
177 | IL_DEBUG_INFO(priv, "Disabling selected uCode log events at 0x%x\n", | 177 | IL_DEBUG_INFO(il, "Disabling selected uCode log events at 0x%x\n", |
178 | disable_ptr); | 178 | disable_ptr); |
179 | for (i = 0; i < IL_EVT_DISABLE_SIZE; i++) | 179 | for (i = 0; i < IL_EVT_DISABLE_SIZE; i++) |
180 | il_write_targ_mem(priv, | 180 | il_write_targ_mem(il, |
181 | disable_ptr + (i * sizeof(u32)), | 181 | disable_ptr + (i * sizeof(u32)), |
182 | evt_disable[i]); | 182 | evt_disable[i]); |
183 | 183 | ||
184 | } else { | 184 | } else { |
185 | IL_DEBUG_INFO(priv, "Selected uCode log events may be disabled\n"); | 185 | IL_DEBUG_INFO(il, "Selected uCode log events may be disabled\n"); |
186 | IL_DEBUG_INFO(priv, " by writing \"1\"s into disable bitmap\n"); | 186 | IL_DEBUG_INFO(il, " by writing \"1\"s into disable bitmap\n"); |
187 | IL_DEBUG_INFO(priv, " in SRAM at 0x%x, size %d u32s\n", | 187 | IL_DEBUG_INFO(il, " in SRAM at 0x%x, size %d u32s\n", |
188 | disable_ptr, array_size); | 188 | disable_ptr, array_size); |
189 | } | 189 | } |
190 | 190 | ||
@@ -240,11 +240,11 @@ static inline const char *il3945_get_tx_fail_reason(u32 status) | |||
240 | * for A and B mode we need to overright prev | 240 | * for A and B mode we need to overright prev |
241 | * value | 241 | * value |
242 | */ | 242 | */ |
243 | int il3945_rs_next_rate(struct il_priv *priv, int rate) | 243 | int il3945_rs_next_rate(struct il_priv *il, int rate) |
244 | { | 244 | { |
245 | int next_rate = il3945_get_prev_ieee_rate(rate); | 245 | int next_rate = il3945_get_prev_ieee_rate(rate); |
246 | 246 | ||
247 | switch (priv->band) { | 247 | switch (il->band) { |
248 | case IEEE80211_BAND_5GHZ: | 248 | case IEEE80211_BAND_5GHZ: |
249 | if (rate == IL_RATE_12M_INDEX) | 249 | if (rate == IL_RATE_12M_INDEX) |
250 | next_rate = IL_RATE_9M_INDEX; | 250 | next_rate = IL_RATE_9M_INDEX; |
@@ -252,8 +252,8 @@ int il3945_rs_next_rate(struct il_priv *priv, int rate) | |||
252 | next_rate = IL_RATE_6M_INDEX; | 252 | next_rate = IL_RATE_6M_INDEX; |
253 | break; | 253 | break; |
254 | case IEEE80211_BAND_2GHZ: | 254 | case IEEE80211_BAND_2GHZ: |
255 | if (!(priv->_3945.sta_supp_rates & IL_OFDM_RATES_MASK) && | 255 | if (!(il->_3945.sta_supp_rates & IL_OFDM_RATES_MASK) && |
256 | il_is_associated(priv, IL_RXON_CTX_BSS)) { | 256 | il_is_associated(il, IL_RXON_CTX_BSS)) { |
257 | if (rate == IL_RATE_11M_INDEX) | 257 | if (rate == IL_RATE_11M_INDEX) |
258 | next_rate = IL_RATE_5M_INDEX; | 258 | next_rate = IL_RATE_5M_INDEX; |
259 | } | 259 | } |
@@ -274,10 +274,10 @@ int il3945_rs_next_rate(struct il_priv *priv, int rate) | |||
274 | * need to be reclaimed. As result, some free space forms. If there is | 274 | * need to be reclaimed. As result, some free space forms. If there is |
275 | * enough free space (> low mark), wake the stack that feeds us. | 275 | * enough free space (> low mark), wake the stack that feeds us. |
276 | */ | 276 | */ |
277 | static void il3945_tx_queue_reclaim(struct il_priv *priv, | 277 | static void il3945_tx_queue_reclaim(struct il_priv *il, |
278 | int txq_id, int index) | 278 | int txq_id, int index) |
279 | { | 279 | { |
280 | struct il_tx_queue *txq = &priv->txq[txq_id]; | 280 | struct il_tx_queue *txq = &il->txq[txq_id]; |
281 | struct il_queue *q = &txq->q; | 281 | struct il_queue *q = &txq->q; |
282 | struct il_tx_info *tx_info; | 282 | struct il_tx_info *tx_info; |
283 | 283 | ||
@@ -288,28 +288,28 @@ static void il3945_tx_queue_reclaim(struct il_priv *priv, | |||
288 | q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd)) { | 288 | q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd)) { |
289 | 289 | ||
290 | tx_info = &txq->txb[txq->q.read_ptr]; | 290 | tx_info = &txq->txb[txq->q.read_ptr]; |
291 | ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb); | 291 | ieee80211_tx_status_irqsafe(il->hw, tx_info->skb); |
292 | tx_info->skb = NULL; | 292 | tx_info->skb = NULL; |
293 | priv->cfg->ops->lib->txq_free_tfd(priv, txq); | 293 | il->cfg->ops->lib->txq_free_tfd(il, txq); |
294 | } | 294 | } |
295 | 295 | ||
296 | if (il_queue_space(q) > q->low_mark && (txq_id >= 0) && | 296 | if (il_queue_space(q) > q->low_mark && (txq_id >= 0) && |
297 | (txq_id != IWL39_CMD_QUEUE_NUM) && | 297 | (txq_id != IWL39_CMD_QUEUE_NUM) && |
298 | priv->mac80211_registered) | 298 | il->mac80211_registered) |
299 | il_wake_queue(priv, txq); | 299 | il_wake_queue(il, txq); |
300 | } | 300 | } |
301 | 301 | ||
302 | /** | 302 | /** |
303 | * il3945_rx_reply_tx - Handle Tx response | 303 | * il3945_rx_reply_tx - Handle Tx response |
304 | */ | 304 | */ |
305 | static void il3945_rx_reply_tx(struct il_priv *priv, | 305 | static void il3945_rx_reply_tx(struct il_priv *il, |
306 | struct il_rx_mem_buffer *rxb) | 306 | struct il_rx_mem_buffer *rxb) |
307 | { | 307 | { |
308 | struct il_rx_packet *pkt = rxb_addr(rxb); | 308 | struct il_rx_packet *pkt = rxb_addr(rxb); |
309 | u16 sequence = le16_to_cpu(pkt->hdr.sequence); | 309 | u16 sequence = le16_to_cpu(pkt->hdr.sequence); |
310 | int txq_id = SEQ_TO_QUEUE(sequence); | 310 | int txq_id = SEQ_TO_QUEUE(sequence); |
311 | int index = SEQ_TO_INDEX(sequence); | 311 | int index = SEQ_TO_INDEX(sequence); |
312 | struct il_tx_queue *txq = &priv->txq[txq_id]; | 312 | struct il_tx_queue *txq = &il->txq[txq_id]; |
313 | struct ieee80211_tx_info *info; | 313 | struct ieee80211_tx_info *info; |
314 | struct il3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; | 314 | struct il3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; |
315 | u32 status = le32_to_cpu(tx_resp->status); | 315 | u32 status = le32_to_cpu(tx_resp->status); |
@@ -317,7 +317,7 @@ static void il3945_rx_reply_tx(struct il_priv *priv, | |||
317 | int fail; | 317 | int fail; |
318 | 318 | ||
319 | if ((index >= txq->q.n_bd) || (il_queue_used(&txq->q, index) == 0)) { | 319 | if ((index >= txq->q.n_bd) || (il_queue_used(&txq->q, index) == 0)) { |
320 | IL_ERR(priv, "Read index for DMA queue txq_id (%d) index %d " | 320 | IL_ERR(il, "Read index for DMA queue txq_id (%d) index %d " |
321 | "is out of range [0-%d] %d %d\n", txq_id, | 321 | "is out of range [0-%d] %d %d\n", txq_id, |
322 | index, txq->q.n_bd, txq->q.write_ptr, | 322 | index, txq->q.n_bd, txq->q.write_ptr, |
323 | txq->q.read_ptr); | 323 | txq->q.read_ptr); |
@@ -342,15 +342,15 @@ static void il3945_rx_reply_tx(struct il_priv *priv, | |||
342 | info->flags |= ((status & TX_STATUS_MSK) == TX_STATUS_SUCCESS) ? | 342 | info->flags |= ((status & TX_STATUS_MSK) == TX_STATUS_SUCCESS) ? |
343 | IEEE80211_TX_STAT_ACK : 0; | 343 | IEEE80211_TX_STAT_ACK : 0; |
344 | 344 | ||
345 | IL_DEBUG_TX(priv, "Tx queue %d Status %s (0x%08x) plcp rate %d retries %d\n", | 345 | IL_DEBUG_TX(il, "Tx queue %d Status %s (0x%08x) plcp rate %d retries %d\n", |
346 | txq_id, il3945_get_tx_fail_reason(status), status, | 346 | txq_id, il3945_get_tx_fail_reason(status), status, |
347 | tx_resp->rate, tx_resp->failure_frame); | 347 | tx_resp->rate, tx_resp->failure_frame); |
348 | 348 | ||
349 | IL_DEBUG_TX_REPLY(priv, "Tx queue reclaim %d\n", index); | 349 | IL_DEBUG_TX_REPLY(il, "Tx queue reclaim %d\n", index); |
350 | il3945_tx_queue_reclaim(priv, txq_id, index); | 350 | il3945_tx_queue_reclaim(il, txq_id, index); |
351 | 351 | ||
352 | if (status & TX_ABORT_REQUIRED_MSK) | 352 | if (status & TX_ABORT_REQUIRED_MSK) |
353 | IL_ERR(priv, "TODO: Implement Tx ABORT REQUIRED!!!\n"); | 353 | IL_ERR(il, "TODO: Implement Tx ABORT REQUIRED!!!\n"); |
354 | } | 354 | } |
355 | 355 | ||
356 | 356 | ||
@@ -363,7 +363,7 @@ static void il3945_rx_reply_tx(struct il_priv *priv, | |||
363 | * | 363 | * |
364 | *****************************************************************************/ | 364 | *****************************************************************************/ |
365 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS | 365 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS |
366 | static void il3945_accumulative_statistics(struct il_priv *priv, | 366 | static void il3945_accumulative_statistics(struct il_priv *il, |
367 | __le32 *stats) | 367 | __le32 *stats) |
368 | { | 368 | { |
369 | int i; | 369 | int i; |
@@ -371,10 +371,10 @@ static void il3945_accumulative_statistics(struct il_priv *priv, | |||
371 | u32 *accum_stats; | 371 | u32 *accum_stats; |
372 | u32 *delta, *max_delta; | 372 | u32 *delta, *max_delta; |
373 | 373 | ||
374 | prev_stats = (__le32 *)&priv->_3945.statistics; | 374 | prev_stats = (__le32 *)&il->_3945.statistics; |
375 | accum_stats = (u32 *)&priv->_3945.accum_statistics; | 375 | accum_stats = (u32 *)&il->_3945.accum_statistics; |
376 | delta = (u32 *)&priv->_3945.delta_statistics; | 376 | delta = (u32 *)&il->_3945.delta_statistics; |
377 | max_delta = (u32 *)&priv->_3945.max_delta; | 377 | max_delta = (u32 *)&il->_3945.max_delta; |
378 | 378 | ||
379 | for (i = sizeof(__le32); i < sizeof(struct il3945_notif_statistics); | 379 | for (i = sizeof(__le32); i < sizeof(struct il3945_notif_statistics); |
380 | i += sizeof(__le32), stats++, prev_stats++, delta++, | 380 | i += sizeof(__le32), stats++, prev_stats++, delta++, |
@@ -389,29 +389,29 @@ static void il3945_accumulative_statistics(struct il_priv *priv, | |||
389 | } | 389 | } |
390 | 390 | ||
391 | /* reset accumulative statistics for "no-counter" type statistics */ | 391 | /* reset accumulative statistics for "no-counter" type statistics */ |
392 | priv->_3945.accum_statistics.general.temperature = | 392 | il->_3945.accum_statistics.general.temperature = |
393 | priv->_3945.statistics.general.temperature; | 393 | il->_3945.statistics.general.temperature; |
394 | priv->_3945.accum_statistics.general.ttl_timestamp = | 394 | il->_3945.accum_statistics.general.ttl_timestamp = |
395 | priv->_3945.statistics.general.ttl_timestamp; | 395 | il->_3945.statistics.general.ttl_timestamp; |
396 | } | 396 | } |
397 | #endif | 397 | #endif |
398 | 398 | ||
399 | void il3945_hw_rx_statistics(struct il_priv *priv, | 399 | void il3945_hw_rx_statistics(struct il_priv *il, |
400 | struct il_rx_mem_buffer *rxb) | 400 | struct il_rx_mem_buffer *rxb) |
401 | { | 401 | { |
402 | struct il_rx_packet *pkt = rxb_addr(rxb); | 402 | struct il_rx_packet *pkt = rxb_addr(rxb); |
403 | 403 | ||
404 | IL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n", | 404 | IL_DEBUG_RX(il, "Statistics notification received (%d vs %d).\n", |
405 | (int)sizeof(struct il3945_notif_statistics), | 405 | (int)sizeof(struct il3945_notif_statistics), |
406 | le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK); | 406 | le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK); |
407 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS | 407 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS |
408 | il3945_accumulative_statistics(priv, (__le32 *)&pkt->u.raw); | 408 | il3945_accumulative_statistics(il, (__le32 *)&pkt->u.raw); |
409 | #endif | 409 | #endif |
410 | 410 | ||
411 | memcpy(&priv->_3945.statistics, pkt->u.raw, sizeof(priv->_3945.statistics)); | 411 | memcpy(&il->_3945.statistics, pkt->u.raw, sizeof(il->_3945.statistics)); |
412 | } | 412 | } |
413 | 413 | ||
414 | void il3945_reply_statistics(struct il_priv *priv, | 414 | void il3945_reply_statistics(struct il_priv *il, |
415 | struct il_rx_mem_buffer *rxb) | 415 | struct il_rx_mem_buffer *rxb) |
416 | { | 416 | { |
417 | struct il_rx_packet *pkt = rxb_addr(rxb); | 417 | struct il_rx_packet *pkt = rxb_addr(rxb); |
@@ -419,16 +419,16 @@ void il3945_reply_statistics(struct il_priv *priv, | |||
419 | 419 | ||
420 | if (le32_to_cpu(*flag) & UCODE_STATISTICS_CLEAR_MSK) { | 420 | if (le32_to_cpu(*flag) & UCODE_STATISTICS_CLEAR_MSK) { |
421 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS | 421 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS |
422 | memset(&priv->_3945.accum_statistics, 0, | 422 | memset(&il->_3945.accum_statistics, 0, |
423 | sizeof(struct il3945_notif_statistics)); | 423 | sizeof(struct il3945_notif_statistics)); |
424 | memset(&priv->_3945.delta_statistics, 0, | 424 | memset(&il->_3945.delta_statistics, 0, |
425 | sizeof(struct il3945_notif_statistics)); | 425 | sizeof(struct il3945_notif_statistics)); |
426 | memset(&priv->_3945.max_delta, 0, | 426 | memset(&il->_3945.max_delta, 0, |
427 | sizeof(struct il3945_notif_statistics)); | 427 | sizeof(struct il3945_notif_statistics)); |
428 | #endif | 428 | #endif |
429 | IL_DEBUG_RX(priv, "Statistics have been cleared\n"); | 429 | IL_DEBUG_RX(il, "Statistics have been cleared\n"); |
430 | } | 430 | } |
431 | il3945_hw_rx_statistics(priv, rxb); | 431 | il3945_hw_rx_statistics(il, rxb); |
432 | } | 432 | } |
433 | 433 | ||
434 | 434 | ||
@@ -439,24 +439,24 @@ void il3945_reply_statistics(struct il_priv *priv, | |||
439 | ******************************************************************************/ | 439 | ******************************************************************************/ |
440 | 440 | ||
441 | /* This is necessary only for a number of statistics, see the caller. */ | 441 | /* This is necessary only for a number of statistics, see the caller. */ |
442 | static int il3945_is_network_packet(struct il_priv *priv, | 442 | static int il3945_is_network_packet(struct il_priv *il, |
443 | struct ieee80211_hdr *header) | 443 | struct ieee80211_hdr *header) |
444 | { | 444 | { |
445 | /* Filter incoming packets to determine if they are targeted toward | 445 | /* Filter incoming packets to determine if they are targeted toward |
446 | * this network, discarding packets coming from ourselves */ | 446 | * this network, discarding packets coming from ourselves */ |
447 | switch (priv->iw_mode) { | 447 | switch (il->iw_mode) { |
448 | case NL80211_IFTYPE_ADHOC: /* Header: Dest. | Source | BSSID */ | 448 | case NL80211_IFTYPE_ADHOC: /* Header: Dest. | Source | BSSID */ |
449 | /* packets to our IBSS update information */ | 449 | /* packets to our IBSS update information */ |
450 | return !compare_ether_addr(header->addr3, priv->bssid); | 450 | return !compare_ether_addr(header->addr3, il->bssid); |
451 | case NL80211_IFTYPE_STATION: /* Header: Dest. | AP{BSSID} | Source */ | 451 | case NL80211_IFTYPE_STATION: /* Header: Dest. | AP{BSSID} | Source */ |
452 | /* packets to our IBSS update information */ | 452 | /* packets to our IBSS update information */ |
453 | return !compare_ether_addr(header->addr2, priv->bssid); | 453 | return !compare_ether_addr(header->addr2, il->bssid); |
454 | default: | 454 | default: |
455 | return 1; | 455 | return 1; |
456 | } | 456 | } |
457 | } | 457 | } |
458 | 458 | ||
459 | static void il3945_pass_packet_to_mac80211(struct il_priv *priv, | 459 | static void il3945_pass_packet_to_mac80211(struct il_priv *il, |
460 | struct il_rx_mem_buffer *rxb, | 460 | struct il_rx_mem_buffer *rxb, |
461 | struct ieee80211_rx_status *stats) | 461 | struct ieee80211_rx_status *stats) |
462 | { | 462 | { |
@@ -470,43 +470,43 @@ static void il3945_pass_packet_to_mac80211(struct il_priv *priv, | |||
470 | 470 | ||
471 | /* We received data from the HW, so stop the watchdog */ | 471 | /* We received data from the HW, so stop the watchdog */ |
472 | if (unlikely(len + IWL39_RX_FRAME_SIZE > | 472 | if (unlikely(len + IWL39_RX_FRAME_SIZE > |
473 | PAGE_SIZE << priv->hw_params.rx_page_order)) { | 473 | PAGE_SIZE << il->hw_params.rx_page_order)) { |
474 | IL_DEBUG_DROP(priv, "Corruption detected!\n"); | 474 | IL_DEBUG_DROP(il, "Corruption detected!\n"); |
475 | return; | 475 | return; |
476 | } | 476 | } |
477 | 477 | ||
478 | /* We only process data packets if the interface is open */ | 478 | /* We only process data packets if the interface is open */ |
479 | if (unlikely(!priv->is_open)) { | 479 | if (unlikely(!il->is_open)) { |
480 | IL_DEBUG_DROP_LIMIT(priv, | 480 | IL_DEBUG_DROP_LIMIT(il, |
481 | "Dropping packet while interface is not open.\n"); | 481 | "Dropping packet while interface is not open.\n"); |
482 | return; | 482 | return; |
483 | } | 483 | } |
484 | 484 | ||
485 | skb = dev_alloc_skb(128); | 485 | skb = dev_alloc_skb(128); |
486 | if (!skb) { | 486 | if (!skb) { |
487 | IL_ERR(priv, "dev_alloc_skb failed\n"); | 487 | IL_ERR(il, "dev_alloc_skb failed\n"); |
488 | return; | 488 | return; |
489 | } | 489 | } |
490 | 490 | ||
491 | if (!il3945_mod_params.sw_crypto) | 491 | if (!il3945_mod_params.sw_crypto) |
492 | il_set_decrypted_flag(priv, | 492 | il_set_decrypted_flag(il, |
493 | (struct ieee80211_hdr *)rxb_addr(rxb), | 493 | (struct ieee80211_hdr *)rxb_addr(rxb), |
494 | le32_to_cpu(rx_end->status), stats); | 494 | le32_to_cpu(rx_end->status), stats); |
495 | 495 | ||
496 | skb_add_rx_frag(skb, 0, rxb->page, | 496 | skb_add_rx_frag(skb, 0, rxb->page, |
497 | (void *)rx_hdr->payload - (void *)pkt, len); | 497 | (void *)rx_hdr->payload - (void *)pkt, len); |
498 | 498 | ||
499 | il_update_stats(priv, false, fc, len); | 499 | il_update_stats(il, false, fc, len); |
500 | memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); | 500 | memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); |
501 | 501 | ||
502 | ieee80211_rx(priv->hw, skb); | 502 | ieee80211_rx(il->hw, skb); |
503 | priv->alloc_rxb_page--; | 503 | il->alloc_rxb_page--; |
504 | rxb->page = NULL; | 504 | rxb->page = NULL; |
505 | } | 505 | } |
506 | 506 | ||
507 | #define IL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6) | 507 | #define IL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6) |
508 | 508 | ||
509 | static void il3945_rx_reply_rx(struct il_priv *priv, | 509 | static void il3945_rx_reply_rx(struct il_priv *il, |
510 | struct il_rx_mem_buffer *rxb) | 510 | struct il_rx_mem_buffer *rxb) |
511 | { | 511 | { |
512 | struct ieee80211_hdr *header; | 512 | struct ieee80211_hdr *header; |
@@ -539,14 +539,14 @@ static void il3945_rx_reply_rx(struct il_priv *priv, | |||
539 | rx_status.flag |= RX_FLAG_SHORTPRE; | 539 | rx_status.flag |= RX_FLAG_SHORTPRE; |
540 | 540 | ||
541 | if ((unlikely(rx_stats->phy_count > 20))) { | 541 | if ((unlikely(rx_stats->phy_count > 20))) { |
542 | IL_DEBUG_DROP(priv, "dsp size out of range [0,20]: %d/n", | 542 | IL_DEBUG_DROP(il, "dsp size out of range [0,20]: %d/n", |
543 | rx_stats->phy_count); | 543 | rx_stats->phy_count); |
544 | return; | 544 | return; |
545 | } | 545 | } |
546 | 546 | ||
547 | if (!(rx_end->status & RX_RES_STATUS_NO_CRC32_ERROR) | 547 | if (!(rx_end->status & RX_RES_STATUS_NO_CRC32_ERROR) |
548 | || !(rx_end->status & RX_RES_STATUS_NO_RXE_OVERFLOW)) { | 548 | || !(rx_end->status & RX_RES_STATUS_NO_RXE_OVERFLOW)) { |
549 | IL_DEBUG_RX(priv, "Bad CRC or FIFO: 0x%08X.\n", rx_end->status); | 549 | IL_DEBUG_RX(il, "Bad CRC or FIFO: 0x%08X.\n", rx_end->status); |
550 | return; | 550 | return; |
551 | } | 551 | } |
552 | 552 | ||
@@ -555,34 +555,34 @@ static void il3945_rx_reply_rx(struct il_priv *priv, | |||
555 | /* Convert 3945's rssi indicator to dBm */ | 555 | /* Convert 3945's rssi indicator to dBm */ |
556 | rx_status.signal = rx_stats->rssi - IWL39_RSSI_OFFSET; | 556 | rx_status.signal = rx_stats->rssi - IWL39_RSSI_OFFSET; |
557 | 557 | ||
558 | IL_DEBUG_STATS(priv, "Rssi %d sig_avg %d noise_diff %d\n", | 558 | IL_DEBUG_STATS(il, "Rssi %d sig_avg %d noise_diff %d\n", |
559 | rx_status.signal, rx_stats_sig_avg, | 559 | rx_status.signal, rx_stats_sig_avg, |
560 | rx_stats_noise_diff); | 560 | rx_stats_noise_diff); |
561 | 561 | ||
562 | header = (struct ieee80211_hdr *)IL_RX_DATA(pkt); | 562 | header = (struct ieee80211_hdr *)IL_RX_DATA(pkt); |
563 | 563 | ||
564 | network_packet = il3945_is_network_packet(priv, header); | 564 | network_packet = il3945_is_network_packet(il, header); |
565 | 565 | ||
566 | IL_DEBUG_STATS_LIMIT(priv, "[%c] %d RSSI:%d Signal:%u, Rate:%u\n", | 566 | IL_DEBUG_STATS_LIMIT(il, "[%c] %d RSSI:%d Signal:%u, Rate:%u\n", |
567 | network_packet ? '*' : ' ', | 567 | network_packet ? '*' : ' ', |
568 | le16_to_cpu(rx_hdr->channel), | 568 | le16_to_cpu(rx_hdr->channel), |
569 | rx_status.signal, rx_status.signal, | 569 | rx_status.signal, rx_status.signal, |
570 | rx_status.rate_idx); | 570 | rx_status.rate_idx); |
571 | 571 | ||
572 | il_dbg_log_rx_data_frame(priv, le16_to_cpu(rx_hdr->len), | 572 | il_dbg_log_rx_data_frame(il, le16_to_cpu(rx_hdr->len), |
573 | header); | 573 | header); |
574 | 574 | ||
575 | if (network_packet) { | 575 | if (network_packet) { |
576 | priv->_3945.last_beacon_time = | 576 | il->_3945.last_beacon_time = |
577 | le32_to_cpu(rx_end->beacon_timestamp); | 577 | le32_to_cpu(rx_end->beacon_timestamp); |
578 | priv->_3945.last_tsf = le64_to_cpu(rx_end->timestamp); | 578 | il->_3945.last_tsf = le64_to_cpu(rx_end->timestamp); |
579 | priv->_3945.last_rx_rssi = rx_status.signal; | 579 | il->_3945.last_rx_rssi = rx_status.signal; |
580 | } | 580 | } |
581 | 581 | ||
582 | il3945_pass_packet_to_mac80211(priv, rxb, &rx_status); | 582 | il3945_pass_packet_to_mac80211(il, rxb, &rx_status); |
583 | } | 583 | } |
584 | 584 | ||
585 | int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *priv, | 585 | int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *il, |
586 | struct il_tx_queue *txq, | 586 | struct il_tx_queue *txq, |
587 | dma_addr_t addr, u16 len, u8 reset, u8 pad) | 587 | dma_addr_t addr, u16 len, u8 reset, u8 pad) |
588 | { | 588 | { |
@@ -600,7 +600,7 @@ int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *priv, | |||
600 | count = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags)); | 600 | count = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags)); |
601 | 601 | ||
602 | if ((count >= NUM_TFD_CHUNKS) || (count < 0)) { | 602 | if ((count >= NUM_TFD_CHUNKS) || (count < 0)) { |
603 | IL_ERR(priv, "Error can not send more than %d chunks\n", | 603 | IL_ERR(il, "Error can not send more than %d chunks\n", |
604 | NUM_TFD_CHUNKS); | 604 | NUM_TFD_CHUNKS); |
605 | return -EINVAL; | 605 | return -EINVAL; |
606 | } | 606 | } |
@@ -621,19 +621,19 @@ int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *priv, | |||
621 | * | 621 | * |
622 | * Does NOT advance any indexes | 622 | * Does NOT advance any indexes |
623 | */ | 623 | */ |
624 | void il3945_hw_txq_free_tfd(struct il_priv *priv, struct il_tx_queue *txq) | 624 | void il3945_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq) |
625 | { | 625 | { |
626 | struct il3945_tfd *tfd_tmp = (struct il3945_tfd *)txq->tfds; | 626 | struct il3945_tfd *tfd_tmp = (struct il3945_tfd *)txq->tfds; |
627 | int index = txq->q.read_ptr; | 627 | int index = txq->q.read_ptr; |
628 | struct il3945_tfd *tfd = &tfd_tmp[index]; | 628 | struct il3945_tfd *tfd = &tfd_tmp[index]; |
629 | struct pci_dev *dev = priv->pci_dev; | 629 | struct pci_dev *dev = il->pci_dev; |
630 | int i; | 630 | int i; |
631 | int counter; | 631 | int counter; |
632 | 632 | ||
633 | /* sanity check */ | 633 | /* sanity check */ |
634 | counter = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags)); | 634 | counter = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags)); |
635 | if (counter > NUM_TFD_CHUNKS) { | 635 | if (counter > NUM_TFD_CHUNKS) { |
636 | IL_ERR(priv, "Too many chunks: %i\n", counter); | 636 | IL_ERR(il, "Too many chunks: %i\n", counter); |
637 | /* @todo issue fatal error, it is quite serious situation */ | 637 | /* @todo issue fatal error, it is quite serious situation */ |
638 | return; | 638 | return; |
639 | } | 639 | } |
@@ -669,13 +669,13 @@ void il3945_hw_txq_free_tfd(struct il_priv *priv, struct il_tx_queue *txq) | |||
669 | * il3945_hw_build_tx_cmd_rate - Add rate portion to TX_CMD: | 669 | * il3945_hw_build_tx_cmd_rate - Add rate portion to TX_CMD: |
670 | * | 670 | * |
671 | */ | 671 | */ |
672 | void il3945_hw_build_tx_cmd_rate(struct il_priv *priv, | 672 | void il3945_hw_build_tx_cmd_rate(struct il_priv *il, |
673 | struct il_device_cmd *cmd, | 673 | struct il_device_cmd *cmd, |
674 | struct ieee80211_tx_info *info, | 674 | struct ieee80211_tx_info *info, |
675 | struct ieee80211_hdr *hdr, | 675 | struct ieee80211_hdr *hdr, |
676 | int sta_id, int tx_id) | 676 | int sta_id, int tx_id) |
677 | { | 677 | { |
678 | u16 hw_value = ieee80211_get_tx_rate(priv->hw, info)->hw_value; | 678 | u16 hw_value = ieee80211_get_tx_rate(il->hw, info)->hw_value; |
679 | u16 rate_index = min(hw_value & 0xffff, IL_RATE_COUNT_3945); | 679 | u16 rate_index = min(hw_value & 0xffff, IL_RATE_COUNT_3945); |
680 | u16 rate_mask; | 680 | u16 rate_mask; |
681 | int rate; | 681 | int rate; |
@@ -718,13 +718,13 @@ void il3945_hw_build_tx_cmd_rate(struct il_priv *priv, | |||
718 | /* CCK */ | 718 | /* CCK */ |
719 | tx_cmd->supp_rates[1] = (rate_mask & 0xF); | 719 | tx_cmd->supp_rates[1] = (rate_mask & 0xF); |
720 | 720 | ||
721 | IL_DEBUG_RATE(priv, "Tx sta id: %d, rate: %d (plcp), flags: 0x%4X " | 721 | IL_DEBUG_RATE(il, "Tx sta id: %d, rate: %d (plcp), flags: 0x%4X " |
722 | "cck/ofdm mask: 0x%x/0x%x\n", sta_id, | 722 | "cck/ofdm mask: 0x%x/0x%x\n", sta_id, |
723 | tx_cmd->rate, le32_to_cpu(tx_cmd->tx_flags), | 723 | tx_cmd->rate, le32_to_cpu(tx_cmd->tx_flags), |
724 | tx_cmd->supp_rates[1], tx_cmd->supp_rates[0]); | 724 | tx_cmd->supp_rates[1], tx_cmd->supp_rates[0]); |
725 | } | 725 | } |
726 | 726 | ||
727 | static u8 il3945_sync_sta(struct il_priv *priv, int sta_id, u16 tx_rate) | 727 | static u8 il3945_sync_sta(struct il_priv *il, int sta_id, u16 tx_rate) |
728 | { | 728 | { |
729 | unsigned long flags_spin; | 729 | unsigned long flags_spin; |
730 | struct il_station_entry *station; | 730 | struct il_station_entry *station; |
@@ -732,52 +732,52 @@ static u8 il3945_sync_sta(struct il_priv *priv, int sta_id, u16 tx_rate) | |||
732 | if (sta_id == IL_INVALID_STATION) | 732 | if (sta_id == IL_INVALID_STATION) |
733 | return IL_INVALID_STATION; | 733 | return IL_INVALID_STATION; |
734 | 734 | ||
735 | spin_lock_irqsave(&priv->sta_lock, flags_spin); | 735 | spin_lock_irqsave(&il->sta_lock, flags_spin); |
736 | station = &priv->stations[sta_id]; | 736 | station = &il->stations[sta_id]; |
737 | 737 | ||
738 | station->sta.sta.modify_mask = STA_MODIFY_TX_RATE_MSK; | 738 | station->sta.sta.modify_mask = STA_MODIFY_TX_RATE_MSK; |
739 | station->sta.rate_n_flags = cpu_to_le16(tx_rate); | 739 | station->sta.rate_n_flags = cpu_to_le16(tx_rate); |
740 | station->sta.mode = STA_CONTROL_MODIFY_MSK; | 740 | station->sta.mode = STA_CONTROL_MODIFY_MSK; |
741 | il_send_add_sta(priv, &station->sta, CMD_ASYNC); | 741 | il_send_add_sta(il, &station->sta, CMD_ASYNC); |
742 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); | 742 | spin_unlock_irqrestore(&il->sta_lock, flags_spin); |
743 | 743 | ||
744 | IL_DEBUG_RATE(priv, "SCALE sync station %d to rate %d\n", | 744 | IL_DEBUG_RATE(il, "SCALE sync station %d to rate %d\n", |
745 | sta_id, tx_rate); | 745 | sta_id, tx_rate); |
746 | return sta_id; | 746 | return sta_id; |
747 | } | 747 | } |
748 | 748 | ||
749 | static void il3945_set_pwr_vmain(struct il_priv *priv) | 749 | static void il3945_set_pwr_vmain(struct il_priv *il) |
750 | { | 750 | { |
751 | /* | 751 | /* |
752 | * (for documentation purposes) | 752 | * (for documentation purposes) |
753 | * to set power to V_AUX, do | 753 | * to set power to V_AUX, do |
754 | 754 | ||
755 | if (pci_pme_capable(priv->pci_dev, PCI_D3cold)) { | 755 | if (pci_pme_capable(il->pci_dev, PCI_D3cold)) { |
756 | il_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, | 756 | il_set_bits_mask_prph(il, APMG_PS_CTRL_REG, |
757 | APMG_PS_CTRL_VAL_PWR_SRC_VAUX, | 757 | APMG_PS_CTRL_VAL_PWR_SRC_VAUX, |
758 | ~APMG_PS_CTRL_MSK_PWR_SRC); | 758 | ~APMG_PS_CTRL_MSK_PWR_SRC); |
759 | 759 | ||
760 | il_poll_bit(priv, CSR_GPIO_IN, | 760 | il_poll_bit(il, CSR_GPIO_IN, |
761 | CSR_GPIO_IN_VAL_VAUX_PWR_SRC, | 761 | CSR_GPIO_IN_VAL_VAUX_PWR_SRC, |
762 | CSR_GPIO_IN_BIT_AUX_POWER, 5000); | 762 | CSR_GPIO_IN_BIT_AUX_POWER, 5000); |
763 | } | 763 | } |
764 | */ | 764 | */ |
765 | 765 | ||
766 | il_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, | 766 | il_set_bits_mask_prph(il, APMG_PS_CTRL_REG, |
767 | APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, | 767 | APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, |
768 | ~APMG_PS_CTRL_MSK_PWR_SRC); | 768 | ~APMG_PS_CTRL_MSK_PWR_SRC); |
769 | 769 | ||
770 | il_poll_bit(priv, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VMAIN_PWR_SRC, | 770 | il_poll_bit(il, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VMAIN_PWR_SRC, |
771 | CSR_GPIO_IN_BIT_AUX_POWER, 5000); /* uS */ | 771 | CSR_GPIO_IN_BIT_AUX_POWER, 5000); /* uS */ |
772 | } | 772 | } |
773 | 773 | ||
774 | static int il3945_rx_init(struct il_priv *priv, struct il_rx_queue *rxq) | 774 | static int il3945_rx_init(struct il_priv *il, struct il_rx_queue *rxq) |
775 | { | 775 | { |
776 | il_write_direct32(priv, FH39_RCSR_RBD_BASE(0), rxq->bd_dma); | 776 | il_write_direct32(il, FH39_RCSR_RBD_BASE(0), rxq->bd_dma); |
777 | il_write_direct32(priv, FH39_RCSR_RPTR_ADDR(0), | 777 | il_write_direct32(il, FH39_RCSR_RPTR_ADDR(0), |
778 | rxq->rb_stts_dma); | 778 | rxq->rb_stts_dma); |
779 | il_write_direct32(priv, FH39_RCSR_WPTR(0), 0); | 779 | il_write_direct32(il, FH39_RCSR_WPTR(0), 0); |
780 | il_write_direct32(priv, FH39_RCSR_CONFIG(0), | 780 | il_write_direct32(il, FH39_RCSR_CONFIG(0), |
781 | FH39_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE | | 781 | FH39_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE | |
782 | FH39_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE | | 782 | FH39_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE | |
783 | FH39_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN | | 783 | FH39_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN | |
@@ -788,32 +788,32 @@ static int il3945_rx_init(struct il_priv *priv, struct il_rx_queue *rxq) | |||
788 | FH39_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH); | 788 | FH39_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH); |
789 | 789 | ||
790 | /* fake read to flush all prev I/O */ | 790 | /* fake read to flush all prev I/O */ |
791 | il_read_direct32(priv, FH39_RSSR_CTRL); | 791 | il_read_direct32(il, FH39_RSSR_CTRL); |
792 | 792 | ||
793 | return 0; | 793 | return 0; |
794 | } | 794 | } |
795 | 795 | ||
796 | static int il3945_tx_reset(struct il_priv *priv) | 796 | static int il3945_tx_reset(struct il_priv *il) |
797 | { | 797 | { |
798 | 798 | ||
799 | /* bypass mode */ | 799 | /* bypass mode */ |
800 | il_write_prph(priv, ALM_SCD_MODE_REG, 0x2); | 800 | il_write_prph(il, ALM_SCD_MODE_REG, 0x2); |
801 | 801 | ||
802 | /* RA 0 is active */ | 802 | /* RA 0 is active */ |
803 | il_write_prph(priv, ALM_SCD_ARASTAT_REG, 0x01); | 803 | il_write_prph(il, ALM_SCD_ARASTAT_REG, 0x01); |
804 | 804 | ||
805 | /* all 6 fifo are active */ | 805 | /* all 6 fifo are active */ |
806 | il_write_prph(priv, ALM_SCD_TXFACT_REG, 0x3f); | 806 | il_write_prph(il, ALM_SCD_TXFACT_REG, 0x3f); |
807 | 807 | ||
808 | il_write_prph(priv, ALM_SCD_SBYP_MODE_1_REG, 0x010000); | 808 | il_write_prph(il, ALM_SCD_SBYP_MODE_1_REG, 0x010000); |
809 | il_write_prph(priv, ALM_SCD_SBYP_MODE_2_REG, 0x030002); | 809 | il_write_prph(il, ALM_SCD_SBYP_MODE_2_REG, 0x030002); |
810 | il_write_prph(priv, ALM_SCD_TXF4MF_REG, 0x000004); | 810 | il_write_prph(il, ALM_SCD_TXF4MF_REG, 0x000004); |
811 | il_write_prph(priv, ALM_SCD_TXF5MF_REG, 0x000005); | 811 | il_write_prph(il, ALM_SCD_TXF5MF_REG, 0x000005); |
812 | 812 | ||
813 | il_write_direct32(priv, FH39_TSSR_CBB_BASE, | 813 | il_write_direct32(il, FH39_TSSR_CBB_BASE, |
814 | priv->_3945.shared_phys); | 814 | il->_3945.shared_phys); |
815 | 815 | ||
816 | il_write_direct32(priv, FH39_TSSR_MSG_CONFIG, | 816 | il_write_direct32(il, FH39_TSSR_MSG_CONFIG, |
817 | FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON | | 817 | FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON | |
818 | FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON | | 818 | FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON | |
819 | FH39_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B | | 819 | FH39_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B | |
@@ -831,31 +831,31 @@ static int il3945_tx_reset(struct il_priv *priv) | |||
831 | * | 831 | * |
832 | * Destroys all DMA structures and initialize them again | 832 | * Destroys all DMA structures and initialize them again |
833 | */ | 833 | */ |
834 | static int il3945_txq_ctx_reset(struct il_priv *priv) | 834 | static int il3945_txq_ctx_reset(struct il_priv *il) |
835 | { | 835 | { |
836 | int rc; | 836 | int rc; |
837 | int txq_id, slots_num; | 837 | int txq_id, slots_num; |
838 | 838 | ||
839 | il3945_hw_txq_ctx_free(priv); | 839 | il3945_hw_txq_ctx_free(il); |
840 | 840 | ||
841 | /* allocate tx queue structure */ | 841 | /* allocate tx queue structure */ |
842 | rc = il_alloc_txq_mem(priv); | 842 | rc = il_alloc_txq_mem(il); |
843 | if (rc) | 843 | if (rc) |
844 | return rc; | 844 | return rc; |
845 | 845 | ||
846 | /* Tx CMD queue */ | 846 | /* Tx CMD queue */ |
847 | rc = il3945_tx_reset(priv); | 847 | rc = il3945_tx_reset(il); |
848 | if (rc) | 848 | if (rc) |
849 | goto error; | 849 | goto error; |
850 | 850 | ||
851 | /* Tx queue(s) */ | 851 | /* Tx queue(s) */ |
852 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { | 852 | for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) { |
853 | slots_num = (txq_id == IWL39_CMD_QUEUE_NUM) ? | 853 | slots_num = (txq_id == IWL39_CMD_QUEUE_NUM) ? |
854 | TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; | 854 | TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; |
855 | rc = il_tx_queue_init(priv, &priv->txq[txq_id], | 855 | rc = il_tx_queue_init(il, &il->txq[txq_id], |
856 | slots_num, txq_id); | 856 | slots_num, txq_id); |
857 | if (rc) { | 857 | if (rc) { |
858 | IL_ERR(priv, "Tx %d queue init failed\n", txq_id); | 858 | IL_ERR(il, "Tx %d queue init failed\n", txq_id); |
859 | goto error; | 859 | goto error; |
860 | } | 860 | } |
861 | } | 861 | } |
@@ -863,7 +863,7 @@ static int il3945_txq_ctx_reset(struct il_priv *priv) | |||
863 | return rc; | 863 | return rc; |
864 | 864 | ||
865 | error: | 865 | error: |
866 | il3945_hw_txq_ctx_free(priv); | 866 | il3945_hw_txq_ctx_free(il); |
867 | return rc; | 867 | return rc; |
868 | } | 868 | } |
869 | 869 | ||
@@ -873,127 +873,127 @@ static int il3945_txq_ctx_reset(struct il_priv *priv) | |||
873 | * (e.g. after platform boot, or shutdown via il_apm_stop()) | 873 | * (e.g. after platform boot, or shutdown via il_apm_stop()) |
874 | * NOTE: This does not load uCode nor start the embedded processor | 874 | * NOTE: This does not load uCode nor start the embedded processor |
875 | */ | 875 | */ |
876 | static int il3945_apm_init(struct il_priv *priv) | 876 | static int il3945_apm_init(struct il_priv *il) |
877 | { | 877 | { |
878 | int ret = il_apm_init(priv); | 878 | int ret = il_apm_init(il); |
879 | 879 | ||
880 | /* Clear APMG (NIC's internal power management) interrupts */ | 880 | /* Clear APMG (NIC's internal power management) interrupts */ |
881 | il_write_prph(priv, APMG_RTC_INT_MSK_REG, 0x0); | 881 | il_write_prph(il, APMG_RTC_INT_MSK_REG, 0x0); |
882 | il_write_prph(priv, APMG_RTC_INT_STT_REG, 0xFFFFFFFF); | 882 | il_write_prph(il, APMG_RTC_INT_STT_REG, 0xFFFFFFFF); |
883 | 883 | ||
884 | /* Reset radio chip */ | 884 | /* Reset radio chip */ |
885 | il_set_bits_prph(priv, APMG_PS_CTRL_REG, | 885 | il_set_bits_prph(il, APMG_PS_CTRL_REG, |
886 | APMG_PS_CTRL_VAL_RESET_REQ); | 886 | APMG_PS_CTRL_VAL_RESET_REQ); |
887 | udelay(5); | 887 | udelay(5); |
888 | il_clear_bits_prph(priv, APMG_PS_CTRL_REG, | 888 | il_clear_bits_prph(il, APMG_PS_CTRL_REG, |
889 | APMG_PS_CTRL_VAL_RESET_REQ); | 889 | APMG_PS_CTRL_VAL_RESET_REQ); |
890 | 890 | ||
891 | return ret; | 891 | return ret; |
892 | } | 892 | } |
893 | 893 | ||
894 | static void il3945_nic_config(struct il_priv *priv) | 894 | static void il3945_nic_config(struct il_priv *il) |
895 | { | 895 | { |
896 | struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; | 896 | struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; |
897 | unsigned long flags; | 897 | unsigned long flags; |
898 | u8 rev_id = priv->pci_dev->revision; | 898 | u8 rev_id = il->pci_dev->revision; |
899 | 899 | ||
900 | spin_lock_irqsave(&priv->lock, flags); | 900 | spin_lock_irqsave(&il->lock, flags); |
901 | 901 | ||
902 | /* Determine HW type */ | 902 | /* Determine HW type */ |
903 | IL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n", rev_id); | 903 | IL_DEBUG_INFO(il, "HW Revision ID = 0x%X\n", rev_id); |
904 | 904 | ||
905 | if (rev_id & PCI_CFG_REV_ID_BIT_RTP) | 905 | if (rev_id & PCI_CFG_REV_ID_BIT_RTP) |
906 | IL_DEBUG_INFO(priv, "RTP type\n"); | 906 | IL_DEBUG_INFO(il, "RTP type\n"); |
907 | else if (rev_id & PCI_CFG_REV_ID_BIT_BASIC_SKU) { | 907 | else if (rev_id & PCI_CFG_REV_ID_BIT_BASIC_SKU) { |
908 | IL_DEBUG_INFO(priv, "3945 RADIO-MB type\n"); | 908 | IL_DEBUG_INFO(il, "3945 RADIO-MB type\n"); |
909 | il_set_bit(priv, CSR_HW_IF_CONFIG_REG, | 909 | il_set_bit(il, CSR_HW_IF_CONFIG_REG, |
910 | CSR39_HW_IF_CONFIG_REG_BIT_3945_MB); | 910 | CSR39_HW_IF_CONFIG_REG_BIT_3945_MB); |
911 | } else { | 911 | } else { |
912 | IL_DEBUG_INFO(priv, "3945 RADIO-MM type\n"); | 912 | IL_DEBUG_INFO(il, "3945 RADIO-MM type\n"); |
913 | il_set_bit(priv, CSR_HW_IF_CONFIG_REG, | 913 | il_set_bit(il, CSR_HW_IF_CONFIG_REG, |
914 | CSR39_HW_IF_CONFIG_REG_BIT_3945_MM); | 914 | CSR39_HW_IF_CONFIG_REG_BIT_3945_MM); |
915 | } | 915 | } |
916 | 916 | ||
917 | if (EEPROM_SKU_CAP_OP_MODE_MRC == eeprom->sku_cap) { | 917 | if (EEPROM_SKU_CAP_OP_MODE_MRC == eeprom->sku_cap) { |
918 | IL_DEBUG_INFO(priv, "SKU OP mode is mrc\n"); | 918 | IL_DEBUG_INFO(il, "SKU OP mode is mrc\n"); |
919 | il_set_bit(priv, CSR_HW_IF_CONFIG_REG, | 919 | il_set_bit(il, CSR_HW_IF_CONFIG_REG, |
920 | CSR39_HW_IF_CONFIG_REG_BIT_SKU_MRC); | 920 | CSR39_HW_IF_CONFIG_REG_BIT_SKU_MRC); |
921 | } else | 921 | } else |
922 | IL_DEBUG_INFO(priv, "SKU OP mode is basic\n"); | 922 | IL_DEBUG_INFO(il, "SKU OP mode is basic\n"); |
923 | 923 | ||
924 | if ((eeprom->board_revision & 0xF0) == 0xD0) { | 924 | if ((eeprom->board_revision & 0xF0) == 0xD0) { |
925 | IL_DEBUG_INFO(priv, "3945ABG revision is 0x%X\n", | 925 | IL_DEBUG_INFO(il, "3945ABG revision is 0x%X\n", |
926 | eeprom->board_revision); | 926 | eeprom->board_revision); |
927 | il_set_bit(priv, CSR_HW_IF_CONFIG_REG, | 927 | il_set_bit(il, CSR_HW_IF_CONFIG_REG, |
928 | CSR39_HW_IF_CONFIG_REG_BIT_BOARD_TYPE); | 928 | CSR39_HW_IF_CONFIG_REG_BIT_BOARD_TYPE); |
929 | } else { | 929 | } else { |
930 | IL_DEBUG_INFO(priv, "3945ABG revision is 0x%X\n", | 930 | IL_DEBUG_INFO(il, "3945ABG revision is 0x%X\n", |
931 | eeprom->board_revision); | 931 | eeprom->board_revision); |
932 | il_clear_bit(priv, CSR_HW_IF_CONFIG_REG, | 932 | il_clear_bit(il, CSR_HW_IF_CONFIG_REG, |
933 | CSR39_HW_IF_CONFIG_REG_BIT_BOARD_TYPE); | 933 | CSR39_HW_IF_CONFIG_REG_BIT_BOARD_TYPE); |
934 | } | 934 | } |
935 | 935 | ||
936 | if (eeprom->almgor_m_version <= 1) { | 936 | if (eeprom->almgor_m_version <= 1) { |
937 | il_set_bit(priv, CSR_HW_IF_CONFIG_REG, | 937 | il_set_bit(il, CSR_HW_IF_CONFIG_REG, |
938 | CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A); | 938 | CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A); |
939 | IL_DEBUG_INFO(priv, "Card M type A version is 0x%X\n", | 939 | IL_DEBUG_INFO(il, "Card M type A version is 0x%X\n", |
940 | eeprom->almgor_m_version); | 940 | eeprom->almgor_m_version); |
941 | } else { | 941 | } else { |
942 | IL_DEBUG_INFO(priv, "Card M type B version is 0x%X\n", | 942 | IL_DEBUG_INFO(il, "Card M type B version is 0x%X\n", |
943 | eeprom->almgor_m_version); | 943 | eeprom->almgor_m_version); |
944 | il_set_bit(priv, CSR_HW_IF_CONFIG_REG, | 944 | il_set_bit(il, CSR_HW_IF_CONFIG_REG, |
945 | CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B); | 945 | CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B); |
946 | } | 946 | } |
947 | spin_unlock_irqrestore(&priv->lock, flags); | 947 | spin_unlock_irqrestore(&il->lock, flags); |
948 | 948 | ||
949 | if (eeprom->sku_cap & EEPROM_SKU_CAP_SW_RF_KILL_ENABLE) | 949 | if (eeprom->sku_cap & EEPROM_SKU_CAP_SW_RF_KILL_ENABLE) |
950 | IL_DEBUG_RF_KILL(priv, "SW RF KILL supported in EEPROM.\n"); | 950 | IL_DEBUG_RF_KILL(il, "SW RF KILL supported in EEPROM.\n"); |
951 | 951 | ||
952 | if (eeprom->sku_cap & EEPROM_SKU_CAP_HW_RF_KILL_ENABLE) | 952 | if (eeprom->sku_cap & EEPROM_SKU_CAP_HW_RF_KILL_ENABLE) |
953 | IL_DEBUG_RF_KILL(priv, "HW RF KILL supported in EEPROM.\n"); | 953 | IL_DEBUG_RF_KILL(il, "HW RF KILL supported in EEPROM.\n"); |
954 | } | 954 | } |
955 | 955 | ||
956 | int il3945_hw_nic_init(struct il_priv *priv) | 956 | int il3945_hw_nic_init(struct il_priv *il) |
957 | { | 957 | { |
958 | int rc; | 958 | int rc; |
959 | unsigned long flags; | 959 | unsigned long flags; |
960 | struct il_rx_queue *rxq = &priv->rxq; | 960 | struct il_rx_queue *rxq = &il->rxq; |
961 | 961 | ||
962 | spin_lock_irqsave(&priv->lock, flags); | 962 | spin_lock_irqsave(&il->lock, flags); |
963 | priv->cfg->ops->lib->apm_ops.init(priv); | 963 | il->cfg->ops->lib->apm_ops.init(il); |
964 | spin_unlock_irqrestore(&priv->lock, flags); | 964 | spin_unlock_irqrestore(&il->lock, flags); |
965 | 965 | ||
966 | il3945_set_pwr_vmain(priv); | 966 | il3945_set_pwr_vmain(il); |
967 | 967 | ||
968 | priv->cfg->ops->lib->apm_ops.config(priv); | 968 | il->cfg->ops->lib->apm_ops.config(il); |
969 | 969 | ||
970 | /* Allocate the RX queue, or reset if it is already allocated */ | 970 | /* Allocate the RX queue, or reset if it is already allocated */ |
971 | if (!rxq->bd) { | 971 | if (!rxq->bd) { |
972 | rc = il_rx_queue_alloc(priv); | 972 | rc = il_rx_queue_alloc(il); |
973 | if (rc) { | 973 | if (rc) { |
974 | IL_ERR(priv, "Unable to initialize Rx queue\n"); | 974 | IL_ERR(il, "Unable to initialize Rx queue\n"); |
975 | return -ENOMEM; | 975 | return -ENOMEM; |
976 | } | 976 | } |
977 | } else | 977 | } else |
978 | il3945_rx_queue_reset(priv, rxq); | 978 | il3945_rx_queue_reset(il, rxq); |
979 | 979 | ||
980 | il3945_rx_replenish(priv); | 980 | il3945_rx_replenish(il); |
981 | 981 | ||
982 | il3945_rx_init(priv, rxq); | 982 | il3945_rx_init(il, rxq); |
983 | 983 | ||
984 | 984 | ||
985 | /* Look at using this instead: | 985 | /* Look at using this instead: |
986 | rxq->need_update = 1; | 986 | rxq->need_update = 1; |
987 | il_rx_queue_update_write_ptr(priv, rxq); | 987 | il_rx_queue_update_write_ptr(il, rxq); |
988 | */ | 988 | */ |
989 | 989 | ||
990 | il_write_direct32(priv, FH39_RCSR_WPTR(0), rxq->write & ~7); | 990 | il_write_direct32(il, FH39_RCSR_WPTR(0), rxq->write & ~7); |
991 | 991 | ||
992 | rc = il3945_txq_ctx_reset(priv); | 992 | rc = il3945_txq_ctx_reset(il); |
993 | if (rc) | 993 | if (rc) |
994 | return rc; | 994 | return rc; |
995 | 995 | ||
996 | set_bit(STATUS_INIT, &priv->status); | 996 | set_bit(STATUS_INIT, &il->status); |
997 | 997 | ||
998 | return 0; | 998 | return 0; |
999 | } | 999 | } |
@@ -1003,40 +1003,40 @@ int il3945_hw_nic_init(struct il_priv *priv) | |||
1003 | * | 1003 | * |
1004 | * Destroy all TX DMA queues and structures | 1004 | * Destroy all TX DMA queues and structures |
1005 | */ | 1005 | */ |
1006 | void il3945_hw_txq_ctx_free(struct il_priv *priv) | 1006 | void il3945_hw_txq_ctx_free(struct il_priv *il) |
1007 | { | 1007 | { |
1008 | int txq_id; | 1008 | int txq_id; |
1009 | 1009 | ||
1010 | /* Tx queues */ | 1010 | /* Tx queues */ |
1011 | if (priv->txq) | 1011 | if (il->txq) |
1012 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; | 1012 | for (txq_id = 0; txq_id < il->hw_params.max_txq_num; |
1013 | txq_id++) | 1013 | txq_id++) |
1014 | if (txq_id == IWL39_CMD_QUEUE_NUM) | 1014 | if (txq_id == IWL39_CMD_QUEUE_NUM) |
1015 | il_cmd_queue_free(priv); | 1015 | il_cmd_queue_free(il); |
1016 | else | 1016 | else |
1017 | il_tx_queue_free(priv, txq_id); | 1017 | il_tx_queue_free(il, txq_id); |
1018 | 1018 | ||
1019 | /* free tx queue structure */ | 1019 | /* free tx queue structure */ |
1020 | il_txq_mem(priv); | 1020 | il_txq_mem(il); |
1021 | } | 1021 | } |
1022 | 1022 | ||
1023 | void il3945_hw_txq_ctx_stop(struct il_priv *priv) | 1023 | void il3945_hw_txq_ctx_stop(struct il_priv *il) |
1024 | { | 1024 | { |
1025 | int txq_id; | 1025 | int txq_id; |
1026 | 1026 | ||
1027 | /* stop SCD */ | 1027 | /* stop SCD */ |
1028 | il_write_prph(priv, ALM_SCD_MODE_REG, 0); | 1028 | il_write_prph(il, ALM_SCD_MODE_REG, 0); |
1029 | il_write_prph(priv, ALM_SCD_TXFACT_REG, 0); | 1029 | il_write_prph(il, ALM_SCD_TXFACT_REG, 0); |
1030 | 1030 | ||
1031 | /* reset TFD queues */ | 1031 | /* reset TFD queues */ |
1032 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { | 1032 | for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) { |
1033 | il_write_direct32(priv, FH39_TCSR_CONFIG(txq_id), 0x0); | 1033 | il_write_direct32(il, FH39_TCSR_CONFIG(txq_id), 0x0); |
1034 | il_poll_direct_bit(priv, FH39_TSSR_TX_STATUS, | 1034 | il_poll_direct_bit(il, FH39_TSSR_TX_STATUS, |
1035 | FH39_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(txq_id), | 1035 | FH39_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(txq_id), |
1036 | 1000); | 1036 | 1000); |
1037 | } | 1037 | } |
1038 | 1038 | ||
1039 | il3945_hw_txq_ctx_free(priv); | 1039 | il3945_hw_txq_ctx_free(il); |
1040 | } | 1040 | } |
1041 | 1041 | ||
1042 | /** | 1042 | /** |
@@ -1056,36 +1056,36 @@ static inline int il3945_hw_reg_temp_out_of_range(int temperature) | |||
1056 | return ((temperature < -260) || (temperature > 25)) ? 1 : 0; | 1056 | return ((temperature < -260) || (temperature > 25)) ? 1 : 0; |
1057 | } | 1057 | } |
1058 | 1058 | ||
1059 | int il3945_hw_get_temperature(struct il_priv *priv) | 1059 | int il3945_hw_get_temperature(struct il_priv *il) |
1060 | { | 1060 | { |
1061 | return il_read32(priv, CSR_UCODE_DRV_GP2); | 1061 | return il_read32(il, CSR_UCODE_DRV_GP2); |
1062 | } | 1062 | } |
1063 | 1063 | ||
1064 | /** | 1064 | /** |
1065 | * il3945_hw_reg_txpower_get_temperature | 1065 | * il3945_hw_reg_txpower_get_temperature |
1066 | * get the current temperature by reading from NIC | 1066 | * get the current temperature by reading from NIC |
1067 | */ | 1067 | */ |
1068 | static int il3945_hw_reg_txpower_get_temperature(struct il_priv *priv) | 1068 | static int il3945_hw_reg_txpower_get_temperature(struct il_priv *il) |
1069 | { | 1069 | { |
1070 | struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; | 1070 | struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; |
1071 | int temperature; | 1071 | int temperature; |
1072 | 1072 | ||
1073 | temperature = il3945_hw_get_temperature(priv); | 1073 | temperature = il3945_hw_get_temperature(il); |
1074 | 1074 | ||
1075 | /* driver's okay range is -260 to +25. | 1075 | /* driver's okay range is -260 to +25. |
1076 | * human readable okay range is 0 to +285 */ | 1076 | * human readable okay range is 0 to +285 */ |
1077 | IL_DEBUG_INFO(priv, "Temperature: %d\n", temperature + IL_TEMP_CONVERT); | 1077 | IL_DEBUG_INFO(il, "Temperature: %d\n", temperature + IL_TEMP_CONVERT); |
1078 | 1078 | ||
1079 | /* handle insane temp reading */ | 1079 | /* handle insane temp reading */ |
1080 | if (il3945_hw_reg_temp_out_of_range(temperature)) { | 1080 | if (il3945_hw_reg_temp_out_of_range(temperature)) { |
1081 | IL_ERR(priv, "Error bad temperature value %d\n", temperature); | 1081 | IL_ERR(il, "Error bad temperature value %d\n", temperature); |
1082 | 1082 | ||
1083 | /* if really really hot(?), | 1083 | /* if really really hot(?), |
1084 | * substitute the 3rd band/group's temp measured at factory */ | 1084 | * substitute the 3rd band/group's temp measured at factory */ |
1085 | if (priv->last_temperature > 100) | 1085 | if (il->last_temperature > 100) |
1086 | temperature = eeprom->groups[2].temperature; | 1086 | temperature = eeprom->groups[2].temperature; |
1087 | else /* else use most recent "sane" value from driver */ | 1087 | else /* else use most recent "sane" value from driver */ |
1088 | temperature = priv->last_temperature; | 1088 | temperature = il->last_temperature; |
1089 | } | 1089 | } |
1090 | 1090 | ||
1091 | return temperature; /* raw, not "human readable" */ | 1091 | return temperature; /* raw, not "human readable" */ |
@@ -1102,33 +1102,33 @@ static int il3945_hw_reg_txpower_get_temperature(struct il_priv *priv) | |||
1102 | * records new temperature in tx_mgr->temperature. | 1102 | * records new temperature in tx_mgr->temperature. |
1103 | * replaces tx_mgr->last_temperature *only* if calib needed | 1103 | * replaces tx_mgr->last_temperature *only* if calib needed |
1104 | * (assumes caller will actually do the calibration!). */ | 1104 | * (assumes caller will actually do the calibration!). */ |
1105 | static int il3945_is_temp_calib_needed(struct il_priv *priv) | 1105 | static int il3945_is_temp_calib_needed(struct il_priv *il) |
1106 | { | 1106 | { |
1107 | int temp_diff; | 1107 | int temp_diff; |
1108 | 1108 | ||
1109 | priv->temperature = il3945_hw_reg_txpower_get_temperature(priv); | 1109 | il->temperature = il3945_hw_reg_txpower_get_temperature(il); |
1110 | temp_diff = priv->temperature - priv->last_temperature; | 1110 | temp_diff = il->temperature - il->last_temperature; |
1111 | 1111 | ||
1112 | /* get absolute value */ | 1112 | /* get absolute value */ |
1113 | if (temp_diff < 0) { | 1113 | if (temp_diff < 0) { |
1114 | IL_DEBUG_POWER(priv, "Getting cooler, delta %d,\n", temp_diff); | 1114 | IL_DEBUG_POWER(il, "Getting cooler, delta %d,\n", temp_diff); |
1115 | temp_diff = -temp_diff; | 1115 | temp_diff = -temp_diff; |
1116 | } else if (temp_diff == 0) | 1116 | } else if (temp_diff == 0) |
1117 | IL_DEBUG_POWER(priv, "Same temp,\n"); | 1117 | IL_DEBUG_POWER(il, "Same temp,\n"); |
1118 | else | 1118 | else |
1119 | IL_DEBUG_POWER(priv, "Getting warmer, delta %d,\n", temp_diff); | 1119 | IL_DEBUG_POWER(il, "Getting warmer, delta %d,\n", temp_diff); |
1120 | 1120 | ||
1121 | /* if we don't need calibration, *don't* update last_temperature */ | 1121 | /* if we don't need calibration, *don't* update last_temperature */ |
1122 | if (temp_diff < IL_TEMPERATURE_LIMIT_TIMER) { | 1122 | if (temp_diff < IL_TEMPERATURE_LIMIT_TIMER) { |
1123 | IL_DEBUG_POWER(priv, "Timed thermal calib not needed\n"); | 1123 | IL_DEBUG_POWER(il, "Timed thermal calib not needed\n"); |
1124 | return 0; | 1124 | return 0; |
1125 | } | 1125 | } |
1126 | 1126 | ||
1127 | IL_DEBUG_POWER(priv, "Timed thermal calib needed\n"); | 1127 | IL_DEBUG_POWER(il, "Timed thermal calib needed\n"); |
1128 | 1128 | ||
1129 | /* assume that caller will actually do calib ... | 1129 | /* assume that caller will actually do calib ... |
1130 | * update the "last temperature" value */ | 1130 | * update the "last temperature" value */ |
1131 | priv->last_temperature = priv->temperature; | 1131 | il->last_temperature = il->temperature; |
1132 | return 1; | 1132 | return 1; |
1133 | } | 1133 | } |
1134 | 1134 | ||
@@ -1317,7 +1317,7 @@ static inline u8 il3945_hw_reg_fix_power_index(int index) | |||
1317 | * Set (in our channel info database) the direct scan Tx power for 1 Mbit (CCK) | 1317 | * Set (in our channel info database) the direct scan Tx power for 1 Mbit (CCK) |
1318 | * or 6 Mbit (OFDM) rates. | 1318 | * or 6 Mbit (OFDM) rates. |
1319 | */ | 1319 | */ |
1320 | static void il3945_hw_reg_set_scan_power(struct il_priv *priv, u32 scan_tbl_index, | 1320 | static void il3945_hw_reg_set_scan_power(struct il_priv *il, u32 scan_tbl_index, |
1321 | s32 rate_index, const s8 *clip_pwrs, | 1321 | s32 rate_index, const s8 *clip_pwrs, |
1322 | struct il_channel_info *ch_info, | 1322 | struct il_channel_info *ch_info, |
1323 | int band_index) | 1323 | int band_index) |
@@ -1333,7 +1333,7 @@ static void il3945_hw_reg_set_scan_power(struct il_priv *priv, u32 scan_tbl_inde | |||
1333 | * based on eeprom channel data) for this channel. */ | 1333 | * based on eeprom channel data) for this channel. */ |
1334 | power = min(ch_info->scan_power, clip_pwrs[IL_RATE_6M_INDEX_TABLE]); | 1334 | power = min(ch_info->scan_power, clip_pwrs[IL_RATE_6M_INDEX_TABLE]); |
1335 | 1335 | ||
1336 | power = min(power, priv->tx_power_user_lmt); | 1336 | power = min(power, il->tx_power_user_lmt); |
1337 | scan_power_info->requested_power = power; | 1337 | scan_power_info->requested_power = power; |
1338 | 1338 | ||
1339 | /* find difference between new scan *power* and current "normal" | 1339 | /* 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 | |||
1370 | * Configures power settings for all rates for the current channel, | 1370 | * Configures power settings for all rates for the current channel, |
1371 | * using values from channel info struct, and send to NIC | 1371 | * using values from channel info struct, and send to NIC |
1372 | */ | 1372 | */ |
1373 | static int il3945_send_tx_power(struct il_priv *priv) | 1373 | static int il3945_send_tx_power(struct il_priv *il) |
1374 | { | 1374 | { |
1375 | int rate_idx, i; | 1375 | int rate_idx, i; |
1376 | const struct il_channel_info *ch_info = NULL; | 1376 | const struct il_channel_info *ch_info = NULL; |
1377 | struct il3945_txpowertable_cmd txpower = { | 1377 | struct il3945_txpowertable_cmd txpower = { |
1378 | .channel = priv->contexts[IL_RXON_CTX_BSS].active.channel, | 1378 | .channel = il->contexts[IL_RXON_CTX_BSS].active.channel, |
1379 | }; | 1379 | }; |
1380 | u16 chan; | 1380 | u16 chan; |
1381 | 1381 | ||
1382 | if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &priv->status), | 1382 | if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &il->status), |
1383 | "TX Power requested while scanning!\n")) | 1383 | "TX Power requested while scanning!\n")) |
1384 | return -EAGAIN; | 1384 | return -EAGAIN; |
1385 | 1385 | ||
1386 | chan = le16_to_cpu(priv->contexts[IL_RXON_CTX_BSS].active.channel); | 1386 | chan = le16_to_cpu(il->contexts[IL_RXON_CTX_BSS].active.channel); |
1387 | 1387 | ||
1388 | txpower.band = (priv->band == IEEE80211_BAND_5GHZ) ? 0 : 1; | 1388 | txpower.band = (il->band == IEEE80211_BAND_5GHZ) ? 0 : 1; |
1389 | ch_info = il_get_channel_info(priv, priv->band, chan); | 1389 | ch_info = il_get_channel_info(il, il->band, chan); |
1390 | if (!ch_info) { | 1390 | if (!ch_info) { |
1391 | IL_ERR(priv, | 1391 | IL_ERR(il, |
1392 | "Failed to get channel info for channel %d [%d]\n", | 1392 | "Failed to get channel info for channel %d [%d]\n", |
1393 | chan, priv->band); | 1393 | chan, il->band); |
1394 | return -EINVAL; | 1394 | return -EINVAL; |
1395 | } | 1395 | } |
1396 | 1396 | ||
1397 | if (!il_is_channel_valid(ch_info)) { | 1397 | if (!il_is_channel_valid(ch_info)) { |
1398 | IL_DEBUG_POWER(priv, "Not calling TX_PWR_TABLE_CMD on " | 1398 | IL_DEBUG_POWER(il, "Not calling TX_PWR_TABLE_CMD on " |
1399 | "non-Tx channel.\n"); | 1399 | "non-Tx channel.\n"); |
1400 | return 0; | 1400 | return 0; |
1401 | } | 1401 | } |
@@ -1408,7 +1408,7 @@ static int il3945_send_tx_power(struct il_priv *priv) | |||
1408 | txpower.power[i].tpc = ch_info->power_info[i].tpc; | 1408 | txpower.power[i].tpc = ch_info->power_info[i].tpc; |
1409 | txpower.power[i].rate = il3945_rates[rate_idx].plcp; | 1409 | txpower.power[i].rate = il3945_rates[rate_idx].plcp; |
1410 | 1410 | ||
1411 | IL_DEBUG_POWER(priv, "ch %d:%d rf %d dsp %3d rate code 0x%02x\n", | 1411 | IL_DEBUG_POWER(il, "ch %d:%d rf %d dsp %3d rate code 0x%02x\n", |
1412 | le16_to_cpu(txpower.channel), | 1412 | le16_to_cpu(txpower.channel), |
1413 | txpower.band, | 1413 | txpower.band, |
1414 | txpower.power[i].tpc.tx_gain, | 1414 | txpower.power[i].tpc.tx_gain, |
@@ -1421,7 +1421,7 @@ static int il3945_send_tx_power(struct il_priv *priv) | |||
1421 | txpower.power[i].tpc = ch_info->power_info[i].tpc; | 1421 | txpower.power[i].tpc = ch_info->power_info[i].tpc; |
1422 | txpower.power[i].rate = il3945_rates[rate_idx].plcp; | 1422 | txpower.power[i].rate = il3945_rates[rate_idx].plcp; |
1423 | 1423 | ||
1424 | IL_DEBUG_POWER(priv, "ch %d:%d rf %d dsp %3d rate code 0x%02x\n", | 1424 | IL_DEBUG_POWER(il, "ch %d:%d rf %d dsp %3d rate code 0x%02x\n", |
1425 | le16_to_cpu(txpower.channel), | 1425 | le16_to_cpu(txpower.channel), |
1426 | txpower.band, | 1426 | txpower.band, |
1427 | txpower.power[i].tpc.tx_gain, | 1427 | txpower.power[i].tpc.tx_gain, |
@@ -1429,7 +1429,7 @@ static int il3945_send_tx_power(struct il_priv *priv) | |||
1429 | txpower.power[i].rate); | 1429 | txpower.power[i].rate); |
1430 | } | 1430 | } |
1431 | 1431 | ||
1432 | return il_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD, | 1432 | return il_send_cmd_pdu(il, REPLY_TX_PWR_TABLE_CMD, |
1433 | sizeof(struct il3945_txpowertable_cmd), | 1433 | sizeof(struct il3945_txpowertable_cmd), |
1434 | &txpower); | 1434 | &txpower); |
1435 | 1435 | ||
@@ -1451,7 +1451,7 @@ static int il3945_send_tx_power(struct il_priv *priv) | |||
1451 | * properly fill out the scan powers, and actual h/w gain settings, | 1451 | * properly fill out the scan powers, and actual h/w gain settings, |
1452 | * and send changes to NIC | 1452 | * and send changes to NIC |
1453 | */ | 1453 | */ |
1454 | static int il3945_hw_reg_set_new_power(struct il_priv *priv, | 1454 | static int il3945_hw_reg_set_new_power(struct il_priv *il, |
1455 | struct il_channel_info *ch_info) | 1455 | struct il_channel_info *ch_info) |
1456 | { | 1456 | { |
1457 | struct il3945_channel_power_info *power_info; | 1457 | struct il3945_channel_power_info *power_info; |
@@ -1461,7 +1461,7 @@ static int il3945_hw_reg_set_new_power(struct il_priv *priv, | |||
1461 | int power; | 1461 | int power; |
1462 | 1462 | ||
1463 | /* Get this chnlgrp's rate-to-max/clip-powers table */ | 1463 | /* Get this chnlgrp's rate-to-max/clip-powers table */ |
1464 | clip_pwrs = priv->_3945.clip_groups[ch_info->group_index].clip_powers; | 1464 | clip_pwrs = il->_3945.clip_groups[ch_info->group_index].clip_powers; |
1465 | 1465 | ||
1466 | /* Get this channel's rate-to-current-power settings table */ | 1466 | /* Get this channel's rate-to-current-power settings table */ |
1467 | power_info = ch_info->power_info; | 1467 | 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) | |||
1542 | * | 1542 | * |
1543 | * If RxOn is "associated", this sends the new Txpower to NIC! | 1543 | * If RxOn is "associated", this sends the new Txpower to NIC! |
1544 | */ | 1544 | */ |
1545 | static int il3945_hw_reg_comp_txpower_temp(struct il_priv *priv) | 1545 | static int il3945_hw_reg_comp_txpower_temp(struct il_priv *il) |
1546 | { | 1546 | { |
1547 | struct il_channel_info *ch_info = NULL; | 1547 | struct il_channel_info *ch_info = NULL; |
1548 | struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; | 1548 | struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; |
1549 | int delta_index; | 1549 | int delta_index; |
1550 | const s8 *clip_pwrs; /* array of h/w max power levels for each rate */ | 1550 | const s8 *clip_pwrs; /* array of h/w max power levels for each rate */ |
1551 | u8 a_band; | 1551 | u8 a_band; |
@@ -1553,16 +1553,16 @@ static int il3945_hw_reg_comp_txpower_temp(struct il_priv *priv) | |||
1553 | u8 scan_tbl_index; | 1553 | u8 scan_tbl_index; |
1554 | u8 i; | 1554 | u8 i; |
1555 | int ref_temp; | 1555 | int ref_temp; |
1556 | int temperature = priv->temperature; | 1556 | int temperature = il->temperature; |
1557 | 1557 | ||
1558 | if (priv->disable_tx_power_cal || | 1558 | if (il->disable_tx_power_cal || |
1559 | test_bit(STATUS_SCANNING, &priv->status)) { | 1559 | test_bit(STATUS_SCANNING, &il->status)) { |
1560 | /* do not perform tx power calibration */ | 1560 | /* do not perform tx power calibration */ |
1561 | return 0; | 1561 | return 0; |
1562 | } | 1562 | } |
1563 | /* set up new Tx power info for each and every channel, 2.4 and 5.x */ | 1563 | /* set up new Tx power info for each and every channel, 2.4 and 5.x */ |
1564 | for (i = 0; i < priv->channel_count; i++) { | 1564 | for (i = 0; i < il->channel_count; i++) { |
1565 | ch_info = &priv->channel_info[i]; | 1565 | ch_info = &il->channel_info[i]; |
1566 | a_band = il_is_channel_a_band(ch_info); | 1566 | a_band = il_is_channel_a_band(ch_info); |
1567 | 1567 | ||
1568 | /* Get this chnlgrp's factory calibration temperature */ | 1568 | /* Get this chnlgrp's factory calibration temperature */ |
@@ -1592,43 +1592,43 @@ static int il3945_hw_reg_comp_txpower_temp(struct il_priv *priv) | |||
1592 | } | 1592 | } |
1593 | 1593 | ||
1594 | /* Get this chnlgrp's rate-to-max/clip-powers table */ | 1594 | /* Get this chnlgrp's rate-to-max/clip-powers table */ |
1595 | clip_pwrs = priv->_3945.clip_groups[ch_info->group_index].clip_powers; | 1595 | clip_pwrs = il->_3945.clip_groups[ch_info->group_index].clip_powers; |
1596 | 1596 | ||
1597 | /* set scan tx power, 1Mbit for CCK, 6Mbit for OFDM */ | 1597 | /* set scan tx power, 1Mbit for CCK, 6Mbit for OFDM */ |
1598 | for (scan_tbl_index = 0; | 1598 | for (scan_tbl_index = 0; |
1599 | scan_tbl_index < IL_NUM_SCAN_RATES; scan_tbl_index++) { | 1599 | scan_tbl_index < IL_NUM_SCAN_RATES; scan_tbl_index++) { |
1600 | s32 actual_index = (scan_tbl_index == 0) ? | 1600 | s32 actual_index = (scan_tbl_index == 0) ? |
1601 | IL_RATE_1M_INDEX_TABLE : IL_RATE_6M_INDEX_TABLE; | 1601 | IL_RATE_1M_INDEX_TABLE : IL_RATE_6M_INDEX_TABLE; |
1602 | il3945_hw_reg_set_scan_power(priv, scan_tbl_index, | 1602 | il3945_hw_reg_set_scan_power(il, scan_tbl_index, |
1603 | actual_index, clip_pwrs, | 1603 | actual_index, clip_pwrs, |
1604 | ch_info, a_band); | 1604 | ch_info, a_band); |
1605 | } | 1605 | } |
1606 | } | 1606 | } |
1607 | 1607 | ||
1608 | /* send Txpower command for current channel to ucode */ | 1608 | /* send Txpower command for current channel to ucode */ |
1609 | return priv->cfg->ops->lib->send_tx_power(priv); | 1609 | return il->cfg->ops->lib->send_tx_power(il); |
1610 | } | 1610 | } |
1611 | 1611 | ||
1612 | int il3945_hw_reg_set_txpower(struct il_priv *priv, s8 power) | 1612 | int il3945_hw_reg_set_txpower(struct il_priv *il, s8 power) |
1613 | { | 1613 | { |
1614 | struct il_channel_info *ch_info; | 1614 | struct il_channel_info *ch_info; |
1615 | s8 max_power; | 1615 | s8 max_power; |
1616 | u8 a_band; | 1616 | u8 a_band; |
1617 | u8 i; | 1617 | u8 i; |
1618 | 1618 | ||
1619 | if (priv->tx_power_user_lmt == power) { | 1619 | if (il->tx_power_user_lmt == power) { |
1620 | IL_DEBUG_POWER(priv, "Requested Tx power same as current " | 1620 | IL_DEBUG_POWER(il, "Requested Tx power same as current " |
1621 | "limit: %ddBm.\n", power); | 1621 | "limit: %ddBm.\n", power); |
1622 | return 0; | 1622 | return 0; |
1623 | } | 1623 | } |
1624 | 1624 | ||
1625 | IL_DEBUG_POWER(priv, "Setting upper limit clamp to %ddBm.\n", power); | 1625 | IL_DEBUG_POWER(il, "Setting upper limit clamp to %ddBm.\n", power); |
1626 | priv->tx_power_user_lmt = power; | 1626 | il->tx_power_user_lmt = power; |
1627 | 1627 | ||
1628 | /* set up new Tx powers for each and every channel, 2.4 and 5.x */ | 1628 | /* set up new Tx powers for each and every channel, 2.4 and 5.x */ |
1629 | 1629 | ||
1630 | for (i = 0; i < priv->channel_count; i++) { | 1630 | for (i = 0; i < il->channel_count; i++) { |
1631 | ch_info = &priv->channel_info[i]; | 1631 | ch_info = &il->channel_info[i]; |
1632 | a_band = il_is_channel_a_band(ch_info); | 1632 | a_band = il_is_channel_a_band(ch_info); |
1633 | 1633 | ||
1634 | /* find minimum power of all user and regulatory constraints | 1634 | /* find minimum power of all user and regulatory constraints |
@@ -1639,19 +1639,19 @@ int il3945_hw_reg_set_txpower(struct il_priv *priv, s8 power) | |||
1639 | ch_info->curr_txpow = max_power; | 1639 | ch_info->curr_txpow = max_power; |
1640 | 1640 | ||
1641 | /* this considers the h/w clipping limitations */ | 1641 | /* this considers the h/w clipping limitations */ |
1642 | il3945_hw_reg_set_new_power(priv, ch_info); | 1642 | il3945_hw_reg_set_new_power(il, ch_info); |
1643 | } | 1643 | } |
1644 | } | 1644 | } |
1645 | 1645 | ||
1646 | /* update txpower settings for all channels, | 1646 | /* update txpower settings for all channels, |
1647 | * send to NIC if associated. */ | 1647 | * send to NIC if associated. */ |
1648 | il3945_is_temp_calib_needed(priv); | 1648 | il3945_is_temp_calib_needed(il); |
1649 | il3945_hw_reg_comp_txpower_temp(priv); | 1649 | il3945_hw_reg_comp_txpower_temp(il); |
1650 | 1650 | ||
1651 | return 0; | 1651 | return 0; |
1652 | } | 1652 | } |
1653 | 1653 | ||
1654 | static int il3945_send_rxon_assoc(struct il_priv *priv, | 1654 | static int il3945_send_rxon_assoc(struct il_priv *il, |
1655 | struct il_rxon_context *ctx) | 1655 | struct il_rxon_context *ctx) |
1656 | { | 1656 | { |
1657 | int rc = 0; | 1657 | int rc = 0; |
@@ -1670,7 +1670,7 @@ static int il3945_send_rxon_assoc(struct il_priv *priv, | |||
1670 | (rxon1->filter_flags == rxon2->filter_flags) && | 1670 | (rxon1->filter_flags == rxon2->filter_flags) && |
1671 | (rxon1->cck_basic_rates == rxon2->cck_basic_rates) && | 1671 | (rxon1->cck_basic_rates == rxon2->cck_basic_rates) && |
1672 | (rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates)) { | 1672 | (rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates)) { |
1673 | IL_DEBUG_INFO(priv, "Using current RXON_ASSOC. Not resending.\n"); | 1673 | IL_DEBUG_INFO(il, "Using current RXON_ASSOC. Not resending.\n"); |
1674 | return 0; | 1674 | return 0; |
1675 | } | 1675 | } |
1676 | 1676 | ||
@@ -1680,17 +1680,17 @@ static int il3945_send_rxon_assoc(struct il_priv *priv, | |||
1680 | rxon_assoc.cck_basic_rates = ctx->staging.cck_basic_rates; | 1680 | rxon_assoc.cck_basic_rates = ctx->staging.cck_basic_rates; |
1681 | rxon_assoc.reserved = 0; | 1681 | rxon_assoc.reserved = 0; |
1682 | 1682 | ||
1683 | rc = il_send_cmd_sync(priv, &cmd); | 1683 | rc = il_send_cmd_sync(il, &cmd); |
1684 | if (rc) | 1684 | if (rc) |
1685 | return rc; | 1685 | return rc; |
1686 | 1686 | ||
1687 | pkt = (struct il_rx_packet *)cmd.reply_page; | 1687 | pkt = (struct il_rx_packet *)cmd.reply_page; |
1688 | if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { | 1688 | if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { |
1689 | IL_ERR(priv, "Bad return from REPLY_RXON_ASSOC command\n"); | 1689 | IL_ERR(il, "Bad return from REPLY_RXON_ASSOC command\n"); |
1690 | rc = -EIO; | 1690 | rc = -EIO; |
1691 | } | 1691 | } |
1692 | 1692 | ||
1693 | il_free_pages(priv, cmd.reply_page); | 1693 | il_free_pages(il, cmd.reply_page); |
1694 | 1694 | ||
1695 | return rc; | 1695 | return rc; |
1696 | } | 1696 | } |
@@ -1703,7 +1703,7 @@ static int il3945_send_rxon_assoc(struct il_priv *priv, | |||
1703 | * function correctly transitions out of the RXON_ASSOC_MSK state if | 1703 | * function correctly transitions out of the RXON_ASSOC_MSK state if |
1704 | * a HW tune is required based on the RXON structure changes. | 1704 | * a HW tune is required based on the RXON structure changes. |
1705 | */ | 1705 | */ |
1706 | int il3945_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) | 1706 | int il3945_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx) |
1707 | { | 1707 | { |
1708 | /* cast away the const for active_rxon in this function */ | 1708 | /* cast away the const for active_rxon in this function */ |
1709 | struct il3945_rxon_cmd *active_rxon = (void *)&ctx->active; | 1709 | 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) | |||
1711 | int rc = 0; | 1711 | int rc = 0; |
1712 | bool new_assoc = !!(staging_rxon->filter_flags & RXON_FILTER_ASSOC_MSK); | 1712 | bool new_assoc = !!(staging_rxon->filter_flags & RXON_FILTER_ASSOC_MSK); |
1713 | 1713 | ||
1714 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 1714 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) |
1715 | return -EINVAL; | 1715 | return -EINVAL; |
1716 | 1716 | ||
1717 | if (!il_is_alive(priv)) | 1717 | if (!il_is_alive(il)) |
1718 | return -1; | 1718 | return -1; |
1719 | 1719 | ||
1720 | /* always get timestamp with Rx frame */ | 1720 | /* always get timestamp with Rx frame */ |
@@ -1723,23 +1723,23 @@ int il3945_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) | |||
1723 | /* select antenna */ | 1723 | /* select antenna */ |
1724 | staging_rxon->flags &= | 1724 | staging_rxon->flags &= |
1725 | ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK); | 1725 | ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK); |
1726 | staging_rxon->flags |= il3945_get_antenna_flags(priv); | 1726 | staging_rxon->flags |= il3945_get_antenna_flags(il); |
1727 | 1727 | ||
1728 | rc = il_check_rxon_cmd(priv, ctx); | 1728 | rc = il_check_rxon_cmd(il, ctx); |
1729 | if (rc) { | 1729 | if (rc) { |
1730 | IL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); | 1730 | IL_ERR(il, "Invalid RXON configuration. Not committing.\n"); |
1731 | return -EINVAL; | 1731 | return -EINVAL; |
1732 | } | 1732 | } |
1733 | 1733 | ||
1734 | /* If we don't need to send a full RXON, we can use | 1734 | /* If we don't need to send a full RXON, we can use |
1735 | * il3945_rxon_assoc_cmd which is used to reconfigure filter | 1735 | * il3945_rxon_assoc_cmd which is used to reconfigure filter |
1736 | * and other flags for the current radio configuration. */ | 1736 | * and other flags for the current radio configuration. */ |
1737 | if (!il_full_rxon_required(priv, | 1737 | if (!il_full_rxon_required(il, |
1738 | &priv->contexts[IL_RXON_CTX_BSS])) { | 1738 | &il->contexts[IL_RXON_CTX_BSS])) { |
1739 | rc = il_send_rxon_assoc(priv, | 1739 | rc = il_send_rxon_assoc(il, |
1740 | &priv->contexts[IL_RXON_CTX_BSS]); | 1740 | &il->contexts[IL_RXON_CTX_BSS]); |
1741 | if (rc) { | 1741 | if (rc) { |
1742 | IL_ERR(priv, "Error setting RXON_ASSOC " | 1742 | IL_ERR(il, "Error setting RXON_ASSOC " |
1743 | "configuration (%d).\n", rc); | 1743 | "configuration (%d).\n", rc); |
1744 | return rc; | 1744 | return rc; |
1745 | } | 1745 | } |
@@ -1749,7 +1749,7 @@ int il3945_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) | |||
1749 | * We do not commit tx power settings while channel changing, | 1749 | * We do not commit tx power settings while channel changing, |
1750 | * do it now if tx power changed. | 1750 | * do it now if tx power changed. |
1751 | */ | 1751 | */ |
1752 | il_set_tx_power(priv, priv->tx_power_next, false); | 1752 | il_set_tx_power(il, il->tx_power_next, false); |
1753 | return 0; | 1753 | return 0; |
1754 | } | 1754 | } |
1755 | 1755 | ||
@@ -1757,8 +1757,8 @@ int il3945_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) | |||
1757 | * an RXON_ASSOC and the new config wants the associated mask enabled, | 1757 | * an RXON_ASSOC and the new config wants the associated mask enabled, |
1758 | * we must clear the associated from the active configuration | 1758 | * we must clear the associated from the active configuration |
1759 | * before we apply the new config */ | 1759 | * before we apply the new config */ |
1760 | if (il_is_associated(priv, IL_RXON_CTX_BSS) && new_assoc) { | 1760 | if (il_is_associated(il, IL_RXON_CTX_BSS) && new_assoc) { |
1761 | IL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n"); | 1761 | IL_DEBUG_INFO(il, "Toggling associated bit on current RXON\n"); |
1762 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 1762 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
1763 | 1763 | ||
1764 | /* | 1764 | /* |
@@ -1767,25 +1767,25 @@ int il3945_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) | |||
1767 | */ | 1767 | */ |
1768 | active_rxon->reserved4 = 0; | 1768 | active_rxon->reserved4 = 0; |
1769 | active_rxon->reserved5 = 0; | 1769 | active_rxon->reserved5 = 0; |
1770 | rc = il_send_cmd_pdu(priv, REPLY_RXON, | 1770 | rc = il_send_cmd_pdu(il, REPLY_RXON, |
1771 | sizeof(struct il3945_rxon_cmd), | 1771 | sizeof(struct il3945_rxon_cmd), |
1772 | &priv->contexts[IL_RXON_CTX_BSS].active); | 1772 | &il->contexts[IL_RXON_CTX_BSS].active); |
1773 | 1773 | ||
1774 | /* If the mask clearing failed then we set | 1774 | /* If the mask clearing failed then we set |
1775 | * active_rxon back to what it was previously */ | 1775 | * active_rxon back to what it was previously */ |
1776 | if (rc) { | 1776 | if (rc) { |
1777 | active_rxon->filter_flags |= RXON_FILTER_ASSOC_MSK; | 1777 | active_rxon->filter_flags |= RXON_FILTER_ASSOC_MSK; |
1778 | IL_ERR(priv, "Error clearing ASSOC_MSK on current " | 1778 | IL_ERR(il, "Error clearing ASSOC_MSK on current " |
1779 | "configuration (%d).\n", rc); | 1779 | "configuration (%d).\n", rc); |
1780 | return rc; | 1780 | return rc; |
1781 | } | 1781 | } |
1782 | il_clear_ucode_stations(priv, | 1782 | il_clear_ucode_stations(il, |
1783 | &priv->contexts[IL_RXON_CTX_BSS]); | 1783 | &il->contexts[IL_RXON_CTX_BSS]); |
1784 | il_restore_stations(priv, | 1784 | il_restore_stations(il, |
1785 | &priv->contexts[IL_RXON_CTX_BSS]); | 1785 | &il->contexts[IL_RXON_CTX_BSS]); |
1786 | } | 1786 | } |
1787 | 1787 | ||
1788 | IL_DEBUG_INFO(priv, "Sending RXON\n" | 1788 | IL_DEBUG_INFO(il, "Sending RXON\n" |
1789 | "* with%s RXON_FILTER_ASSOC_MSK\n" | 1789 | "* with%s RXON_FILTER_ASSOC_MSK\n" |
1790 | "* channel = %d\n" | 1790 | "* channel = %d\n" |
1791 | "* bssid = %pM\n", | 1791 | "* bssid = %pM\n", |
@@ -1800,38 +1800,38 @@ int il3945_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) | |||
1800 | staging_rxon->reserved4 = 0; | 1800 | staging_rxon->reserved4 = 0; |
1801 | staging_rxon->reserved5 = 0; | 1801 | staging_rxon->reserved5 = 0; |
1802 | 1802 | ||
1803 | il_set_rxon_hwcrypto(priv, ctx, !il3945_mod_params.sw_crypto); | 1803 | il_set_rxon_hwcrypto(il, ctx, !il3945_mod_params.sw_crypto); |
1804 | 1804 | ||
1805 | /* Apply the new configuration */ | 1805 | /* Apply the new configuration */ |
1806 | rc = il_send_cmd_pdu(priv, REPLY_RXON, | 1806 | rc = il_send_cmd_pdu(il, REPLY_RXON, |
1807 | sizeof(struct il3945_rxon_cmd), | 1807 | sizeof(struct il3945_rxon_cmd), |
1808 | staging_rxon); | 1808 | staging_rxon); |
1809 | if (rc) { | 1809 | if (rc) { |
1810 | IL_ERR(priv, "Error setting new configuration (%d).\n", rc); | 1810 | IL_ERR(il, "Error setting new configuration (%d).\n", rc); |
1811 | return rc; | 1811 | return rc; |
1812 | } | 1812 | } |
1813 | 1813 | ||
1814 | memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); | 1814 | memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); |
1815 | 1815 | ||
1816 | if (!new_assoc) { | 1816 | if (!new_assoc) { |
1817 | il_clear_ucode_stations(priv, | 1817 | il_clear_ucode_stations(il, |
1818 | &priv->contexts[IL_RXON_CTX_BSS]); | 1818 | &il->contexts[IL_RXON_CTX_BSS]); |
1819 | il_restore_stations(priv, | 1819 | il_restore_stations(il, |
1820 | &priv->contexts[IL_RXON_CTX_BSS]); | 1820 | &il->contexts[IL_RXON_CTX_BSS]); |
1821 | } | 1821 | } |
1822 | 1822 | ||
1823 | /* If we issue a new RXON command which required a tune then we must | 1823 | /* If we issue a new RXON command which required a tune then we must |
1824 | * send a new TXPOWER command or we won't be able to Tx any frames */ | 1824 | * send a new TXPOWER command or we won't be able to Tx any frames */ |
1825 | rc = il_set_tx_power(priv, priv->tx_power_next, true); | 1825 | rc = il_set_tx_power(il, il->tx_power_next, true); |
1826 | if (rc) { | 1826 | if (rc) { |
1827 | IL_ERR(priv, "Error setting Tx power (%d).\n", rc); | 1827 | IL_ERR(il, "Error setting Tx power (%d).\n", rc); |
1828 | return rc; | 1828 | return rc; |
1829 | } | 1829 | } |
1830 | 1830 | ||
1831 | /* Init the hardware's rate fallback order based on the band */ | 1831 | /* Init the hardware's rate fallback order based on the band */ |
1832 | rc = il3945_init_hw_rate_table(priv); | 1832 | rc = il3945_init_hw_rate_table(il); |
1833 | if (rc) { | 1833 | if (rc) { |
1834 | IL_ERR(priv, "Error setting HW rate table: %02X\n", rc); | 1834 | IL_ERR(il, "Error setting HW rate table: %02X\n", rc); |
1835 | return -EIO; | 1835 | return -EIO; |
1836 | } | 1836 | } |
1837 | 1837 | ||
@@ -1848,34 +1848,34 @@ int il3945_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) | |||
1848 | * -- send new set of gain settings to NIC | 1848 | * -- send new set of gain settings to NIC |
1849 | * NOTE: This should continue working, even when we're not associated, | 1849 | * NOTE: This should continue working, even when we're not associated, |
1850 | * so we can keep our internal table of scan powers current. */ | 1850 | * so we can keep our internal table of scan powers current. */ |
1851 | void il3945_reg_txpower_periodic(struct il_priv *priv) | 1851 | void il3945_reg_txpower_periodic(struct il_priv *il) |
1852 | { | 1852 | { |
1853 | /* This will kick in the "brute force" | 1853 | /* This will kick in the "brute force" |
1854 | * il3945_hw_reg_comp_txpower_temp() below */ | 1854 | * il3945_hw_reg_comp_txpower_temp() below */ |
1855 | if (!il3945_is_temp_calib_needed(priv)) | 1855 | if (!il3945_is_temp_calib_needed(il)) |
1856 | goto reschedule; | 1856 | goto reschedule; |
1857 | 1857 | ||
1858 | /* Set up a new set of temp-adjusted TxPowers, send to NIC. | 1858 | /* Set up a new set of temp-adjusted TxPowers, send to NIC. |
1859 | * This is based *only* on current temperature, | 1859 | * This is based *only* on current temperature, |
1860 | * ignoring any previous power measurements */ | 1860 | * ignoring any previous power measurements */ |
1861 | il3945_hw_reg_comp_txpower_temp(priv); | 1861 | il3945_hw_reg_comp_txpower_temp(il); |
1862 | 1862 | ||
1863 | reschedule: | 1863 | reschedule: |
1864 | queue_delayed_work(priv->workqueue, | 1864 | queue_delayed_work(il->workqueue, |
1865 | &priv->_3945.thermal_periodic, REG_RECALIB_PERIOD * HZ); | 1865 | &il->_3945.thermal_periodic, REG_RECALIB_PERIOD * HZ); |
1866 | } | 1866 | } |
1867 | 1867 | ||
1868 | static void il3945_bg_reg_txpower_periodic(struct work_struct *work) | 1868 | static void il3945_bg_reg_txpower_periodic(struct work_struct *work) |
1869 | { | 1869 | { |
1870 | struct il_priv *priv = container_of(work, struct il_priv, | 1870 | struct il_priv *il = container_of(work, struct il_priv, |
1871 | _3945.thermal_periodic.work); | 1871 | _3945.thermal_periodic.work); |
1872 | 1872 | ||
1873 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 1873 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) |
1874 | return; | 1874 | return; |
1875 | 1875 | ||
1876 | mutex_lock(&priv->mutex); | 1876 | mutex_lock(&il->mutex); |
1877 | il3945_reg_txpower_periodic(priv); | 1877 | il3945_reg_txpower_periodic(il); |
1878 | mutex_unlock(&priv->mutex); | 1878 | mutex_unlock(&il->mutex); |
1879 | } | 1879 | } |
1880 | 1880 | ||
1881 | /** | 1881 | /** |
@@ -1889,10 +1889,10 @@ static void il3945_bg_reg_txpower_periodic(struct work_struct *work) | |||
1889 | * on A-band, EEPROM's "group frequency" entries represent the top | 1889 | * on A-band, EEPROM's "group frequency" entries represent the top |
1890 | * channel in each group 1-4. Group 5 All B/G channels are in group 0. | 1890 | * channel in each group 1-4. Group 5 All B/G channels are in group 0. |
1891 | */ | 1891 | */ |
1892 | static u16 il3945_hw_reg_get_ch_grp_index(struct il_priv *priv, | 1892 | static u16 il3945_hw_reg_get_ch_grp_index(struct il_priv *il, |
1893 | const struct il_channel_info *ch_info) | 1893 | const struct il_channel_info *ch_info) |
1894 | { | 1894 | { |
1895 | struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; | 1895 | struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; |
1896 | struct il3945_eeprom_txpower_group *ch_grp = &eeprom->groups[0]; | 1896 | struct il3945_eeprom_txpower_group *ch_grp = &eeprom->groups[0]; |
1897 | u8 group; | 1897 | u8 group; |
1898 | u16 group_index = 0; /* based on factory calib frequencies */ | 1898 | u16 group_index = 0; /* based on factory calib frequencies */ |
@@ -1913,7 +1913,7 @@ static u16 il3945_hw_reg_get_ch_grp_index(struct il_priv *priv, | |||
1913 | } else | 1913 | } else |
1914 | group_index = 0; /* 2.4 GHz, group 0 */ | 1914 | group_index = 0; /* 2.4 GHz, group 0 */ |
1915 | 1915 | ||
1916 | IL_DEBUG_POWER(priv, "Chnl %d mapped to grp %d\n", ch_info->channel, | 1916 | IL_DEBUG_POWER(il, "Chnl %d mapped to grp %d\n", ch_info->channel, |
1917 | group_index); | 1917 | group_index); |
1918 | return group_index; | 1918 | return group_index; |
1919 | } | 1919 | } |
@@ -1924,12 +1924,12 @@ static u16 il3945_hw_reg_get_ch_grp_index(struct il_priv *priv, | |||
1924 | * Interpolate to get nominal (i.e. at factory calibration temperature) index | 1924 | * Interpolate to get nominal (i.e. at factory calibration temperature) index |
1925 | * into radio/DSP gain settings table for requested power. | 1925 | * into radio/DSP gain settings table for requested power. |
1926 | */ | 1926 | */ |
1927 | static int il3945_hw_reg_get_matched_power_index(struct il_priv *priv, | 1927 | static int il3945_hw_reg_get_matched_power_index(struct il_priv *il, |
1928 | s8 requested_power, | 1928 | s8 requested_power, |
1929 | s32 setting_index, s32 *new_index) | 1929 | s32 setting_index, s32 *new_index) |
1930 | { | 1930 | { |
1931 | const struct il3945_eeprom_txpower_group *chnl_grp = NULL; | 1931 | const struct il3945_eeprom_txpower_group *chnl_grp = NULL; |
1932 | struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; | 1932 | struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; |
1933 | s32 index0, index1; | 1933 | s32 index0, index1; |
1934 | s32 power = 2 * requested_power; | 1934 | s32 power = 2 * requested_power; |
1935 | s32 i; | 1935 | s32 i; |
@@ -1973,14 +1973,14 @@ static int il3945_hw_reg_get_matched_power_index(struct il_priv *priv, | |||
1973 | return 0; | 1973 | return 0; |
1974 | } | 1974 | } |
1975 | 1975 | ||
1976 | static void il3945_hw_reg_init_channel_groups(struct il_priv *priv) | 1976 | static void il3945_hw_reg_init_channel_groups(struct il_priv *il) |
1977 | { | 1977 | { |
1978 | u32 i; | 1978 | u32 i; |
1979 | s32 rate_index; | 1979 | s32 rate_index; |
1980 | struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; | 1980 | struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; |
1981 | const struct il3945_eeprom_txpower_group *group; | 1981 | const struct il3945_eeprom_txpower_group *group; |
1982 | 1982 | ||
1983 | IL_DEBUG_POWER(priv, "Initializing factory calib info from EEPROM\n"); | 1983 | IL_DEBUG_POWER(il, "Initializing factory calib info from EEPROM\n"); |
1984 | 1984 | ||
1985 | for (i = 0; i < IL_NUM_TX_CALIB_GROUPS; i++) { | 1985 | for (i = 0; i < IL_NUM_TX_CALIB_GROUPS; i++) { |
1986 | s8 *clip_pwrs; /* table of power levels for each rate */ | 1986 | s8 *clip_pwrs; /* table of power levels for each rate */ |
@@ -1989,7 +1989,7 @@ static void il3945_hw_reg_init_channel_groups(struct il_priv *priv) | |||
1989 | 1989 | ||
1990 | /* sanity check on factory saturation power value */ | 1990 | /* sanity check on factory saturation power value */ |
1991 | if (group->saturation_power < 40) { | 1991 | if (group->saturation_power < 40) { |
1992 | IL_WARN(priv, "Error: saturation power is %d, " | 1992 | IL_WARN(il, "Error: saturation power is %d, " |
1993 | "less than minimum expected 40\n", | 1993 | "less than minimum expected 40\n", |
1994 | group->saturation_power); | 1994 | group->saturation_power); |
1995 | return; | 1995 | return; |
@@ -2004,7 +2004,7 @@ static void il3945_hw_reg_init_channel_groups(struct il_priv *priv) | |||
2004 | * power peaks, without too much distortion (clipping). | 2004 | * power peaks, without too much distortion (clipping). |
2005 | */ | 2005 | */ |
2006 | /* we'll fill in this array with h/w max power levels */ | 2006 | /* we'll fill in this array with h/w max power levels */ |
2007 | clip_pwrs = (s8 *) priv->_3945.clip_groups[i].clip_powers; | 2007 | clip_pwrs = (s8 *) il->_3945.clip_groups[i].clip_powers; |
2008 | 2008 | ||
2009 | /* divide factory saturation power by 2 to find -3dB level */ | 2009 | /* divide factory saturation power by 2 to find -3dB level */ |
2010 | satur_pwr = (s8) (group->saturation_power >> 1); | 2010 | satur_pwr = (s8) (group->saturation_power >> 1); |
@@ -2042,7 +2042,7 @@ static void il3945_hw_reg_init_channel_groups(struct il_priv *priv) | |||
2042 | /** | 2042 | /** |
2043 | * il3945_txpower_set_from_eeprom - Set channel power info based on EEPROM | 2043 | * il3945_txpower_set_from_eeprom - Set channel power info based on EEPROM |
2044 | * | 2044 | * |
2045 | * Second pass (during init) to set up priv->channel_info | 2045 | * Second pass (during init) to set up il->channel_info |
2046 | * | 2046 | * |
2047 | * Set up Tx-power settings in our channel info database for each VALID | 2047 | * Set up Tx-power settings in our channel info database for each VALID |
2048 | * (for this geo/SKU) channel, at all Tx data rates, based on eeprom values | 2048 | * (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) | |||
2054 | * | 2054 | * |
2055 | * This does *not* write values to NIC, just sets up our internal table. | 2055 | * This does *not* write values to NIC, just sets up our internal table. |
2056 | */ | 2056 | */ |
2057 | int il3945_txpower_set_from_eeprom(struct il_priv *priv) | 2057 | int il3945_txpower_set_from_eeprom(struct il_priv *il) |
2058 | { | 2058 | { |
2059 | struct il_channel_info *ch_info = NULL; | 2059 | struct il_channel_info *ch_info = NULL; |
2060 | struct il3945_channel_power_info *pwr_info; | 2060 | struct il3945_channel_power_info *pwr_info; |
2061 | struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; | 2061 | struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; |
2062 | int delta_index; | 2062 | int delta_index; |
2063 | u8 rate_index; | 2063 | u8 rate_index; |
2064 | u8 scan_tbl_index; | 2064 | u8 scan_tbl_index; |
@@ -2071,13 +2071,13 @@ int il3945_txpower_set_from_eeprom(struct il_priv *priv) | |||
2071 | 2071 | ||
2072 | /* save temperature reference, | 2072 | /* save temperature reference, |
2073 | * so we can determine next time to calibrate */ | 2073 | * so we can determine next time to calibrate */ |
2074 | temperature = il3945_hw_reg_txpower_get_temperature(priv); | 2074 | temperature = il3945_hw_reg_txpower_get_temperature(il); |
2075 | priv->last_temperature = temperature; | 2075 | il->last_temperature = temperature; |
2076 | 2076 | ||
2077 | il3945_hw_reg_init_channel_groups(priv); | 2077 | il3945_hw_reg_init_channel_groups(il); |
2078 | 2078 | ||
2079 | /* initialize Tx power info for each and every channel, 2.4 and 5.x */ | 2079 | /* initialize Tx power info for each and every channel, 2.4 and 5.x */ |
2080 | for (i = 0, ch_info = priv->channel_info; i < priv->channel_count; | 2080 | for (i = 0, ch_info = il->channel_info; i < il->channel_count; |
2081 | i++, ch_info++) { | 2081 | i++, ch_info++) { |
2082 | a_band = il_is_channel_a_band(ch_info); | 2082 | a_band = il_is_channel_a_band(ch_info); |
2083 | if (!il_is_channel_valid(ch_info)) | 2083 | if (!il_is_channel_valid(ch_info)) |
@@ -2085,10 +2085,10 @@ int il3945_txpower_set_from_eeprom(struct il_priv *priv) | |||
2085 | 2085 | ||
2086 | /* find this channel's channel group (*not* "band") index */ | 2086 | /* find this channel's channel group (*not* "band") index */ |
2087 | ch_info->group_index = | 2087 | ch_info->group_index = |
2088 | il3945_hw_reg_get_ch_grp_index(priv, ch_info); | 2088 | il3945_hw_reg_get_ch_grp_index(il, ch_info); |
2089 | 2089 | ||
2090 | /* Get this chnlgrp's rate->max/clip-powers table */ | 2090 | /* Get this chnlgrp's rate->max/clip-powers table */ |
2091 | clip_pwrs = priv->_3945.clip_groups[ch_info->group_index].clip_powers; | 2091 | clip_pwrs = il->_3945.clip_groups[ch_info->group_index].clip_powers; |
2092 | 2092 | ||
2093 | /* calculate power index *adjustment* value according to | 2093 | /* calculate power index *adjustment* value according to |
2094 | * diff between current temperature and factory temperature */ | 2094 | * diff between current temperature and factory temperature */ |
@@ -2096,7 +2096,7 @@ int il3945_txpower_set_from_eeprom(struct il_priv *priv) | |||
2096 | eeprom->groups[ch_info->group_index]. | 2096 | eeprom->groups[ch_info->group_index]. |
2097 | temperature); | 2097 | temperature); |
2098 | 2098 | ||
2099 | IL_DEBUG_POWER(priv, "Delta index for channel %d: %d [%d]\n", | 2099 | IL_DEBUG_POWER(il, "Delta index for channel %d: %d [%d]\n", |
2100 | ch_info->channel, delta_index, temperature + | 2100 | ch_info->channel, delta_index, temperature + |
2101 | IL_TEMP_CONVERT); | 2101 | IL_TEMP_CONVERT); |
2102 | 2102 | ||
@@ -2115,11 +2115,11 @@ int il3945_txpower_set_from_eeprom(struct il_priv *priv) | |||
2115 | 2115 | ||
2116 | /* get base (i.e. at factory-measured temperature) | 2116 | /* get base (i.e. at factory-measured temperature) |
2117 | * power table index for this rate's power */ | 2117 | * power table index for this rate's power */ |
2118 | rc = il3945_hw_reg_get_matched_power_index(priv, pwr, | 2118 | rc = il3945_hw_reg_get_matched_power_index(il, pwr, |
2119 | ch_info->group_index, | 2119 | ch_info->group_index, |
2120 | &power_idx); | 2120 | &power_idx); |
2121 | if (rc) { | 2121 | if (rc) { |
2122 | IL_ERR(priv, "Invalid power index\n"); | 2122 | IL_ERR(il, "Invalid power index\n"); |
2123 | return rc; | 2123 | return rc; |
2124 | } | 2124 | } |
2125 | pwr_info->base_power_index = (u8) power_idx; | 2125 | pwr_info->base_power_index = (u8) power_idx; |
@@ -2171,7 +2171,7 @@ int il3945_txpower_set_from_eeprom(struct il_priv *priv) | |||
2171 | scan_tbl_index < IL_NUM_SCAN_RATES; scan_tbl_index++) { | 2171 | scan_tbl_index < IL_NUM_SCAN_RATES; scan_tbl_index++) { |
2172 | s32 actual_index = (scan_tbl_index == 0) ? | 2172 | s32 actual_index = (scan_tbl_index == 0) ? |
2173 | IL_RATE_1M_INDEX_TABLE : IL_RATE_6M_INDEX_TABLE; | 2173 | IL_RATE_1M_INDEX_TABLE : IL_RATE_6M_INDEX_TABLE; |
2174 | il3945_hw_reg_set_scan_power(priv, scan_tbl_index, | 2174 | il3945_hw_reg_set_scan_power(il, scan_tbl_index, |
2175 | actual_index, clip_pwrs, ch_info, a_band); | 2175 | actual_index, clip_pwrs, ch_info, a_band); |
2176 | } | 2176 | } |
2177 | } | 2177 | } |
@@ -2179,31 +2179,31 @@ int il3945_txpower_set_from_eeprom(struct il_priv *priv) | |||
2179 | return 0; | 2179 | return 0; |
2180 | } | 2180 | } |
2181 | 2181 | ||
2182 | int il3945_hw_rxq_stop(struct il_priv *priv) | 2182 | int il3945_hw_rxq_stop(struct il_priv *il) |
2183 | { | 2183 | { |
2184 | int rc; | 2184 | int rc; |
2185 | 2185 | ||
2186 | il_write_direct32(priv, FH39_RCSR_CONFIG(0), 0); | 2186 | il_write_direct32(il, FH39_RCSR_CONFIG(0), 0); |
2187 | rc = il_poll_direct_bit(priv, FH39_RSSR_STATUS, | 2187 | rc = il_poll_direct_bit(il, FH39_RSSR_STATUS, |
2188 | FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000); | 2188 | FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000); |
2189 | if (rc < 0) | 2189 | if (rc < 0) |
2190 | IL_ERR(priv, "Can't stop Rx DMA.\n"); | 2190 | IL_ERR(il, "Can't stop Rx DMA.\n"); |
2191 | 2191 | ||
2192 | return 0; | 2192 | return 0; |
2193 | } | 2193 | } |
2194 | 2194 | ||
2195 | int il3945_hw_tx_queue_init(struct il_priv *priv, struct il_tx_queue *txq) | 2195 | int il3945_hw_tx_queue_init(struct il_priv *il, struct il_tx_queue *txq) |
2196 | { | 2196 | { |
2197 | int txq_id = txq->q.id; | 2197 | int txq_id = txq->q.id; |
2198 | 2198 | ||
2199 | struct il3945_shared *shared_data = priv->_3945.shared_virt; | 2199 | struct il3945_shared *shared_data = il->_3945.shared_virt; |
2200 | 2200 | ||
2201 | shared_data->tx_base_ptr[txq_id] = cpu_to_le32((u32)txq->q.dma_addr); | 2201 | shared_data->tx_base_ptr[txq_id] = cpu_to_le32((u32)txq->q.dma_addr); |
2202 | 2202 | ||
2203 | il_write_direct32(priv, FH39_CBCC_CTRL(txq_id), 0); | 2203 | il_write_direct32(il, FH39_CBCC_CTRL(txq_id), 0); |
2204 | il_write_direct32(priv, FH39_CBCC_BASE(txq_id), 0); | 2204 | il_write_direct32(il, FH39_CBCC_BASE(txq_id), 0); |
2205 | 2205 | ||
2206 | il_write_direct32(priv, FH39_TCSR_CONFIG(txq_id), | 2206 | il_write_direct32(il, FH39_TCSR_CONFIG(txq_id), |
2207 | FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT | | 2207 | FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT | |
2208 | FH39_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF | | 2208 | FH39_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF | |
2209 | FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD | | 2209 | FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD | |
@@ -2211,7 +2211,7 @@ int il3945_hw_tx_queue_init(struct il_priv *priv, struct il_tx_queue *txq) | |||
2211 | FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE); | 2211 | FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE); |
2212 | 2212 | ||
2213 | /* fake read to flush all prev. writes */ | 2213 | /* fake read to flush all prev. writes */ |
2214 | il_read32(priv, FH39_TSSR_CBB_BASE); | 2214 | il_read32(il, FH39_TSSR_CBB_BASE); |
2215 | 2215 | ||
2216 | return 0; | 2216 | return 0; |
2217 | } | 2217 | } |
@@ -2250,10 +2250,10 @@ static u16 il3945_build_addsta_hcmd(const struct il_addsta_cmd *cmd, | |||
2250 | return (u16)sizeof(struct il3945_addsta_cmd); | 2250 | return (u16)sizeof(struct il3945_addsta_cmd); |
2251 | } | 2251 | } |
2252 | 2252 | ||
2253 | static int il3945_add_bssid_station(struct il_priv *priv, | 2253 | static int il3945_add_bssid_station(struct il_priv *il, |
2254 | const u8 *addr, u8 *sta_id_r) | 2254 | const u8 *addr, u8 *sta_id_r) |
2255 | { | 2255 | { |
2256 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 2256 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
2257 | int ret; | 2257 | int ret; |
2258 | u8 sta_id; | 2258 | u8 sta_id; |
2259 | unsigned long flags; | 2259 | unsigned long flags; |
@@ -2261,49 +2261,49 @@ static int il3945_add_bssid_station(struct il_priv *priv, | |||
2261 | if (sta_id_r) | 2261 | if (sta_id_r) |
2262 | *sta_id_r = IL_INVALID_STATION; | 2262 | *sta_id_r = IL_INVALID_STATION; |
2263 | 2263 | ||
2264 | ret = il_add_station_common(priv, ctx, addr, 0, NULL, &sta_id); | 2264 | ret = il_add_station_common(il, ctx, addr, 0, NULL, &sta_id); |
2265 | if (ret) { | 2265 | if (ret) { |
2266 | IL_ERR(priv, "Unable to add station %pM\n", addr); | 2266 | IL_ERR(il, "Unable to add station %pM\n", addr); |
2267 | return ret; | 2267 | return ret; |
2268 | } | 2268 | } |
2269 | 2269 | ||
2270 | if (sta_id_r) | 2270 | if (sta_id_r) |
2271 | *sta_id_r = sta_id; | 2271 | *sta_id_r = sta_id; |
2272 | 2272 | ||
2273 | spin_lock_irqsave(&priv->sta_lock, flags); | 2273 | spin_lock_irqsave(&il->sta_lock, flags); |
2274 | priv->stations[sta_id].used |= IL_STA_LOCAL; | 2274 | il->stations[sta_id].used |= IL_STA_LOCAL; |
2275 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 2275 | spin_unlock_irqrestore(&il->sta_lock, flags); |
2276 | 2276 | ||
2277 | return 0; | 2277 | return 0; |
2278 | } | 2278 | } |
2279 | static int il3945_manage_ibss_station(struct il_priv *priv, | 2279 | static int il3945_manage_ibss_station(struct il_priv *il, |
2280 | struct ieee80211_vif *vif, bool add) | 2280 | struct ieee80211_vif *vif, bool add) |
2281 | { | 2281 | { |
2282 | struct il_vif_priv *vif_priv = (void *)vif->drv_priv; | 2282 | struct il_vif_priv *vif_priv = (void *)vif->drv_priv; |
2283 | int ret; | 2283 | int ret; |
2284 | 2284 | ||
2285 | if (add) { | 2285 | if (add) { |
2286 | ret = il3945_add_bssid_station(priv, vif->bss_conf.bssid, | 2286 | ret = il3945_add_bssid_station(il, vif->bss_conf.bssid, |
2287 | &vif_priv->ibss_bssid_sta_id); | 2287 | &vif_priv->ibss_bssid_sta_id); |
2288 | if (ret) | 2288 | if (ret) |
2289 | return ret; | 2289 | return ret; |
2290 | 2290 | ||
2291 | il3945_sync_sta(priv, vif_priv->ibss_bssid_sta_id, | 2291 | il3945_sync_sta(il, vif_priv->ibss_bssid_sta_id, |
2292 | (priv->band == IEEE80211_BAND_5GHZ) ? | 2292 | (il->band == IEEE80211_BAND_5GHZ) ? |
2293 | IL_RATE_6M_PLCP : IL_RATE_1M_PLCP); | 2293 | IL_RATE_6M_PLCP : IL_RATE_1M_PLCP); |
2294 | il3945_rate_scale_init(priv->hw, vif_priv->ibss_bssid_sta_id); | 2294 | il3945_rate_scale_init(il->hw, vif_priv->ibss_bssid_sta_id); |
2295 | 2295 | ||
2296 | return 0; | 2296 | return 0; |
2297 | } | 2297 | } |
2298 | 2298 | ||
2299 | return il_remove_station(priv, vif_priv->ibss_bssid_sta_id, | 2299 | return il_remove_station(il, vif_priv->ibss_bssid_sta_id, |
2300 | vif->bss_conf.bssid); | 2300 | vif->bss_conf.bssid); |
2301 | } | 2301 | } |
2302 | 2302 | ||
2303 | /** | 2303 | /** |
2304 | * il3945_init_hw_rate_table - Initialize the hardware rate fallback table | 2304 | * il3945_init_hw_rate_table - Initialize the hardware rate fallback table |
2305 | */ | 2305 | */ |
2306 | int il3945_init_hw_rate_table(struct il_priv *priv) | 2306 | int il3945_init_hw_rate_table(struct il_priv *il) |
2307 | { | 2307 | { |
2308 | int rc, i, index, prev_index; | 2308 | int rc, i, index, prev_index; |
2309 | struct il3945_rate_scaling_cmd rate_cmd = { | 2309 | struct il3945_rate_scaling_cmd rate_cmd = { |
@@ -2316,15 +2316,15 @@ int il3945_init_hw_rate_table(struct il_priv *priv) | |||
2316 | 2316 | ||
2317 | table[index].rate_n_flags = | 2317 | table[index].rate_n_flags = |
2318 | il3945_hw_set_rate_n_flags(il3945_rates[i].plcp, 0); | 2318 | il3945_hw_set_rate_n_flags(il3945_rates[i].plcp, 0); |
2319 | table[index].try_cnt = priv->retry_rate; | 2319 | table[index].try_cnt = il->retry_rate; |
2320 | prev_index = il3945_get_prev_ieee_rate(i); | 2320 | prev_index = il3945_get_prev_ieee_rate(i); |
2321 | table[index].next_rate_index = | 2321 | table[index].next_rate_index = |
2322 | il3945_rates[prev_index].table_rs_index; | 2322 | il3945_rates[prev_index].table_rs_index; |
2323 | } | 2323 | } |
2324 | 2324 | ||
2325 | switch (priv->band) { | 2325 | switch (il->band) { |
2326 | case IEEE80211_BAND_5GHZ: | 2326 | case IEEE80211_BAND_5GHZ: |
2327 | IL_DEBUG_RATE(priv, "Select A mode rate scale\n"); | 2327 | IL_DEBUG_RATE(il, "Select A mode rate scale\n"); |
2328 | /* If one of the following CCK rates is used, | 2328 | /* If one of the following CCK rates is used, |
2329 | * have it fall back to the 6M OFDM rate */ | 2329 | * have it fall back to the 6M OFDM rate */ |
2330 | for (i = IL_RATE_1M_INDEX_TABLE; | 2330 | for (i = IL_RATE_1M_INDEX_TABLE; |
@@ -2342,12 +2342,12 @@ int il3945_init_hw_rate_table(struct il_priv *priv) | |||
2342 | break; | 2342 | break; |
2343 | 2343 | ||
2344 | case IEEE80211_BAND_2GHZ: | 2344 | case IEEE80211_BAND_2GHZ: |
2345 | IL_DEBUG_RATE(priv, "Select B/G mode rate scale\n"); | 2345 | IL_DEBUG_RATE(il, "Select B/G mode rate scale\n"); |
2346 | /* If an OFDM rate is used, have it fall back to the | 2346 | /* If an OFDM rate is used, have it fall back to the |
2347 | * 1M CCK rates */ | 2347 | * 1M CCK rates */ |
2348 | 2348 | ||
2349 | if (!(priv->_3945.sta_supp_rates & IL_OFDM_RATES_MASK) && | 2349 | if (!(il->_3945.sta_supp_rates & IL_OFDM_RATES_MASK) && |
2350 | il_is_associated(priv, IL_RXON_CTX_BSS)) { | 2350 | il_is_associated(il, IL_RXON_CTX_BSS)) { |
2351 | 2351 | ||
2352 | index = IL_FIRST_CCK_RATE; | 2352 | index = IL_FIRST_CCK_RATE; |
2353 | for (i = IL_RATE_6M_INDEX_TABLE; | 2353 | for (i = IL_RATE_6M_INDEX_TABLE; |
@@ -2368,52 +2368,52 @@ int il3945_init_hw_rate_table(struct il_priv *priv) | |||
2368 | 2368 | ||
2369 | /* Update the rate scaling for control frame Tx */ | 2369 | /* Update the rate scaling for control frame Tx */ |
2370 | rate_cmd.table_id = 0; | 2370 | rate_cmd.table_id = 0; |
2371 | rc = il_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd), | 2371 | rc = il_send_cmd_pdu(il, REPLY_RATE_SCALE, sizeof(rate_cmd), |
2372 | &rate_cmd); | 2372 | &rate_cmd); |
2373 | if (rc) | 2373 | if (rc) |
2374 | return rc; | 2374 | return rc; |
2375 | 2375 | ||
2376 | /* Update the rate scaling for data frame Tx */ | 2376 | /* Update the rate scaling for data frame Tx */ |
2377 | rate_cmd.table_id = 1; | 2377 | rate_cmd.table_id = 1; |
2378 | return il_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd), | 2378 | return il_send_cmd_pdu(il, REPLY_RATE_SCALE, sizeof(rate_cmd), |
2379 | &rate_cmd); | 2379 | &rate_cmd); |
2380 | } | 2380 | } |
2381 | 2381 | ||
2382 | /* Called when initializing driver */ | 2382 | /* Called when initializing driver */ |
2383 | int il3945_hw_set_hw_params(struct il_priv *priv) | 2383 | int il3945_hw_set_hw_params(struct il_priv *il) |
2384 | { | 2384 | { |
2385 | memset((void *)&priv->hw_params, 0, | 2385 | memset((void *)&il->hw_params, 0, |
2386 | sizeof(struct il_hw_params)); | 2386 | sizeof(struct il_hw_params)); |
2387 | 2387 | ||
2388 | priv->_3945.shared_virt = | 2388 | il->_3945.shared_virt = |
2389 | dma_alloc_coherent(&priv->pci_dev->dev, | 2389 | dma_alloc_coherent(&il->pci_dev->dev, |
2390 | sizeof(struct il3945_shared), | 2390 | sizeof(struct il3945_shared), |
2391 | &priv->_3945.shared_phys, GFP_KERNEL); | 2391 | &il->_3945.shared_phys, GFP_KERNEL); |
2392 | if (!priv->_3945.shared_virt) { | 2392 | if (!il->_3945.shared_virt) { |
2393 | IL_ERR(priv, "failed to allocate pci memory\n"); | 2393 | IL_ERR(il, "failed to allocate pci memory\n"); |
2394 | return -ENOMEM; | 2394 | return -ENOMEM; |
2395 | } | 2395 | } |
2396 | 2396 | ||
2397 | /* Assign number of Usable TX queues */ | 2397 | /* Assign number of Usable TX queues */ |
2398 | priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues; | 2398 | il->hw_params.max_txq_num = il->cfg->base_params->num_of_queues; |
2399 | 2399 | ||
2400 | priv->hw_params.tfd_size = sizeof(struct il3945_tfd); | 2400 | il->hw_params.tfd_size = sizeof(struct il3945_tfd); |
2401 | priv->hw_params.rx_page_order = get_order(IL_RX_BUF_SIZE_3K); | 2401 | il->hw_params.rx_page_order = get_order(IL_RX_BUF_SIZE_3K); |
2402 | priv->hw_params.max_rxq_size = RX_QUEUE_SIZE; | 2402 | il->hw_params.max_rxq_size = RX_QUEUE_SIZE; |
2403 | priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG; | 2403 | il->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG; |
2404 | priv->hw_params.max_stations = IWL3945_STATION_COUNT; | 2404 | il->hw_params.max_stations = IWL3945_STATION_COUNT; |
2405 | priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id = IWL3945_BROADCAST_ID; | 2405 | il->contexts[IL_RXON_CTX_BSS].bcast_sta_id = IWL3945_BROADCAST_ID; |
2406 | 2406 | ||
2407 | priv->sta_key_max_num = STA_KEY_MAX_NUM; | 2407 | il->sta_key_max_num = STA_KEY_MAX_NUM; |
2408 | 2408 | ||
2409 | priv->hw_params.rx_wrt_ptr_reg = FH39_RSCSR_CHNL0_WPTR; | 2409 | il->hw_params.rx_wrt_ptr_reg = FH39_RSCSR_CHNL0_WPTR; |
2410 | priv->hw_params.max_beacon_itrvl = IWL39_MAX_UCODE_BEACON_INTERVAL; | 2410 | il->hw_params.max_beacon_itrvl = IWL39_MAX_UCODE_BEACON_INTERVAL; |
2411 | priv->hw_params.beacon_time_tsf_bits = IWL3945_EXT_BEACON_TIME_POS; | 2411 | il->hw_params.beacon_time_tsf_bits = IWL3945_EXT_BEACON_TIME_POS; |
2412 | 2412 | ||
2413 | return 0; | 2413 | return 0; |
2414 | } | 2414 | } |
2415 | 2415 | ||
2416 | unsigned int il3945_hw_get_beacon_cmd(struct il_priv *priv, | 2416 | unsigned int il3945_hw_get_beacon_cmd(struct il_priv *il, |
2417 | struct il3945_frame *frame, u8 rate) | 2417 | struct il3945_frame *frame, u8 rate) |
2418 | { | 2418 | { |
2419 | struct il3945_tx_beacon_cmd *tx_beacon_cmd; | 2419 | struct il3945_tx_beacon_cmd *tx_beacon_cmd; |
@@ -2423,10 +2423,10 @@ unsigned int il3945_hw_get_beacon_cmd(struct il_priv *priv, | |||
2423 | memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); | 2423 | memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); |
2424 | 2424 | ||
2425 | tx_beacon_cmd->tx.sta_id = | 2425 | tx_beacon_cmd->tx.sta_id = |
2426 | priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id; | 2426 | il->contexts[IL_RXON_CTX_BSS].bcast_sta_id; |
2427 | tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; | 2427 | tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; |
2428 | 2428 | ||
2429 | frame_size = il3945_fill_beacon_frame(priv, | 2429 | frame_size = il3945_fill_beacon_frame(il, |
2430 | tx_beacon_cmd->frame, | 2430 | tx_beacon_cmd->frame, |
2431 | sizeof(frame->u) - sizeof(*tx_beacon_cmd)); | 2431 | sizeof(frame->u) - sizeof(*tx_beacon_cmd)); |
2432 | 2432 | ||
@@ -2447,41 +2447,41 @@ unsigned int il3945_hw_get_beacon_cmd(struct il_priv *priv, | |||
2447 | return sizeof(struct il3945_tx_beacon_cmd) + frame_size; | 2447 | return sizeof(struct il3945_tx_beacon_cmd) + frame_size; |
2448 | } | 2448 | } |
2449 | 2449 | ||
2450 | void il3945_hw_rx_handler_setup(struct il_priv *priv) | 2450 | void il3945_hw_rx_handler_setup(struct il_priv *il) |
2451 | { | 2451 | { |
2452 | priv->rx_handlers[REPLY_TX] = il3945_rx_reply_tx; | 2452 | il->rx_handlers[REPLY_TX] = il3945_rx_reply_tx; |
2453 | priv->rx_handlers[REPLY_3945_RX] = il3945_rx_reply_rx; | 2453 | il->rx_handlers[REPLY_3945_RX] = il3945_rx_reply_rx; |
2454 | } | 2454 | } |
2455 | 2455 | ||
2456 | void il3945_hw_setup_deferred_work(struct il_priv *priv) | 2456 | void il3945_hw_setup_deferred_work(struct il_priv *il) |
2457 | { | 2457 | { |
2458 | INIT_DELAYED_WORK(&priv->_3945.thermal_periodic, | 2458 | INIT_DELAYED_WORK(&il->_3945.thermal_periodic, |
2459 | il3945_bg_reg_txpower_periodic); | 2459 | il3945_bg_reg_txpower_periodic); |
2460 | } | 2460 | } |
2461 | 2461 | ||
2462 | void il3945_hw_cancel_deferred_work(struct il_priv *priv) | 2462 | void il3945_hw_cancel_deferred_work(struct il_priv *il) |
2463 | { | 2463 | { |
2464 | cancel_delayed_work(&priv->_3945.thermal_periodic); | 2464 | cancel_delayed_work(&il->_3945.thermal_periodic); |
2465 | } | 2465 | } |
2466 | 2466 | ||
2467 | /* check contents of special bootstrap uCode SRAM */ | 2467 | /* check contents of special bootstrap uCode SRAM */ |
2468 | static int il3945_verify_bsm(struct il_priv *priv) | 2468 | static int il3945_verify_bsm(struct il_priv *il) |
2469 | { | 2469 | { |
2470 | __le32 *image = priv->ucode_boot.v_addr; | 2470 | __le32 *image = il->ucode_boot.v_addr; |
2471 | u32 len = priv->ucode_boot.len; | 2471 | u32 len = il->ucode_boot.len; |
2472 | u32 reg; | 2472 | u32 reg; |
2473 | u32 val; | 2473 | u32 val; |
2474 | 2474 | ||
2475 | IL_DEBUG_INFO(priv, "Begin verify bsm\n"); | 2475 | IL_DEBUG_INFO(il, "Begin verify bsm\n"); |
2476 | 2476 | ||
2477 | /* verify BSM SRAM contents */ | 2477 | /* verify BSM SRAM contents */ |
2478 | val = il_read_prph(priv, BSM_WR_DWCOUNT_REG); | 2478 | val = il_read_prph(il, BSM_WR_DWCOUNT_REG); |
2479 | for (reg = BSM_SRAM_LOWER_BOUND; | 2479 | for (reg = BSM_SRAM_LOWER_BOUND; |
2480 | reg < BSM_SRAM_LOWER_BOUND + len; | 2480 | reg < BSM_SRAM_LOWER_BOUND + len; |
2481 | reg += sizeof(u32), image++) { | 2481 | reg += sizeof(u32), image++) { |
2482 | val = il_read_prph(priv, reg); | 2482 | val = il_read_prph(il, reg); |
2483 | if (val != le32_to_cpu(*image)) { | 2483 | if (val != le32_to_cpu(*image)) { |
2484 | IL_ERR(priv, "BSM uCode verification failed at " | 2484 | IL_ERR(il, "BSM uCode verification failed at " |
2485 | "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n", | 2485 | "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n", |
2486 | BSM_SRAM_LOWER_BOUND, | 2486 | BSM_SRAM_LOWER_BOUND, |
2487 | reg - BSM_SRAM_LOWER_BOUND, len, | 2487 | reg - BSM_SRAM_LOWER_BOUND, len, |
@@ -2490,7 +2490,7 @@ static int il3945_verify_bsm(struct il_priv *priv) | |||
2490 | } | 2490 | } |
2491 | } | 2491 | } |
2492 | 2492 | ||
2493 | IL_DEBUG_INFO(priv, "BSM bootstrap uCode image OK\n"); | 2493 | IL_DEBUG_INFO(il, "BSM bootstrap uCode image OK\n"); |
2494 | 2494 | ||
2495 | return 0; | 2495 | return 0; |
2496 | } | 2496 | } |
@@ -2510,14 +2510,14 @@ static int il3945_verify_bsm(struct il_priv *priv) | |||
2510 | * simply claims ownership, which should be safe when this function is called | 2510 | * simply claims ownership, which should be safe when this function is called |
2511 | * (i.e. before loading uCode!). | 2511 | * (i.e. before loading uCode!). |
2512 | */ | 2512 | */ |
2513 | static int il3945_eeprom_acquire_semaphore(struct il_priv *priv) | 2513 | static int il3945_eeprom_acquire_semaphore(struct il_priv *il) |
2514 | { | 2514 | { |
2515 | _il_clear_bit(priv, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK); | 2515 | _il_clear_bit(il, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK); |
2516 | return 0; | 2516 | return 0; |
2517 | } | 2517 | } |
2518 | 2518 | ||
2519 | 2519 | ||
2520 | static void il3945_eeprom_release_semaphore(struct il_priv *priv) | 2520 | static void il3945_eeprom_release_semaphore(struct il_priv *il) |
2521 | { | 2521 | { |
2522 | return; | 2522 | return; |
2523 | } | 2523 | } |
@@ -2554,10 +2554,10 @@ static void il3945_eeprom_release_semaphore(struct il_priv *priv) | |||
2554 | * the runtime uCode instructions and the backup data cache into SRAM, | 2554 | * the runtime uCode instructions and the backup data cache into SRAM, |
2555 | * and re-launches the runtime uCode from where it left off. | 2555 | * and re-launches the runtime uCode from where it left off. |
2556 | */ | 2556 | */ |
2557 | static int il3945_load_bsm(struct il_priv *priv) | 2557 | static int il3945_load_bsm(struct il_priv *il) |
2558 | { | 2558 | { |
2559 | __le32 *image = priv->ucode_boot.v_addr; | 2559 | __le32 *image = il->ucode_boot.v_addr; |
2560 | u32 len = priv->ucode_boot.len; | 2560 | u32 len = il->ucode_boot.len; |
2561 | dma_addr_t pinst; | 2561 | dma_addr_t pinst; |
2562 | dma_addr_t pdata; | 2562 | dma_addr_t pdata; |
2563 | u32 inst_len; | 2563 | u32 inst_len; |
@@ -2567,7 +2567,7 @@ static int il3945_load_bsm(struct il_priv *priv) | |||
2567 | u32 done; | 2567 | u32 done; |
2568 | u32 reg_offset; | 2568 | u32 reg_offset; |
2569 | 2569 | ||
2570 | IL_DEBUG_INFO(priv, "Begin load bsm\n"); | 2570 | IL_DEBUG_INFO(il, "Begin load bsm\n"); |
2571 | 2571 | ||
2572 | /* make sure bootstrap program is no larger than BSM's SRAM size */ | 2572 | /* make sure bootstrap program is no larger than BSM's SRAM size */ |
2573 | if (len > IWL39_MAX_BSM_SIZE) | 2573 | if (len > IWL39_MAX_BSM_SIZE) |
@@ -2578,55 +2578,55 @@ static int il3945_load_bsm(struct il_priv *priv) | |||
2578 | * NOTE: il3945_initialize_alive_start() will replace these values, | 2578 | * NOTE: il3945_initialize_alive_start() will replace these values, |
2579 | * after the "initialize" uCode has run, to point to | 2579 | * after the "initialize" uCode has run, to point to |
2580 | * runtime/protocol instructions and backup data cache. */ | 2580 | * runtime/protocol instructions and backup data cache. */ |
2581 | pinst = priv->ucode_init.p_addr; | 2581 | pinst = il->ucode_init.p_addr; |
2582 | pdata = priv->ucode_init_data.p_addr; | 2582 | pdata = il->ucode_init_data.p_addr; |
2583 | inst_len = priv->ucode_init.len; | 2583 | inst_len = il->ucode_init.len; |
2584 | data_len = priv->ucode_init_data.len; | 2584 | data_len = il->ucode_init_data.len; |
2585 | 2585 | ||
2586 | il_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); | 2586 | il_write_prph(il, BSM_DRAM_INST_PTR_REG, pinst); |
2587 | il_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); | 2587 | il_write_prph(il, BSM_DRAM_DATA_PTR_REG, pdata); |
2588 | il_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); | 2588 | il_write_prph(il, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); |
2589 | il_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); | 2589 | il_write_prph(il, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); |
2590 | 2590 | ||
2591 | /* Fill BSM memory with bootstrap instructions */ | 2591 | /* Fill BSM memory with bootstrap instructions */ |
2592 | for (reg_offset = BSM_SRAM_LOWER_BOUND; | 2592 | for (reg_offset = BSM_SRAM_LOWER_BOUND; |
2593 | reg_offset < BSM_SRAM_LOWER_BOUND + len; | 2593 | reg_offset < BSM_SRAM_LOWER_BOUND + len; |
2594 | reg_offset += sizeof(u32), image++) | 2594 | reg_offset += sizeof(u32), image++) |
2595 | _il_write_prph(priv, reg_offset, | 2595 | _il_write_prph(il, reg_offset, |
2596 | le32_to_cpu(*image)); | 2596 | le32_to_cpu(*image)); |
2597 | 2597 | ||
2598 | rc = il3945_verify_bsm(priv); | 2598 | rc = il3945_verify_bsm(il); |
2599 | if (rc) | 2599 | if (rc) |
2600 | return rc; | 2600 | return rc; |
2601 | 2601 | ||
2602 | /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */ | 2602 | /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */ |
2603 | il_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0); | 2603 | il_write_prph(il, BSM_WR_MEM_SRC_REG, 0x0); |
2604 | il_write_prph(priv, BSM_WR_MEM_DST_REG, | 2604 | il_write_prph(il, BSM_WR_MEM_DST_REG, |
2605 | IWL39_RTC_INST_LOWER_BOUND); | 2605 | IWL39_RTC_INST_LOWER_BOUND); |
2606 | il_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); | 2606 | il_write_prph(il, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); |
2607 | 2607 | ||
2608 | /* Load bootstrap code into instruction SRAM now, | 2608 | /* Load bootstrap code into instruction SRAM now, |
2609 | * to prepare to load "initialize" uCode */ | 2609 | * to prepare to load "initialize" uCode */ |
2610 | il_write_prph(priv, BSM_WR_CTRL_REG, | 2610 | il_write_prph(il, BSM_WR_CTRL_REG, |
2611 | BSM_WR_CTRL_REG_BIT_START); | 2611 | BSM_WR_CTRL_REG_BIT_START); |
2612 | 2612 | ||
2613 | /* Wait for load of bootstrap uCode to finish */ | 2613 | /* Wait for load of bootstrap uCode to finish */ |
2614 | for (i = 0; i < 100; i++) { | 2614 | for (i = 0; i < 100; i++) { |
2615 | done = il_read_prph(priv, BSM_WR_CTRL_REG); | 2615 | done = il_read_prph(il, BSM_WR_CTRL_REG); |
2616 | if (!(done & BSM_WR_CTRL_REG_BIT_START)) | 2616 | if (!(done & BSM_WR_CTRL_REG_BIT_START)) |
2617 | break; | 2617 | break; |
2618 | udelay(10); | 2618 | udelay(10); |
2619 | } | 2619 | } |
2620 | if (i < 100) | 2620 | if (i < 100) |
2621 | IL_DEBUG_INFO(priv, "BSM write complete, poll %d iterations\n", i); | 2621 | IL_DEBUG_INFO(il, "BSM write complete, poll %d iterations\n", i); |
2622 | else { | 2622 | else { |
2623 | IL_ERR(priv, "BSM write did not complete!\n"); | 2623 | IL_ERR(il, "BSM write did not complete!\n"); |
2624 | return -EIO; | 2624 | return -EIO; |
2625 | } | 2625 | } |
2626 | 2626 | ||
2627 | /* Enable future boot loads whenever power management unit triggers it | 2627 | /* Enable future boot loads whenever power management unit triggers it |
2628 | * (e.g. when powering back up after power-save shutdown) */ | 2628 | * (e.g. when powering back up after power-save shutdown) */ |
2629 | il_write_prph(priv, BSM_WR_CTRL_REG, | 2629 | il_write_prph(il, BSM_WR_CTRL_REG, |
2630 | BSM_WR_CTRL_REG_BIT_START_EN); | 2630 | BSM_WR_CTRL_REG_BIT_START_EN); |
2631 | 2631 | ||
2632 | return 0; | 2632 | return 0; |
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945.h b/drivers/net/wireless/iwlegacy/iwl-3945.h index 167eedcfeb6..abe778b1b42 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 { | |||
85 | 85 | ||
86 | struct il3945_rs_sta { | 86 | struct il3945_rs_sta { |
87 | spinlock_t lock; | 87 | spinlock_t lock; |
88 | struct il_priv *priv; | 88 | struct il_priv *il; |
89 | s32 *expected_tpt; | 89 | s32 *expected_tpt; |
90 | unsigned long last_partial_flush; | 90 | unsigned long last_partial_flush; |
91 | unsigned long last_flush; | 91 | unsigned long last_flush; |
@@ -207,12 +207,12 @@ struct il3945_ibss_seq { | |||
207 | *****************************************************************************/ | 207 | *****************************************************************************/ |
208 | extern int il3945_calc_db_from_ratio(int sig_ratio); | 208 | extern int il3945_calc_db_from_ratio(int sig_ratio); |
209 | extern void il3945_rx_replenish(void *data); | 209 | extern void il3945_rx_replenish(void *data); |
210 | extern void il3945_rx_queue_reset(struct il_priv *priv, struct il_rx_queue *rxq); | 210 | extern void il3945_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq); |
211 | extern unsigned int il3945_fill_beacon_frame(struct il_priv *priv, | 211 | extern unsigned int il3945_fill_beacon_frame(struct il_priv *il, |
212 | struct ieee80211_hdr *hdr, int left); | 212 | struct ieee80211_hdr *hdr, int left); |
213 | extern int il3945_dump_nic_event_log(struct il_priv *priv, bool full_log, | 213 | extern int il3945_dump_nic_event_log(struct il_priv *il, bool full_log, |
214 | char **buf, bool display); | 214 | char **buf, bool display); |
215 | extern void il3945_dump_nic_error_log(struct il_priv *priv); | 215 | extern void il3945_dump_nic_error_log(struct il_priv *il); |
216 | 216 | ||
217 | /****************************************************************************** | 217 | /****************************************************************************** |
218 | * | 218 | * |
@@ -230,44 +230,44 @@ extern void il3945_dump_nic_error_log(struct il_priv *priv); | |||
230 | * il3945_mac_ <-- mac80211 callback | 230 | * il3945_mac_ <-- mac80211 callback |
231 | * | 231 | * |
232 | ****************************************************************************/ | 232 | ****************************************************************************/ |
233 | extern void il3945_hw_rx_handler_setup(struct il_priv *priv); | 233 | extern void il3945_hw_rx_handler_setup(struct il_priv *il); |
234 | extern void il3945_hw_setup_deferred_work(struct il_priv *priv); | 234 | extern void il3945_hw_setup_deferred_work(struct il_priv *il); |
235 | extern void il3945_hw_cancel_deferred_work(struct il_priv *priv); | 235 | extern void il3945_hw_cancel_deferred_work(struct il_priv *il); |
236 | extern int il3945_hw_rxq_stop(struct il_priv *priv); | 236 | extern int il3945_hw_rxq_stop(struct il_priv *il); |
237 | extern int il3945_hw_set_hw_params(struct il_priv *priv); | 237 | extern int il3945_hw_set_hw_params(struct il_priv *il); |
238 | extern int il3945_hw_nic_init(struct il_priv *priv); | 238 | extern int il3945_hw_nic_init(struct il_priv *il); |
239 | extern int il3945_hw_nic_stop_master(struct il_priv *priv); | 239 | extern int il3945_hw_nic_stop_master(struct il_priv *il); |
240 | extern void il3945_hw_txq_ctx_free(struct il_priv *priv); | 240 | extern void il3945_hw_txq_ctx_free(struct il_priv *il); |
241 | extern void il3945_hw_txq_ctx_stop(struct il_priv *priv); | 241 | extern void il3945_hw_txq_ctx_stop(struct il_priv *il); |
242 | extern int il3945_hw_nic_reset(struct il_priv *priv); | 242 | extern int il3945_hw_nic_reset(struct il_priv *il); |
243 | extern int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *priv, | 243 | extern int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *il, |
244 | struct il_tx_queue *txq, | 244 | struct il_tx_queue *txq, |
245 | dma_addr_t addr, u16 len, | 245 | dma_addr_t addr, u16 len, |
246 | u8 reset, u8 pad); | 246 | u8 reset, u8 pad); |
247 | extern void il3945_hw_txq_free_tfd(struct il_priv *priv, | 247 | extern void il3945_hw_txq_free_tfd(struct il_priv *il, |
248 | struct il_tx_queue *txq); | 248 | struct il_tx_queue *txq); |
249 | extern int il3945_hw_get_temperature(struct il_priv *priv); | 249 | extern int il3945_hw_get_temperature(struct il_priv *il); |
250 | extern int il3945_hw_tx_queue_init(struct il_priv *priv, | 250 | extern int il3945_hw_tx_queue_init(struct il_priv *il, |
251 | struct il_tx_queue *txq); | 251 | struct il_tx_queue *txq); |
252 | extern unsigned int il3945_hw_get_beacon_cmd(struct il_priv *priv, | 252 | extern unsigned int il3945_hw_get_beacon_cmd(struct il_priv *il, |
253 | struct il3945_frame *frame, u8 rate); | 253 | struct il3945_frame *frame, u8 rate); |
254 | void il3945_hw_build_tx_cmd_rate(struct il_priv *priv, | 254 | void il3945_hw_build_tx_cmd_rate(struct il_priv *il, |
255 | struct il_device_cmd *cmd, | 255 | struct il_device_cmd *cmd, |
256 | struct ieee80211_tx_info *info, | 256 | struct ieee80211_tx_info *info, |
257 | struct ieee80211_hdr *hdr, | 257 | struct ieee80211_hdr *hdr, |
258 | int sta_id, int tx_id); | 258 | int sta_id, int tx_id); |
259 | extern int il3945_hw_reg_send_txpower(struct il_priv *priv); | 259 | extern int il3945_hw_reg_send_txpower(struct il_priv *il); |
260 | extern int il3945_hw_reg_set_txpower(struct il_priv *priv, s8 power); | 260 | extern int il3945_hw_reg_set_txpower(struct il_priv *il, s8 power); |
261 | extern void il3945_hw_rx_statistics(struct il_priv *priv, | 261 | extern void il3945_hw_rx_statistics(struct il_priv *il, |
262 | struct il_rx_mem_buffer *rxb); | 262 | struct il_rx_mem_buffer *rxb); |
263 | void il3945_reply_statistics(struct il_priv *priv, | 263 | void il3945_reply_statistics(struct il_priv *il, |
264 | struct il_rx_mem_buffer *rxb); | 264 | struct il_rx_mem_buffer *rxb); |
265 | extern void il3945_disable_events(struct il_priv *priv); | 265 | extern void il3945_disable_events(struct il_priv *il); |
266 | extern int il4965_get_temperature(const struct il_priv *priv); | 266 | extern int il4965_get_temperature(const struct il_priv *il); |
267 | extern void il3945_post_associate(struct il_priv *priv); | 267 | extern void il3945_post_associate(struct il_priv *il); |
268 | extern void il3945_config_ap(struct il_priv *priv); | 268 | extern void il3945_config_ap(struct il_priv *il); |
269 | 269 | ||
270 | extern int il3945_commit_rxon(struct il_priv *priv, | 270 | extern int il3945_commit_rxon(struct il_priv *il, |
271 | struct il_rxon_context *ctx); | 271 | struct il_rxon_context *ctx); |
272 | 272 | ||
273 | /** | 273 | /** |
@@ -278,26 +278,26 @@ extern int il3945_commit_rxon(struct il_priv *priv, | |||
278 | * not yet been merged into a single common layer for managing the | 278 | * not yet been merged into a single common layer for managing the |
279 | * station tables. | 279 | * station tables. |
280 | */ | 280 | */ |
281 | extern u8 il3945_hw_find_station(struct il_priv *priv, const u8 *bssid); | 281 | extern u8 il3945_hw_find_station(struct il_priv *il, const u8 *bssid); |
282 | 282 | ||
283 | extern struct ieee80211_ops il3945_hw_ops; | 283 | extern struct ieee80211_ops il3945_hw_ops; |
284 | 284 | ||
285 | /* | 285 | /* |
286 | * Forward declare iwl-3945.c functions for iwl3945-base.c | 286 | * Forward declare iwl-3945.c functions for iwl3945-base.c |
287 | */ | 287 | */ |
288 | extern __le32 il3945_get_antenna_flags(const struct il_priv *priv); | 288 | extern __le32 il3945_get_antenna_flags(const struct il_priv *il); |
289 | extern int il3945_init_hw_rate_table(struct il_priv *priv); | 289 | extern int il3945_init_hw_rate_table(struct il_priv *il); |
290 | extern void il3945_reg_txpower_periodic(struct il_priv *priv); | 290 | extern void il3945_reg_txpower_periodic(struct il_priv *il); |
291 | extern int il3945_txpower_set_from_eeprom(struct il_priv *priv); | 291 | extern int il3945_txpower_set_from_eeprom(struct il_priv *il); |
292 | 292 | ||
293 | extern const struct il_channel_info *il3945_get_channel_info( | 293 | extern const struct il_channel_info *il3945_get_channel_info( |
294 | const struct il_priv *priv, enum ieee80211_band band, u16 channel); | 294 | const struct il_priv *il, enum ieee80211_band band, u16 channel); |
295 | 295 | ||
296 | extern int il3945_rs_next_rate(struct il_priv *priv, int rate); | 296 | extern int il3945_rs_next_rate(struct il_priv *il, int rate); |
297 | 297 | ||
298 | /* scanning */ | 298 | /* scanning */ |
299 | int il3945_request_scan(struct il_priv *priv, struct ieee80211_vif *vif); | 299 | int il3945_request_scan(struct il_priv *il, struct ieee80211_vif *vif); |
300 | void il3945_post_scan(struct il_priv *priv); | 300 | void il3945_post_scan(struct il_priv *il); |
301 | 301 | ||
302 | /* rates */ | 302 | /* rates */ |
303 | extern const struct il3945_rate_info il3945_rates[IL_RATE_COUNT_3945]; | 303 | 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 115eeb3d7c3..7807dc59e9c 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 { | |||
80 | u32 beacon_energy_c; | 80 | u32 beacon_energy_c; |
81 | }; | 81 | }; |
82 | 82 | ||
83 | void il4965_calib_free_results(struct il_priv *priv) | 83 | void il4965_calib_free_results(struct il_priv *il) |
84 | { | 84 | { |
85 | int i; | 85 | int i; |
86 | 86 | ||
87 | for (i = 0; i < IL_CALIB_MAX; i++) { | 87 | for (i = 0; i < IL_CALIB_MAX; i++) { |
88 | kfree(priv->calib_results[i].buf); | 88 | kfree(il->calib_results[i].buf); |
89 | priv->calib_results[i].buf = NULL; | 89 | il->calib_results[i].buf = NULL; |
90 | priv->calib_results[i].buf_len = 0; | 90 | il->calib_results[i].buf_len = 0; |
91 | } | 91 | } |
92 | } | 92 | } |
93 | 93 | ||
@@ -103,7 +103,7 @@ void il4965_calib_free_results(struct il_priv *priv) | |||
103 | * enough to receive all of our own network traffic, but not so | 103 | * enough to receive all of our own network traffic, but not so |
104 | * high that our DSP gets too busy trying to lock onto non-network | 104 | * high that our DSP gets too busy trying to lock onto non-network |
105 | * activity/noise. */ | 105 | * activity/noise. */ |
106 | static int il4965_sens_energy_cck(struct il_priv *priv, | 106 | static int il4965_sens_energy_cck(struct il_priv *il, |
107 | u32 norm_fa, | 107 | u32 norm_fa, |
108 | u32 rx_enable_time, | 108 | u32 rx_enable_time, |
109 | struct statistics_general_data *rx_info) | 109 | struct statistics_general_data *rx_info) |
@@ -130,9 +130,9 @@ static int il4965_sens_energy_cck(struct il_priv *priv, | |||
130 | u32 max_false_alarms = MAX_FA_CCK * rx_enable_time; | 130 | u32 max_false_alarms = MAX_FA_CCK * rx_enable_time; |
131 | u32 min_false_alarms = MIN_FA_CCK * rx_enable_time; | 131 | u32 min_false_alarms = MIN_FA_CCK * rx_enable_time; |
132 | struct il_sensitivity_data *data = NULL; | 132 | struct il_sensitivity_data *data = NULL; |
133 | const struct il_sensitivity_ranges *ranges = priv->hw_params.sens; | 133 | const struct il_sensitivity_ranges *ranges = il->hw_params.sens; |
134 | 134 | ||
135 | data = &(priv->sensitivity_data); | 135 | data = &(il->sensitivity_data); |
136 | 136 | ||
137 | data->nrg_auto_corr_silence_diff = 0; | 137 | data->nrg_auto_corr_silence_diff = 0; |
138 | 138 | ||
@@ -160,7 +160,7 @@ static int il4965_sens_energy_cck(struct il_priv *priv, | |||
160 | val = data->nrg_silence_rssi[i]; | 160 | val = data->nrg_silence_rssi[i]; |
161 | silence_ref = max(silence_ref, val); | 161 | silence_ref = max(silence_ref, val); |
162 | } | 162 | } |
163 | IL_DEBUG_CALIB(priv, "silence a %u, b %u, c %u, 20-bcn max %u\n", | 163 | IL_DEBUG_CALIB(il, "silence a %u, b %u, c %u, 20-bcn max %u\n", |
164 | silence_rssi_a, silence_rssi_b, silence_rssi_c, | 164 | silence_rssi_a, silence_rssi_b, silence_rssi_c, |
165 | silence_ref); | 165 | silence_ref); |
166 | 166 | ||
@@ -184,7 +184,7 @@ static int il4965_sens_energy_cck(struct il_priv *priv, | |||
184 | max_nrg_cck = (u32) max(max_nrg_cck, (data->nrg_value[i])); | 184 | max_nrg_cck = (u32) max(max_nrg_cck, (data->nrg_value[i])); |
185 | max_nrg_cck += 6; | 185 | max_nrg_cck += 6; |
186 | 186 | ||
187 | IL_DEBUG_CALIB(priv, "rx energy a %u, b %u, c %u, 10-bcn max/min %u\n", | 187 | IL_DEBUG_CALIB(il, "rx energy a %u, b %u, c %u, 10-bcn max/min %u\n", |
188 | rx_info->beacon_energy_a, rx_info->beacon_energy_b, | 188 | rx_info->beacon_energy_a, rx_info->beacon_energy_b, |
189 | rx_info->beacon_energy_c, max_nrg_cck - 6); | 189 | rx_info->beacon_energy_c, max_nrg_cck - 6); |
190 | 190 | ||
@@ -194,15 +194,15 @@ static int il4965_sens_energy_cck(struct il_priv *priv, | |||
194 | data->num_in_cck_no_fa++; | 194 | data->num_in_cck_no_fa++; |
195 | else | 195 | else |
196 | data->num_in_cck_no_fa = 0; | 196 | data->num_in_cck_no_fa = 0; |
197 | IL_DEBUG_CALIB(priv, "consecutive bcns with few false alarms = %u\n", | 197 | IL_DEBUG_CALIB(il, "consecutive bcns with few false alarms = %u\n", |
198 | data->num_in_cck_no_fa); | 198 | data->num_in_cck_no_fa); |
199 | 199 | ||
200 | /* If we got too many false alarms this time, reduce sensitivity */ | 200 | /* If we got too many false alarms this time, reduce sensitivity */ |
201 | if ((false_alarms > max_false_alarms) && | 201 | if ((false_alarms > max_false_alarms) && |
202 | (data->auto_corr_cck > AUTO_CORR_MAX_TH_CCK)) { | 202 | (data->auto_corr_cck > AUTO_CORR_MAX_TH_CCK)) { |
203 | IL_DEBUG_CALIB(priv, "norm FA %u > max FA %u\n", | 203 | IL_DEBUG_CALIB(il, "norm FA %u > max FA %u\n", |
204 | false_alarms, max_false_alarms); | 204 | false_alarms, max_false_alarms); |
205 | IL_DEBUG_CALIB(priv, "... reducing sensitivity\n"); | 205 | IL_DEBUG_CALIB(il, "... reducing sensitivity\n"); |
206 | data->nrg_curr_state = IL_FA_TOO_MANY; | 206 | data->nrg_curr_state = IL_FA_TOO_MANY; |
207 | /* Store for "fewer than desired" on later beacon */ | 207 | /* Store for "fewer than desired" on later beacon */ |
208 | data->nrg_silence_ref = silence_ref; | 208 | data->nrg_silence_ref = silence_ref; |
@@ -219,7 +219,7 @@ static int il4965_sens_energy_cck(struct il_priv *priv, | |||
219 | data->nrg_auto_corr_silence_diff = (s32)data->nrg_silence_ref - | 219 | data->nrg_auto_corr_silence_diff = (s32)data->nrg_silence_ref - |
220 | (s32)silence_ref; | 220 | (s32)silence_ref; |
221 | 221 | ||
222 | IL_DEBUG_CALIB(priv, | 222 | IL_DEBUG_CALIB(il, |
223 | "norm FA %u < min FA %u, silence diff %d\n", | 223 | "norm FA %u < min FA %u, silence diff %d\n", |
224 | false_alarms, min_false_alarms, | 224 | false_alarms, min_false_alarms, |
225 | data->nrg_auto_corr_silence_diff); | 225 | data->nrg_auto_corr_silence_diff); |
@@ -234,18 +234,18 @@ static int il4965_sens_energy_cck(struct il_priv *priv, | |||
234 | ((data->nrg_auto_corr_silence_diff > NRG_DIFF) || | 234 | ((data->nrg_auto_corr_silence_diff > NRG_DIFF) || |
235 | (data->num_in_cck_no_fa > MAX_NUMBER_CCK_NO_FA))) { | 235 | (data->num_in_cck_no_fa > MAX_NUMBER_CCK_NO_FA))) { |
236 | 236 | ||
237 | IL_DEBUG_CALIB(priv, "... increasing sensitivity\n"); | 237 | IL_DEBUG_CALIB(il, "... increasing sensitivity\n"); |
238 | /* Increase nrg value to increase sensitivity */ | 238 | /* Increase nrg value to increase sensitivity */ |
239 | val = data->nrg_th_cck + NRG_STEP_CCK; | 239 | val = data->nrg_th_cck + NRG_STEP_CCK; |
240 | data->nrg_th_cck = min((u32)ranges->min_nrg_cck, val); | 240 | data->nrg_th_cck = min((u32)ranges->min_nrg_cck, val); |
241 | } else { | 241 | } else { |
242 | IL_DEBUG_CALIB(priv, | 242 | IL_DEBUG_CALIB(il, |
243 | "... but not changing sensitivity\n"); | 243 | "... but not changing sensitivity\n"); |
244 | } | 244 | } |
245 | 245 | ||
246 | /* Else we got a healthy number of false alarms, keep status quo */ | 246 | /* Else we got a healthy number of false alarms, keep status quo */ |
247 | } else { | 247 | } else { |
248 | IL_DEBUG_CALIB(priv, " FA in safe zone\n"); | 248 | IL_DEBUG_CALIB(il, " FA in safe zone\n"); |
249 | data->nrg_curr_state = IL_FA_GOOD_RANGE; | 249 | data->nrg_curr_state = IL_FA_GOOD_RANGE; |
250 | 250 | ||
251 | /* Store for use in "fewer than desired" with later beacon */ | 251 | /* Store for use in "fewer than desired" with later beacon */ |
@@ -255,7 +255,7 @@ static int il4965_sens_energy_cck(struct il_priv *priv, | |||
255 | * give it some extra margin by reducing sensitivity again | 255 | * give it some extra margin by reducing sensitivity again |
256 | * (but don't go below measured energy of desired Rx) */ | 256 | * (but don't go below measured energy of desired Rx) */ |
257 | if (IL_FA_TOO_MANY == data->nrg_prev_state) { | 257 | if (IL_FA_TOO_MANY == data->nrg_prev_state) { |
258 | IL_DEBUG_CALIB(priv, "... increasing margin\n"); | 258 | IL_DEBUG_CALIB(il, "... increasing margin\n"); |
259 | if (data->nrg_th_cck > (max_nrg_cck + NRG_MARGIN)) | 259 | if (data->nrg_th_cck > (max_nrg_cck + NRG_MARGIN)) |
260 | data->nrg_th_cck -= NRG_MARGIN; | 260 | data->nrg_th_cck -= NRG_MARGIN; |
261 | else | 261 | else |
@@ -269,7 +269,7 @@ static int il4965_sens_energy_cck(struct il_priv *priv, | |||
269 | * Lower value is higher energy, so we use max()! | 269 | * Lower value is higher energy, so we use max()! |
270 | */ | 270 | */ |
271 | data->nrg_th_cck = max(max_nrg_cck, data->nrg_th_cck); | 271 | data->nrg_th_cck = max(max_nrg_cck, data->nrg_th_cck); |
272 | IL_DEBUG_CALIB(priv, "new nrg_th_cck %u\n", data->nrg_th_cck); | 272 | IL_DEBUG_CALIB(il, "new nrg_th_cck %u\n", data->nrg_th_cck); |
273 | 273 | ||
274 | data->nrg_prev_state = data->nrg_curr_state; | 274 | data->nrg_prev_state = data->nrg_curr_state; |
275 | 275 | ||
@@ -306,7 +306,7 @@ static int il4965_sens_energy_cck(struct il_priv *priv, | |||
306 | } | 306 | } |
307 | 307 | ||
308 | 308 | ||
309 | static int il4965_sens_auto_corr_ofdm(struct il_priv *priv, | 309 | static int il4965_sens_auto_corr_ofdm(struct il_priv *il, |
310 | u32 norm_fa, | 310 | u32 norm_fa, |
311 | u32 rx_enable_time) | 311 | u32 rx_enable_time) |
312 | { | 312 | { |
@@ -315,14 +315,14 @@ static int il4965_sens_auto_corr_ofdm(struct il_priv *priv, | |||
315 | u32 max_false_alarms = MAX_FA_OFDM * rx_enable_time; | 315 | u32 max_false_alarms = MAX_FA_OFDM * rx_enable_time; |
316 | u32 min_false_alarms = MIN_FA_OFDM * rx_enable_time; | 316 | u32 min_false_alarms = MIN_FA_OFDM * rx_enable_time; |
317 | struct il_sensitivity_data *data = NULL; | 317 | struct il_sensitivity_data *data = NULL; |
318 | const struct il_sensitivity_ranges *ranges = priv->hw_params.sens; | 318 | const struct il_sensitivity_ranges *ranges = il->hw_params.sens; |
319 | 319 | ||
320 | data = &(priv->sensitivity_data); | 320 | data = &(il->sensitivity_data); |
321 | 321 | ||
322 | /* If we got too many false alarms this time, reduce sensitivity */ | 322 | /* If we got too many false alarms this time, reduce sensitivity */ |
323 | if (false_alarms > max_false_alarms) { | 323 | if (false_alarms > max_false_alarms) { |
324 | 324 | ||
325 | IL_DEBUG_CALIB(priv, "norm FA %u > max FA %u)\n", | 325 | IL_DEBUG_CALIB(il, "norm FA %u > max FA %u)\n", |
326 | false_alarms, max_false_alarms); | 326 | false_alarms, max_false_alarms); |
327 | 327 | ||
328 | val = data->auto_corr_ofdm + AUTO_CORR_STEP_OFDM; | 328 | val = data->auto_corr_ofdm + AUTO_CORR_STEP_OFDM; |
@@ -345,7 +345,7 @@ static int il4965_sens_auto_corr_ofdm(struct il_priv *priv, | |||
345 | /* Else if we got fewer than desired, increase sensitivity */ | 345 | /* Else if we got fewer than desired, increase sensitivity */ |
346 | else if (false_alarms < min_false_alarms) { | 346 | else if (false_alarms < min_false_alarms) { |
347 | 347 | ||
348 | IL_DEBUG_CALIB(priv, "norm FA %u < min FA %u\n", | 348 | IL_DEBUG_CALIB(il, "norm FA %u < min FA %u\n", |
349 | false_alarms, min_false_alarms); | 349 | false_alarms, min_false_alarms); |
350 | 350 | ||
351 | val = data->auto_corr_ofdm - AUTO_CORR_STEP_OFDM; | 351 | val = data->auto_corr_ofdm - AUTO_CORR_STEP_OFDM; |
@@ -364,13 +364,13 @@ static int il4965_sens_auto_corr_ofdm(struct il_priv *priv, | |||
364 | data->auto_corr_ofdm_mrc_x1 = | 364 | data->auto_corr_ofdm_mrc_x1 = |
365 | max((u32)ranges->auto_corr_min_ofdm_mrc_x1, val); | 365 | max((u32)ranges->auto_corr_min_ofdm_mrc_x1, val); |
366 | } else { | 366 | } else { |
367 | IL_DEBUG_CALIB(priv, "min FA %u < norm FA %u < max FA %u OK\n", | 367 | IL_DEBUG_CALIB(il, "min FA %u < norm FA %u < max FA %u OK\n", |
368 | min_false_alarms, false_alarms, max_false_alarms); | 368 | min_false_alarms, false_alarms, max_false_alarms); |
369 | } | 369 | } |
370 | return 0; | 370 | return 0; |
371 | } | 371 | } |
372 | 372 | ||
373 | static void il4965_prepare_legacy_sensitivity_tbl(struct il_priv *priv, | 373 | static void il4965_prepare_legacy_sensitivity_tbl(struct il_priv *il, |
374 | struct il_sensitivity_data *data, | 374 | struct il_sensitivity_data *data, |
375 | __le16 *tbl) | 375 | __le16 *tbl) |
376 | { | 376 | { |
@@ -400,18 +400,18 @@ static void il4965_prepare_legacy_sensitivity_tbl(struct il_priv *priv, | |||
400 | tbl[HD_OFDM_ENERGY_TH_IN_INDEX] = | 400 | tbl[HD_OFDM_ENERGY_TH_IN_INDEX] = |
401 | cpu_to_le16(data->nrg_th_cca); | 401 | cpu_to_le16(data->nrg_th_cca); |
402 | 402 | ||
403 | IL_DEBUG_CALIB(priv, "ofdm: ac %u mrc %u x1 %u mrc_x1 %u thresh %u\n", | 403 | IL_DEBUG_CALIB(il, "ofdm: ac %u mrc %u x1 %u mrc_x1 %u thresh %u\n", |
404 | data->auto_corr_ofdm, data->auto_corr_ofdm_mrc, | 404 | data->auto_corr_ofdm, data->auto_corr_ofdm_mrc, |
405 | data->auto_corr_ofdm_x1, data->auto_corr_ofdm_mrc_x1, | 405 | data->auto_corr_ofdm_x1, data->auto_corr_ofdm_mrc_x1, |
406 | data->nrg_th_ofdm); | 406 | data->nrg_th_ofdm); |
407 | 407 | ||
408 | IL_DEBUG_CALIB(priv, "cck: ac %u mrc %u thresh %u\n", | 408 | IL_DEBUG_CALIB(il, "cck: ac %u mrc %u thresh %u\n", |
409 | data->auto_corr_cck, data->auto_corr_cck_mrc, | 409 | data->auto_corr_cck, data->auto_corr_cck_mrc, |
410 | data->nrg_th_cck); | 410 | data->nrg_th_cck); |
411 | } | 411 | } |
412 | 412 | ||
413 | /* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */ | 413 | /* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */ |
414 | static int il4965_sensitivity_write(struct il_priv *priv) | 414 | static int il4965_sensitivity_write(struct il_priv *il) |
415 | { | 415 | { |
416 | struct il_sensitivity_cmd cmd; | 416 | struct il_sensitivity_cmd cmd; |
417 | struct il_sensitivity_data *data = NULL; | 417 | struct il_sensitivity_data *data = NULL; |
@@ -422,43 +422,43 @@ static int il4965_sensitivity_write(struct il_priv *priv) | |||
422 | .data = &cmd, | 422 | .data = &cmd, |
423 | }; | 423 | }; |
424 | 424 | ||
425 | data = &(priv->sensitivity_data); | 425 | data = &(il->sensitivity_data); |
426 | 426 | ||
427 | memset(&cmd, 0, sizeof(cmd)); | 427 | memset(&cmd, 0, sizeof(cmd)); |
428 | 428 | ||
429 | il4965_prepare_legacy_sensitivity_tbl(priv, data, &cmd.table[0]); | 429 | il4965_prepare_legacy_sensitivity_tbl(il, data, &cmd.table[0]); |
430 | 430 | ||
431 | /* Update uCode's "work" table, and copy it to DSP */ | 431 | /* Update uCode's "work" table, and copy it to DSP */ |
432 | cmd.control = SENSITIVITY_CMD_CONTROL_WORK_TABLE; | 432 | cmd.control = SENSITIVITY_CMD_CONTROL_WORK_TABLE; |
433 | 433 | ||
434 | /* Don't send command to uCode if nothing has changed */ | 434 | /* Don't send command to uCode if nothing has changed */ |
435 | if (!memcmp(&cmd.table[0], &(priv->sensitivity_tbl[0]), | 435 | if (!memcmp(&cmd.table[0], &(il->sensitivity_tbl[0]), |
436 | sizeof(u16)*HD_TABLE_SIZE)) { | 436 | sizeof(u16)*HD_TABLE_SIZE)) { |
437 | IL_DEBUG_CALIB(priv, "No change in SENSITIVITY_CMD\n"); | 437 | IL_DEBUG_CALIB(il, "No change in SENSITIVITY_CMD\n"); |
438 | return 0; | 438 | return 0; |
439 | } | 439 | } |
440 | 440 | ||
441 | /* Copy table for comparison next time */ | 441 | /* Copy table for comparison next time */ |
442 | memcpy(&(priv->sensitivity_tbl[0]), &(cmd.table[0]), | 442 | memcpy(&(il->sensitivity_tbl[0]), &(cmd.table[0]), |
443 | sizeof(u16)*HD_TABLE_SIZE); | 443 | sizeof(u16)*HD_TABLE_SIZE); |
444 | 444 | ||
445 | return il_send_cmd(priv, &cmd_out); | 445 | return il_send_cmd(il, &cmd_out); |
446 | } | 446 | } |
447 | 447 | ||
448 | void il4965_init_sensitivity(struct il_priv *priv) | 448 | void il4965_init_sensitivity(struct il_priv *il) |
449 | { | 449 | { |
450 | int ret = 0; | 450 | int ret = 0; |
451 | int i; | 451 | int i; |
452 | struct il_sensitivity_data *data = NULL; | 452 | struct il_sensitivity_data *data = NULL; |
453 | const struct il_sensitivity_ranges *ranges = priv->hw_params.sens; | 453 | const struct il_sensitivity_ranges *ranges = il->hw_params.sens; |
454 | 454 | ||
455 | if (priv->disable_sens_cal) | 455 | if (il->disable_sens_cal) |
456 | return; | 456 | return; |
457 | 457 | ||
458 | IL_DEBUG_CALIB(priv, "Start il4965_init_sensitivity\n"); | 458 | IL_DEBUG_CALIB(il, "Start il4965_init_sensitivity\n"); |
459 | 459 | ||
460 | /* Clear driver's sensitivity algo data */ | 460 | /* Clear driver's sensitivity algo data */ |
461 | data = &(priv->sensitivity_data); | 461 | data = &(il->sensitivity_data); |
462 | 462 | ||
463 | if (ranges == NULL) | 463 | if (ranges == NULL) |
464 | return; | 464 | return; |
@@ -495,11 +495,11 @@ void il4965_init_sensitivity(struct il_priv *priv) | |||
495 | data->last_bad_plcp_cnt_cck = 0; | 495 | data->last_bad_plcp_cnt_cck = 0; |
496 | data->last_fa_cnt_cck = 0; | 496 | data->last_fa_cnt_cck = 0; |
497 | 497 | ||
498 | ret |= il4965_sensitivity_write(priv); | 498 | ret |= il4965_sensitivity_write(il); |
499 | IL_DEBUG_CALIB(priv, "<<return 0x%X\n", ret); | 499 | IL_DEBUG_CALIB(il, "<<return 0x%X\n", ret); |
500 | } | 500 | } |
501 | 501 | ||
502 | void il4965_sensitivity_calibration(struct il_priv *priv, void *resp) | 502 | void il4965_sensitivity_calibration(struct il_priv *il, void *resp) |
503 | { | 503 | { |
504 | u32 rx_enable_time; | 504 | u32 rx_enable_time; |
505 | u32 fa_cck; | 505 | u32 fa_cck; |
@@ -514,25 +514,25 @@ void il4965_sensitivity_calibration(struct il_priv *priv, void *resp) | |||
514 | unsigned long flags; | 514 | unsigned long flags; |
515 | struct statistics_general_data statis; | 515 | struct statistics_general_data statis; |
516 | 516 | ||
517 | if (priv->disable_sens_cal) | 517 | if (il->disable_sens_cal) |
518 | return; | 518 | return; |
519 | 519 | ||
520 | data = &(priv->sensitivity_data); | 520 | data = &(il->sensitivity_data); |
521 | 521 | ||
522 | if (!il_is_any_associated(priv)) { | 522 | if (!il_is_any_associated(il)) { |
523 | IL_DEBUG_CALIB(priv, "<< - not associated\n"); | 523 | IL_DEBUG_CALIB(il, "<< - not associated\n"); |
524 | return; | 524 | return; |
525 | } | 525 | } |
526 | 526 | ||
527 | spin_lock_irqsave(&priv->lock, flags); | 527 | spin_lock_irqsave(&il->lock, flags); |
528 | 528 | ||
529 | rx_info = &(((struct il_notif_statistics *)resp)->rx.general); | 529 | rx_info = &(((struct il_notif_statistics *)resp)->rx.general); |
530 | ofdm = &(((struct il_notif_statistics *)resp)->rx.ofdm); | 530 | ofdm = &(((struct il_notif_statistics *)resp)->rx.ofdm); |
531 | cck = &(((struct il_notif_statistics *)resp)->rx.cck); | 531 | cck = &(((struct il_notif_statistics *)resp)->rx.cck); |
532 | 532 | ||
533 | if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) { | 533 | if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) { |
534 | IL_DEBUG_CALIB(priv, "<< invalid data.\n"); | 534 | IL_DEBUG_CALIB(il, "<< invalid data.\n"); |
535 | spin_unlock_irqrestore(&priv->lock, flags); | 535 | spin_unlock_irqrestore(&il->lock, flags); |
536 | return; | 536 | return; |
537 | } | 537 | } |
538 | 538 | ||
@@ -556,12 +556,12 @@ void il4965_sensitivity_calibration(struct il_priv *priv, void *resp) | |||
556 | statis.beacon_energy_c = | 556 | statis.beacon_energy_c = |
557 | le32_to_cpu(rx_info->beacon_energy_c); | 557 | le32_to_cpu(rx_info->beacon_energy_c); |
558 | 558 | ||
559 | spin_unlock_irqrestore(&priv->lock, flags); | 559 | spin_unlock_irqrestore(&il->lock, flags); |
560 | 560 | ||
561 | IL_DEBUG_CALIB(priv, "rx_enable_time = %u usecs\n", rx_enable_time); | 561 | IL_DEBUG_CALIB(il, "rx_enable_time = %u usecs\n", rx_enable_time); |
562 | 562 | ||
563 | if (!rx_enable_time) { | 563 | if (!rx_enable_time) { |
564 | IL_DEBUG_CALIB(priv, "<< RX Enable Time == 0!\n"); | 564 | IL_DEBUG_CALIB(il, "<< RX Enable Time == 0!\n"); |
565 | return; | 565 | return; |
566 | } | 566 | } |
567 | 567 | ||
@@ -600,14 +600,14 @@ void il4965_sensitivity_calibration(struct il_priv *priv, void *resp) | |||
600 | norm_fa_ofdm = fa_ofdm + bad_plcp_ofdm; | 600 | norm_fa_ofdm = fa_ofdm + bad_plcp_ofdm; |
601 | norm_fa_cck = fa_cck + bad_plcp_cck; | 601 | norm_fa_cck = fa_cck + bad_plcp_cck; |
602 | 602 | ||
603 | IL_DEBUG_CALIB(priv, | 603 | IL_DEBUG_CALIB(il, |
604 | "cck: fa %u badp %u ofdm: fa %u badp %u\n", fa_cck, | 604 | "cck: fa %u badp %u ofdm: fa %u badp %u\n", fa_cck, |
605 | bad_plcp_cck, fa_ofdm, bad_plcp_ofdm); | 605 | bad_plcp_cck, fa_ofdm, bad_plcp_ofdm); |
606 | 606 | ||
607 | il4965_sens_auto_corr_ofdm(priv, norm_fa_ofdm, rx_enable_time); | 607 | il4965_sens_auto_corr_ofdm(il, norm_fa_ofdm, rx_enable_time); |
608 | il4965_sens_energy_cck(priv, norm_fa_cck, rx_enable_time, &statis); | 608 | il4965_sens_energy_cck(il, norm_fa_cck, rx_enable_time, &statis); |
609 | 609 | ||
610 | il4965_sensitivity_write(priv); | 610 | il4965_sensitivity_write(il); |
611 | } | 611 | } |
612 | 612 | ||
613 | static inline u8 il4965_find_first_chain(u8 mask) | 613 | static inline u8 il4965_find_first_chain(u8 mask) |
@@ -624,7 +624,7 @@ static inline u8 il4965_find_first_chain(u8 mask) | |||
624 | * disconnected. | 624 | * disconnected. |
625 | */ | 625 | */ |
626 | static void | 626 | static void |
627 | il4965_find_disconn_antenna(struct il_priv *priv, u32* average_sig, | 627 | il4965_find_disconn_antenna(struct il_priv *il, u32* average_sig, |
628 | struct il_chain_noise_data *data) | 628 | struct il_chain_noise_data *data) |
629 | { | 629 | { |
630 | u32 active_chains = 0; | 630 | u32 active_chains = 0; |
@@ -635,11 +635,11 @@ il4965_find_disconn_antenna(struct il_priv *priv, u32* average_sig, | |||
635 | u16 i = 0; | 635 | u16 i = 0; |
636 | 636 | ||
637 | average_sig[0] = data->chain_signal_a / | 637 | average_sig[0] = data->chain_signal_a / |
638 | priv->cfg->base_params->chain_noise_num_beacons; | 638 | il->cfg->base_params->chain_noise_num_beacons; |
639 | average_sig[1] = data->chain_signal_b / | 639 | average_sig[1] = data->chain_signal_b / |
640 | priv->cfg->base_params->chain_noise_num_beacons; | 640 | il->cfg->base_params->chain_noise_num_beacons; |
641 | average_sig[2] = data->chain_signal_c / | 641 | average_sig[2] = data->chain_signal_c / |
642 | priv->cfg->base_params->chain_noise_num_beacons; | 642 | il->cfg->base_params->chain_noise_num_beacons; |
643 | 643 | ||
644 | if (average_sig[0] >= average_sig[1]) { | 644 | if (average_sig[0] >= average_sig[1]) { |
645 | max_average_sig = average_sig[0]; | 645 | max_average_sig = average_sig[0]; |
@@ -657,9 +657,9 @@ il4965_find_disconn_antenna(struct il_priv *priv, u32* average_sig, | |||
657 | active_chains = (1 << max_average_sig_antenna_i); | 657 | active_chains = (1 << max_average_sig_antenna_i); |
658 | } | 658 | } |
659 | 659 | ||
660 | IL_DEBUG_CALIB(priv, "average_sig: a %d b %d c %d\n", | 660 | IL_DEBUG_CALIB(il, "average_sig: a %d b %d c %d\n", |
661 | average_sig[0], average_sig[1], average_sig[2]); | 661 | average_sig[0], average_sig[1], average_sig[2]); |
662 | IL_DEBUG_CALIB(priv, "max_average_sig = %d, antenna %d\n", | 662 | IL_DEBUG_CALIB(il, "max_average_sig = %d, antenna %d\n", |
663 | max_average_sig, max_average_sig_antenna_i); | 663 | max_average_sig, max_average_sig_antenna_i); |
664 | 664 | ||
665 | /* Compare signal strengths for all 3 receivers. */ | 665 | /* Compare signal strengths for all 3 receivers. */ |
@@ -673,7 +673,7 @@ il4965_find_disconn_antenna(struct il_priv *priv, u32* average_sig, | |||
673 | data->disconn_array[i] = 1; | 673 | data->disconn_array[i] = 1; |
674 | else | 674 | else |
675 | active_chains |= (1 << i); | 675 | active_chains |= (1 << i); |
676 | IL_DEBUG_CALIB(priv, "i = %d rssiDelta = %d " | 676 | IL_DEBUG_CALIB(il, "i = %d rssiDelta = %d " |
677 | "disconn_array[i] = %d\n", | 677 | "disconn_array[i] = %d\n", |
678 | i, rssi_delta, data->disconn_array[i]); | 678 | i, rssi_delta, data->disconn_array[i]); |
679 | } | 679 | } |
@@ -689,58 +689,58 @@ il4965_find_disconn_antenna(struct il_priv *priv, u32* average_sig, | |||
689 | * To be safe, simply mask out any chains that we know | 689 | * To be safe, simply mask out any chains that we know |
690 | * are not on the device. | 690 | * are not on the device. |
691 | */ | 691 | */ |
692 | active_chains &= priv->hw_params.valid_rx_ant; | 692 | active_chains &= il->hw_params.valid_rx_ant; |
693 | 693 | ||
694 | num_tx_chains = 0; | 694 | num_tx_chains = 0; |
695 | for (i = 0; i < NUM_RX_CHAINS; i++) { | 695 | for (i = 0; i < NUM_RX_CHAINS; i++) { |
696 | /* loops on all the bits of | 696 | /* loops on all the bits of |
697 | * priv->hw_setting.valid_tx_ant */ | 697 | * il->hw_setting.valid_tx_ant */ |
698 | u8 ant_msk = (1 << i); | 698 | u8 ant_msk = (1 << i); |
699 | if (!(priv->hw_params.valid_tx_ant & ant_msk)) | 699 | if (!(il->hw_params.valid_tx_ant & ant_msk)) |
700 | continue; | 700 | continue; |
701 | 701 | ||
702 | num_tx_chains++; | 702 | num_tx_chains++; |
703 | if (data->disconn_array[i] == 0) | 703 | if (data->disconn_array[i] == 0) |
704 | /* there is a Tx antenna connected */ | 704 | /* there is a Tx antenna connected */ |
705 | break; | 705 | break; |
706 | if (num_tx_chains == priv->hw_params.tx_chains_num && | 706 | if (num_tx_chains == il->hw_params.tx_chains_num && |
707 | data->disconn_array[i]) { | 707 | data->disconn_array[i]) { |
708 | /* | 708 | /* |
709 | * If all chains are disconnected | 709 | * If all chains are disconnected |
710 | * connect the first valid tx chain | 710 | * connect the first valid tx chain |
711 | */ | 711 | */ |
712 | first_chain = | 712 | first_chain = |
713 | il4965_find_first_chain(priv->cfg->valid_tx_ant); | 713 | il4965_find_first_chain(il->cfg->valid_tx_ant); |
714 | data->disconn_array[first_chain] = 0; | 714 | data->disconn_array[first_chain] = 0; |
715 | active_chains |= BIT(first_chain); | 715 | active_chains |= BIT(first_chain); |
716 | IL_DEBUG_CALIB(priv, | 716 | IL_DEBUG_CALIB(il, |
717 | "All Tx chains are disconnected W/A - declare %d as connected\n", | 717 | "All Tx chains are disconnected W/A - declare %d as connected\n", |
718 | first_chain); | 718 | first_chain); |
719 | break; | 719 | break; |
720 | } | 720 | } |
721 | } | 721 | } |
722 | 722 | ||
723 | if (active_chains != priv->hw_params.valid_rx_ant && | 723 | if (active_chains != il->hw_params.valid_rx_ant && |
724 | active_chains != priv->chain_noise_data.active_chains) | 724 | active_chains != il->chain_noise_data.active_chains) |
725 | IL_DEBUG_CALIB(priv, | 725 | IL_DEBUG_CALIB(il, |
726 | "Detected that not all antennas are connected! " | 726 | "Detected that not all antennas are connected! " |
727 | "Connected: %#x, valid: %#x.\n", | 727 | "Connected: %#x, valid: %#x.\n", |
728 | active_chains, priv->hw_params.valid_rx_ant); | 728 | active_chains, il->hw_params.valid_rx_ant); |
729 | 729 | ||
730 | /* Save for use within RXON, TX, SCAN commands, etc. */ | 730 | /* Save for use within RXON, TX, SCAN commands, etc. */ |
731 | data->active_chains = active_chains; | 731 | data->active_chains = active_chains; |
732 | IL_DEBUG_CALIB(priv, "active_chains (bitwise) = 0x%x\n", | 732 | IL_DEBUG_CALIB(il, "active_chains (bitwise) = 0x%x\n", |
733 | active_chains); | 733 | active_chains); |
734 | } | 734 | } |
735 | 735 | ||
736 | static void il4965_gain_computation(struct il_priv *priv, | 736 | static void il4965_gain_computation(struct il_priv *il, |
737 | u32 *average_noise, | 737 | u32 *average_noise, |
738 | u16 min_average_noise_antenna_i, | 738 | u16 min_average_noise_antenna_i, |
739 | u32 min_average_noise, | 739 | u32 min_average_noise, |
740 | u8 default_chain) | 740 | u8 default_chain) |
741 | { | 741 | { |
742 | int i, ret; | 742 | int i, ret; |
743 | struct il_chain_noise_data *data = &priv->chain_noise_data; | 743 | struct il_chain_noise_data *data = &il->chain_noise_data; |
744 | 744 | ||
745 | data->delta_gain_code[min_average_noise_antenna_i] = 0; | 745 | data->delta_gain_code[min_average_noise_antenna_i] = 0; |
746 | 746 | ||
@@ -762,7 +762,7 @@ static void il4965_gain_computation(struct il_priv *priv, | |||
762 | data->delta_gain_code[i] = 0; | 762 | data->delta_gain_code[i] = 0; |
763 | } | 763 | } |
764 | } | 764 | } |
765 | IL_DEBUG_CALIB(priv, "delta_gain_codes: a %d b %d c %d\n", | 765 | IL_DEBUG_CALIB(il, "delta_gain_codes: a %d b %d c %d\n", |
766 | data->delta_gain_code[0], | 766 | data->delta_gain_code[0], |
767 | data->delta_gain_code[1], | 767 | data->delta_gain_code[1], |
768 | data->delta_gain_code[2]); | 768 | data->delta_gain_code[2]); |
@@ -777,10 +777,10 @@ static void il4965_gain_computation(struct il_priv *priv, | |||
777 | cmd.diff_gain_a = data->delta_gain_code[0]; | 777 | cmd.diff_gain_a = data->delta_gain_code[0]; |
778 | cmd.diff_gain_b = data->delta_gain_code[1]; | 778 | cmd.diff_gain_b = data->delta_gain_code[1]; |
779 | cmd.diff_gain_c = data->delta_gain_code[2]; | 779 | cmd.diff_gain_c = data->delta_gain_code[2]; |
780 | ret = il_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, | 780 | ret = il_send_cmd_pdu(il, REPLY_PHY_CALIBRATION_CMD, |
781 | sizeof(cmd), &cmd); | 781 | sizeof(cmd), &cmd); |
782 | if (ret) | 782 | if (ret) |
783 | IL_DEBUG_CALIB(priv, "fail sending cmd " | 783 | IL_DEBUG_CALIB(il, "fail sending cmd " |
784 | "REPLY_PHY_CALIBRATION_CMD\n"); | 784 | "REPLY_PHY_CALIBRATION_CMD\n"); |
785 | 785 | ||
786 | /* TODO we might want recalculate | 786 | /* TODO we might want recalculate |
@@ -799,7 +799,7 @@ static void il4965_gain_computation(struct il_priv *priv, | |||
799 | * 1) Which antennas are connected. | 799 | * 1) Which antennas are connected. |
800 | * 2) Differential rx gain settings to balance the 3 receivers. | 800 | * 2) Differential rx gain settings to balance the 3 receivers. |
801 | */ | 801 | */ |
802 | void il4965_chain_noise_calibration(struct il_priv *priv, void *stat_resp) | 802 | void il4965_chain_noise_calibration(struct il_priv *il, void *stat_resp) |
803 | { | 803 | { |
804 | struct il_chain_noise_data *data = NULL; | 804 | struct il_chain_noise_data *data = NULL; |
805 | 805 | ||
@@ -821,12 +821,12 @@ void il4965_chain_noise_calibration(struct il_priv *priv, void *stat_resp) | |||
821 | unsigned long flags; | 821 | unsigned long flags; |
822 | struct statistics_rx_non_phy *rx_info; | 822 | struct statistics_rx_non_phy *rx_info; |
823 | 823 | ||
824 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 824 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
825 | 825 | ||
826 | if (priv->disable_chain_noise_cal) | 826 | if (il->disable_chain_noise_cal) |
827 | return; | 827 | return; |
828 | 828 | ||
829 | data = &(priv->chain_noise_data); | 829 | data = &(il->chain_noise_data); |
830 | 830 | ||
831 | /* | 831 | /* |
832 | * Accumulate just the first "chain_noise_num_beacons" after | 832 | * 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) | |||
834 | */ | 834 | */ |
835 | if (data->state != IL_CHAIN_NOISE_ACCUMULATE) { | 835 | if (data->state != IL_CHAIN_NOISE_ACCUMULATE) { |
836 | if (data->state == IL_CHAIN_NOISE_ALIVE) | 836 | if (data->state == IL_CHAIN_NOISE_ALIVE) |
837 | IL_DEBUG_CALIB(priv, "Wait for noise calib reset\n"); | 837 | IL_DEBUG_CALIB(il, "Wait for noise calib reset\n"); |
838 | return; | 838 | return; |
839 | } | 839 | } |
840 | 840 | ||
841 | spin_lock_irqsave(&priv->lock, flags); | 841 | spin_lock_irqsave(&il->lock, flags); |
842 | 842 | ||
843 | rx_info = &(((struct il_notif_statistics *)stat_resp)-> | 843 | rx_info = &(((struct il_notif_statistics *)stat_resp)-> |
844 | rx.general); | 844 | rx.general); |
845 | 845 | ||
846 | if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) { | 846 | if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) { |
847 | IL_DEBUG_CALIB(priv, " << Interference data unavailable\n"); | 847 | IL_DEBUG_CALIB(il, " << Interference data unavailable\n"); |
848 | spin_unlock_irqrestore(&priv->lock, flags); | 848 | spin_unlock_irqrestore(&il->lock, flags); |
849 | return; | 849 | return; |
850 | } | 850 | } |
851 | 851 | ||
@@ -861,9 +861,9 @@ void il4965_chain_noise_calibration(struct il_priv *priv, void *stat_resp) | |||
861 | /* Make sure we accumulate data for just the associated channel | 861 | /* Make sure we accumulate data for just the associated channel |
862 | * (even if scanning). */ | 862 | * (even if scanning). */ |
863 | if ((rxon_chnum != stat_chnum) || (rxon_band24 != stat_band24)) { | 863 | if ((rxon_chnum != stat_chnum) || (rxon_band24 != stat_band24)) { |
864 | IL_DEBUG_CALIB(priv, "Stats not from chan=%d, band24=%d\n", | 864 | IL_DEBUG_CALIB(il, "Stats not from chan=%d, band24=%d\n", |
865 | rxon_chnum, rxon_band24); | 865 | rxon_chnum, rxon_band24); |
866 | spin_unlock_irqrestore(&priv->lock, flags); | 866 | spin_unlock_irqrestore(&il->lock, flags); |
867 | return; | 867 | return; |
868 | } | 868 | } |
869 | 869 | ||
@@ -882,7 +882,7 @@ void il4965_chain_noise_calibration(struct il_priv *priv, void *stat_resp) | |||
882 | chain_sig_b = le32_to_cpu(rx_info->beacon_rssi_b) & IN_BAND_FILTER; | 882 | chain_sig_b = le32_to_cpu(rx_info->beacon_rssi_b) & IN_BAND_FILTER; |
883 | chain_sig_c = le32_to_cpu(rx_info->beacon_rssi_c) & IN_BAND_FILTER; | 883 | chain_sig_c = le32_to_cpu(rx_info->beacon_rssi_c) & IN_BAND_FILTER; |
884 | 884 | ||
885 | spin_unlock_irqrestore(&priv->lock, flags); | 885 | spin_unlock_irqrestore(&il->lock, flags); |
886 | 886 | ||
887 | data->beacon_count++; | 887 | data->beacon_count++; |
888 | 888 | ||
@@ -894,30 +894,30 @@ void il4965_chain_noise_calibration(struct il_priv *priv, void *stat_resp) | |||
894 | data->chain_signal_b = (chain_sig_b + data->chain_signal_b); | 894 | data->chain_signal_b = (chain_sig_b + data->chain_signal_b); |
895 | data->chain_signal_c = (chain_sig_c + data->chain_signal_c); | 895 | data->chain_signal_c = (chain_sig_c + data->chain_signal_c); |
896 | 896 | ||
897 | IL_DEBUG_CALIB(priv, "chan=%d, band24=%d, beacon=%d\n", | 897 | IL_DEBUG_CALIB(il, "chan=%d, band24=%d, beacon=%d\n", |
898 | rxon_chnum, rxon_band24, data->beacon_count); | 898 | rxon_chnum, rxon_band24, data->beacon_count); |
899 | IL_DEBUG_CALIB(priv, "chain_sig: a %d b %d c %d\n", | 899 | IL_DEBUG_CALIB(il, "chain_sig: a %d b %d c %d\n", |
900 | chain_sig_a, chain_sig_b, chain_sig_c); | 900 | chain_sig_a, chain_sig_b, chain_sig_c); |
901 | IL_DEBUG_CALIB(priv, "chain_noise: a %d b %d c %d\n", | 901 | IL_DEBUG_CALIB(il, "chain_noise: a %d b %d c %d\n", |
902 | chain_noise_a, chain_noise_b, chain_noise_c); | 902 | chain_noise_a, chain_noise_b, chain_noise_c); |
903 | 903 | ||
904 | /* If this is the "chain_noise_num_beacons", determine: | 904 | /* If this is the "chain_noise_num_beacons", determine: |
905 | * 1) Disconnected antennas (using signal strengths) | 905 | * 1) Disconnected antennas (using signal strengths) |
906 | * 2) Differential gain (using silence noise) to balance receivers */ | 906 | * 2) Differential gain (using silence noise) to balance receivers */ |
907 | if (data->beacon_count != | 907 | if (data->beacon_count != |
908 | priv->cfg->base_params->chain_noise_num_beacons) | 908 | il->cfg->base_params->chain_noise_num_beacons) |
909 | return; | 909 | return; |
910 | 910 | ||
911 | /* Analyze signal for disconnected antenna */ | 911 | /* Analyze signal for disconnected antenna */ |
912 | il4965_find_disconn_antenna(priv, average_sig, data); | 912 | il4965_find_disconn_antenna(il, average_sig, data); |
913 | 913 | ||
914 | /* Analyze noise for rx balance */ | 914 | /* Analyze noise for rx balance */ |
915 | average_noise[0] = data->chain_noise_a / | 915 | average_noise[0] = data->chain_noise_a / |
916 | priv->cfg->base_params->chain_noise_num_beacons; | 916 | il->cfg->base_params->chain_noise_num_beacons; |
917 | average_noise[1] = data->chain_noise_b / | 917 | average_noise[1] = data->chain_noise_b / |
918 | priv->cfg->base_params->chain_noise_num_beacons; | 918 | il->cfg->base_params->chain_noise_num_beacons; |
919 | average_noise[2] = data->chain_noise_c / | 919 | average_noise[2] = data->chain_noise_c / |
920 | priv->cfg->base_params->chain_noise_num_beacons; | 920 | il->cfg->base_params->chain_noise_num_beacons; |
921 | 921 | ||
922 | for (i = 0; i < NUM_RX_CHAINS; i++) { | 922 | for (i = 0; i < NUM_RX_CHAINS; i++) { |
923 | if (!(data->disconn_array[i]) && | 923 | if (!(data->disconn_array[i]) && |
@@ -929,39 +929,39 @@ void il4965_chain_noise_calibration(struct il_priv *priv, void *stat_resp) | |||
929 | } | 929 | } |
930 | } | 930 | } |
931 | 931 | ||
932 | IL_DEBUG_CALIB(priv, "average_noise: a %d b %d c %d\n", | 932 | IL_DEBUG_CALIB(il, "average_noise: a %d b %d c %d\n", |
933 | average_noise[0], average_noise[1], | 933 | average_noise[0], average_noise[1], |
934 | average_noise[2]); | 934 | average_noise[2]); |
935 | 935 | ||
936 | IL_DEBUG_CALIB(priv, "min_average_noise = %d, antenna %d\n", | 936 | IL_DEBUG_CALIB(il, "min_average_noise = %d, antenna %d\n", |
937 | min_average_noise, min_average_noise_antenna_i); | 937 | min_average_noise, min_average_noise_antenna_i); |
938 | 938 | ||
939 | il4965_gain_computation(priv, average_noise, | 939 | il4965_gain_computation(il, average_noise, |
940 | min_average_noise_antenna_i, min_average_noise, | 940 | min_average_noise_antenna_i, min_average_noise, |
941 | il4965_find_first_chain(priv->cfg->valid_rx_ant)); | 941 | il4965_find_first_chain(il->cfg->valid_rx_ant)); |
942 | 942 | ||
943 | /* Some power changes may have been made during the calibration. | 943 | /* Some power changes may have been made during the calibration. |
944 | * Update and commit the RXON | 944 | * Update and commit the RXON |
945 | */ | 945 | */ |
946 | if (priv->cfg->ops->lib->update_chain_flags) | 946 | if (il->cfg->ops->lib->update_chain_flags) |
947 | priv->cfg->ops->lib->update_chain_flags(priv); | 947 | il->cfg->ops->lib->update_chain_flags(il); |
948 | 948 | ||
949 | data->state = IL_CHAIN_NOISE_DONE; | 949 | data->state = IL_CHAIN_NOISE_DONE; |
950 | il_power_update_mode(priv, false); | 950 | il_power_update_mode(il, false); |
951 | } | 951 | } |
952 | 952 | ||
953 | void il4965_reset_run_time_calib(struct il_priv *priv) | 953 | void il4965_reset_run_time_calib(struct il_priv *il) |
954 | { | 954 | { |
955 | int i; | 955 | int i; |
956 | memset(&(priv->sensitivity_data), 0, | 956 | memset(&(il->sensitivity_data), 0, |
957 | sizeof(struct il_sensitivity_data)); | 957 | sizeof(struct il_sensitivity_data)); |
958 | memset(&(priv->chain_noise_data), 0, | 958 | memset(&(il->chain_noise_data), 0, |
959 | sizeof(struct il_chain_noise_data)); | 959 | sizeof(struct il_chain_noise_data)); |
960 | for (i = 0; i < NUM_RX_CHAINS; i++) | 960 | for (i = 0; i < NUM_RX_CHAINS; i++) |
961 | priv->chain_noise_data.delta_gain_code[i] = | 961 | il->chain_noise_data.delta_gain_code[i] = |
962 | CHAIN_NOISE_DELTA_GAIN_INIT_VAL; | 962 | CHAIN_NOISE_DELTA_GAIN_INIT_VAL; |
963 | 963 | ||
964 | /* Ask for statistics now, the uCode will send notification | 964 | /* Ask for statistics now, the uCode will send notification |
965 | * periodically after association */ | 965 | * periodically after association */ |
966 | il_send_statistics_request(priv, CMD_ASYNC, true); | 966 | il_send_statistics_request(il, CMD_ASYNC, true); |
967 | } | 967 | } |
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-calib.h b/drivers/net/wireless/iwlegacy/iwl-4965-calib.h index a23081f1d03..0e30ea7ff12 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-calib.h +++ b/drivers/net/wireless/iwlegacy/iwl-4965-calib.h | |||
@@ -66,10 +66,10 @@ | |||
66 | #include "iwl-core.h" | 66 | #include "iwl-core.h" |
67 | #include "iwl-commands.h" | 67 | #include "iwl-commands.h" |
68 | 68 | ||
69 | void il4965_chain_noise_calibration(struct il_priv *priv, void *stat_resp); | 69 | void il4965_chain_noise_calibration(struct il_priv *il, void *stat_resp); |
70 | void il4965_sensitivity_calibration(struct il_priv *priv, void *resp); | 70 | void il4965_sensitivity_calibration(struct il_priv *il, void *resp); |
71 | void il4965_init_sensitivity(struct il_priv *priv); | 71 | void il4965_init_sensitivity(struct il_priv *il); |
72 | void il4965_reset_run_time_calib(struct il_priv *priv); | 72 | void il4965_reset_run_time_calib(struct il_priv *il); |
73 | void il4965_calib_free_results(struct il_priv *priv); | 73 | void il4965_calib_free_results(struct il_priv *il); |
74 | 74 | ||
75 | #endif /* __il_4965_calib_h__ */ | 75 | #endif /* __il_4965_calib_h__ */ |
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c b/drivers/net/wireless/iwlegacy/iwl-4965-debugfs.c index 3c2876ffadc..8ea0ac205f7 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"; | |||
33 | static const char *fmt_header = | 33 | static const char *fmt_header = |
34 | "%-32s current cumulative delta max\n"; | 34 | "%-32s current cumulative delta max\n"; |
35 | 35 | ||
36 | static int il4965_statistics_flag(struct il_priv *priv, char *buf, int bufsz) | 36 | static int il4965_statistics_flag(struct il_priv *il, char *buf, int bufsz) |
37 | { | 37 | { |
38 | int p = 0; | 38 | int p = 0; |
39 | u32 flag; | 39 | u32 flag; |
40 | 40 | ||
41 | flag = le32_to_cpu(priv->_4965.statistics.flag); | 41 | flag = le32_to_cpu(il->_4965.statistics.flag); |
42 | 42 | ||
43 | p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n", flag); | 43 | p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n", flag); |
44 | if (flag & UCODE_STATISTICS_CLEAR_MSK) | 44 | if (flag & UCODE_STATISTICS_CLEAR_MSK) |
@@ -57,7 +57,7 @@ static int il4965_statistics_flag(struct il_priv *priv, char *buf, int bufsz) | |||
57 | ssize_t il4965_ucode_rx_stats_read(struct file *file, char __user *user_buf, | 57 | ssize_t il4965_ucode_rx_stats_read(struct file *file, char __user *user_buf, |
58 | size_t count, loff_t *ppos) | 58 | size_t count, loff_t *ppos) |
59 | { | 59 | { |
60 | struct il_priv *priv = file->private_data; | 60 | struct il_priv *il = file->private_data; |
61 | int pos = 0; | 61 | int pos = 0; |
62 | char *buf; | 62 | char *buf; |
63 | int bufsz = sizeof(struct statistics_rx_phy) * 40 + | 63 | int bufsz = sizeof(struct statistics_rx_phy) * 40 + |
@@ -70,12 +70,12 @@ ssize_t il4965_ucode_rx_stats_read(struct file *file, char __user *user_buf, | |||
70 | struct statistics_rx_non_phy *delta_general, *max_general; | 70 | struct statistics_rx_non_phy *delta_general, *max_general; |
71 | struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht; | 71 | struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht; |
72 | 72 | ||
73 | if (!il_is_alive(priv)) | 73 | if (!il_is_alive(il)) |
74 | return -EAGAIN; | 74 | return -EAGAIN; |
75 | 75 | ||
76 | buf = kzalloc(bufsz, GFP_KERNEL); | 76 | buf = kzalloc(bufsz, GFP_KERNEL); |
77 | if (!buf) { | 77 | if (!buf) { |
78 | IL_ERR(priv, "Can not allocate Buffer\n"); | 78 | IL_ERR(il, "Can not allocate Buffer\n"); |
79 | return -ENOMEM; | 79 | return -ENOMEM; |
80 | } | 80 | } |
81 | 81 | ||
@@ -84,24 +84,24 @@ ssize_t il4965_ucode_rx_stats_read(struct file *file, char __user *user_buf, | |||
84 | * the last statistics notification from uCode | 84 | * the last statistics notification from uCode |
85 | * might not reflect the current uCode activity | 85 | * might not reflect the current uCode activity |
86 | */ | 86 | */ |
87 | ofdm = &priv->_4965.statistics.rx.ofdm; | 87 | ofdm = &il->_4965.statistics.rx.ofdm; |
88 | cck = &priv->_4965.statistics.rx.cck; | 88 | cck = &il->_4965.statistics.rx.cck; |
89 | general = &priv->_4965.statistics.rx.general; | 89 | general = &il->_4965.statistics.rx.general; |
90 | ht = &priv->_4965.statistics.rx.ofdm_ht; | 90 | ht = &il->_4965.statistics.rx.ofdm_ht; |
91 | accum_ofdm = &priv->_4965.accum_statistics.rx.ofdm; | 91 | accum_ofdm = &il->_4965.accum_statistics.rx.ofdm; |
92 | accum_cck = &priv->_4965.accum_statistics.rx.cck; | 92 | accum_cck = &il->_4965.accum_statistics.rx.cck; |
93 | accum_general = &priv->_4965.accum_statistics.rx.general; | 93 | accum_general = &il->_4965.accum_statistics.rx.general; |
94 | accum_ht = &priv->_4965.accum_statistics.rx.ofdm_ht; | 94 | accum_ht = &il->_4965.accum_statistics.rx.ofdm_ht; |
95 | delta_ofdm = &priv->_4965.delta_statistics.rx.ofdm; | 95 | delta_ofdm = &il->_4965.delta_statistics.rx.ofdm; |
96 | delta_cck = &priv->_4965.delta_statistics.rx.cck; | 96 | delta_cck = &il->_4965.delta_statistics.rx.cck; |
97 | delta_general = &priv->_4965.delta_statistics.rx.general; | 97 | delta_general = &il->_4965.delta_statistics.rx.general; |
98 | delta_ht = &priv->_4965.delta_statistics.rx.ofdm_ht; | 98 | delta_ht = &il->_4965.delta_statistics.rx.ofdm_ht; |
99 | max_ofdm = &priv->_4965.max_delta.rx.ofdm; | 99 | max_ofdm = &il->_4965.max_delta.rx.ofdm; |
100 | max_cck = &priv->_4965.max_delta.rx.cck; | 100 | max_cck = &il->_4965.max_delta.rx.cck; |
101 | max_general = &priv->_4965.max_delta.rx.general; | 101 | max_general = &il->_4965.max_delta.rx.general; |
102 | max_ht = &priv->_4965.max_delta.rx.ofdm_ht; | 102 | max_ht = &il->_4965.max_delta.rx.ofdm_ht; |
103 | 103 | ||
104 | pos += il4965_statistics_flag(priv, buf, bufsz); | 104 | pos += il4965_statistics_flag(il, buf, bufsz); |
105 | pos += scnprintf(buf + pos, bufsz - pos, | 105 | pos += scnprintf(buf + pos, bufsz - pos, |
106 | fmt_header, "Statistics_Rx - OFDM:"); | 106 | fmt_header, "Statistics_Rx - OFDM:"); |
107 | pos += scnprintf(buf + pos, bufsz - pos, | 107 | pos += scnprintf(buf + pos, bufsz - pos, |
@@ -489,19 +489,19 @@ ssize_t il4965_ucode_tx_stats_read(struct file *file, | |||
489 | char __user *user_buf, | 489 | char __user *user_buf, |
490 | size_t count, loff_t *ppos) | 490 | size_t count, loff_t *ppos) |
491 | { | 491 | { |
492 | struct il_priv *priv = file->private_data; | 492 | struct il_priv *il = file->private_data; |
493 | int pos = 0; | 493 | int pos = 0; |
494 | char *buf; | 494 | char *buf; |
495 | int bufsz = (sizeof(struct statistics_tx) * 48) + 250; | 495 | int bufsz = (sizeof(struct statistics_tx) * 48) + 250; |
496 | ssize_t ret; | 496 | ssize_t ret; |
497 | struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx; | 497 | struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx; |
498 | 498 | ||
499 | if (!il_is_alive(priv)) | 499 | if (!il_is_alive(il)) |
500 | return -EAGAIN; | 500 | return -EAGAIN; |
501 | 501 | ||
502 | buf = kzalloc(bufsz, GFP_KERNEL); | 502 | buf = kzalloc(bufsz, GFP_KERNEL); |
503 | if (!buf) { | 503 | if (!buf) { |
504 | IL_ERR(priv, "Can not allocate Buffer\n"); | 504 | IL_ERR(il, "Can not allocate Buffer\n"); |
505 | return -ENOMEM; | 505 | return -ENOMEM; |
506 | } | 506 | } |
507 | 507 | ||
@@ -509,12 +509,12 @@ ssize_t il4965_ucode_tx_stats_read(struct file *file, | |||
509 | * the last statistics notification from uCode | 509 | * the last statistics notification from uCode |
510 | * might not reflect the current uCode activity | 510 | * might not reflect the current uCode activity |
511 | */ | 511 | */ |
512 | tx = &priv->_4965.statistics.tx; | 512 | tx = &il->_4965.statistics.tx; |
513 | accum_tx = &priv->_4965.accum_statistics.tx; | 513 | accum_tx = &il->_4965.accum_statistics.tx; |
514 | delta_tx = &priv->_4965.delta_statistics.tx; | 514 | delta_tx = &il->_4965.delta_statistics.tx; |
515 | max_tx = &priv->_4965.max_delta.tx; | 515 | max_tx = &il->_4965.max_delta.tx; |
516 | 516 | ||
517 | pos += il4965_statistics_flag(priv, buf, bufsz); | 517 | pos += il4965_statistics_flag(il, buf, bufsz); |
518 | pos += scnprintf(buf + pos, bufsz - pos, | 518 | pos += scnprintf(buf + pos, bufsz - pos, |
519 | fmt_header, "Statistics_Tx:"); | 519 | fmt_header, "Statistics_Tx:"); |
520 | pos += scnprintf(buf + pos, bufsz - pos, | 520 | pos += scnprintf(buf + pos, bufsz - pos, |
@@ -664,7 +664,7 @@ ssize_t | |||
664 | il4965_ucode_general_stats_read(struct file *file, char __user *user_buf, | 664 | il4965_ucode_general_stats_read(struct file *file, char __user *user_buf, |
665 | size_t count, loff_t *ppos) | 665 | size_t count, loff_t *ppos) |
666 | { | 666 | { |
667 | struct il_priv *priv = file->private_data; | 667 | struct il_priv *il = file->private_data; |
668 | int pos = 0; | 668 | int pos = 0; |
669 | char *buf; | 669 | char *buf; |
670 | int bufsz = sizeof(struct statistics_general) * 10 + 300; | 670 | int bufsz = sizeof(struct statistics_general) * 10 + 300; |
@@ -674,12 +674,12 @@ il4965_ucode_general_stats_read(struct file *file, char __user *user_buf, | |||
674 | struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg; | 674 | struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg; |
675 | struct statistics_div *div, *accum_div, *delta_div, *max_div; | 675 | struct statistics_div *div, *accum_div, *delta_div, *max_div; |
676 | 676 | ||
677 | if (!il_is_alive(priv)) | 677 | if (!il_is_alive(il)) |
678 | return -EAGAIN; | 678 | return -EAGAIN; |
679 | 679 | ||
680 | buf = kzalloc(bufsz, GFP_KERNEL); | 680 | buf = kzalloc(bufsz, GFP_KERNEL); |
681 | if (!buf) { | 681 | if (!buf) { |
682 | IL_ERR(priv, "Can not allocate Buffer\n"); | 682 | IL_ERR(il, "Can not allocate Buffer\n"); |
683 | return -ENOMEM; | 683 | return -ENOMEM; |
684 | } | 684 | } |
685 | 685 | ||
@@ -687,20 +687,20 @@ il4965_ucode_general_stats_read(struct file *file, char __user *user_buf, | |||
687 | * the last statistics notification from uCode | 687 | * the last statistics notification from uCode |
688 | * might not reflect the current uCode activity | 688 | * might not reflect the current uCode activity |
689 | */ | 689 | */ |
690 | general = &priv->_4965.statistics.general.common; | 690 | general = &il->_4965.statistics.general.common; |
691 | dbg = &priv->_4965.statistics.general.common.dbg; | 691 | dbg = &il->_4965.statistics.general.common.dbg; |
692 | div = &priv->_4965.statistics.general.common.div; | 692 | div = &il->_4965.statistics.general.common.div; |
693 | accum_general = &priv->_4965.accum_statistics.general.common; | 693 | accum_general = &il->_4965.accum_statistics.general.common; |
694 | accum_dbg = &priv->_4965.accum_statistics.general.common.dbg; | 694 | accum_dbg = &il->_4965.accum_statistics.general.common.dbg; |
695 | accum_div = &priv->_4965.accum_statistics.general.common.div; | 695 | accum_div = &il->_4965.accum_statistics.general.common.div; |
696 | delta_general = &priv->_4965.delta_statistics.general.common; | 696 | delta_general = &il->_4965.delta_statistics.general.common; |
697 | max_general = &priv->_4965.max_delta.general.common; | 697 | max_general = &il->_4965.max_delta.general.common; |
698 | delta_dbg = &priv->_4965.delta_statistics.general.common.dbg; | 698 | delta_dbg = &il->_4965.delta_statistics.general.common.dbg; |
699 | max_dbg = &priv->_4965.max_delta.general.common.dbg; | 699 | max_dbg = &il->_4965.max_delta.general.common.dbg; |
700 | delta_div = &priv->_4965.delta_statistics.general.common.div; | 700 | delta_div = &il->_4965.delta_statistics.general.common.div; |
701 | max_div = &priv->_4965.max_delta.general.common.div; | 701 | max_div = &il->_4965.max_delta.general.common.div; |
702 | 702 | ||
703 | pos += il4965_statistics_flag(priv, buf, bufsz); | 703 | pos += il4965_statistics_flag(il, buf, bufsz); |
704 | pos += scnprintf(buf + pos, bufsz - pos, | 704 | pos += scnprintf(buf + pos, bufsz - pos, |
705 | fmt_header, "Statistics_General:"); | 705 | fmt_header, "Statistics_General:"); |
706 | pos += scnprintf(buf + pos, bufsz - pos, | 706 | pos += scnprintf(buf + pos, bufsz - pos, |
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c b/drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c index e657b444cf4..947475ea3ce 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c | |||
@@ -87,23 +87,23 @@ | |||
87 | * EEPROM chip, not a single event, so even reads could conflict if they | 87 | * EEPROM chip, not a single event, so even reads could conflict if they |
88 | * weren't arbitrated by the semaphore. | 88 | * weren't arbitrated by the semaphore. |
89 | */ | 89 | */ |
90 | int il4965_eeprom_acquire_semaphore(struct il_priv *priv) | 90 | int il4965_eeprom_acquire_semaphore(struct il_priv *il) |
91 | { | 91 | { |
92 | u16 count; | 92 | u16 count; |
93 | int ret; | 93 | int ret; |
94 | 94 | ||
95 | for (count = 0; count < EEPROM_SEM_RETRY_LIMIT; count++) { | 95 | for (count = 0; count < EEPROM_SEM_RETRY_LIMIT; count++) { |
96 | /* Request semaphore */ | 96 | /* Request semaphore */ |
97 | il_set_bit(priv, CSR_HW_IF_CONFIG_REG, | 97 | il_set_bit(il, CSR_HW_IF_CONFIG_REG, |
98 | CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM); | 98 | CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM); |
99 | 99 | ||
100 | /* See if we got it */ | 100 | /* See if we got it */ |
101 | ret = il_poll_bit(priv, CSR_HW_IF_CONFIG_REG, | 101 | ret = il_poll_bit(il, CSR_HW_IF_CONFIG_REG, |
102 | CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM, | 102 | CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM, |
103 | CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM, | 103 | CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM, |
104 | EEPROM_SEM_TIMEOUT); | 104 | EEPROM_SEM_TIMEOUT); |
105 | if (ret >= 0) { | 105 | if (ret >= 0) { |
106 | IL_DEBUG_IO(priv, | 106 | IL_DEBUG_IO(il, |
107 | "Acquired semaphore after %d tries.\n", | 107 | "Acquired semaphore after %d tries.\n", |
108 | count+1); | 108 | count+1); |
109 | return ret; | 109 | return ret; |
@@ -113,42 +113,42 @@ int il4965_eeprom_acquire_semaphore(struct il_priv *priv) | |||
113 | return ret; | 113 | return ret; |
114 | } | 114 | } |
115 | 115 | ||
116 | void il4965_eeprom_release_semaphore(struct il_priv *priv) | 116 | void il4965_eeprom_release_semaphore(struct il_priv *il) |
117 | { | 117 | { |
118 | il_clear_bit(priv, CSR_HW_IF_CONFIG_REG, | 118 | il_clear_bit(il, CSR_HW_IF_CONFIG_REG, |
119 | CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM); | 119 | CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM); |
120 | 120 | ||
121 | } | 121 | } |
122 | 122 | ||
123 | int il4965_eeprom_check_version(struct il_priv *priv) | 123 | int il4965_eeprom_check_version(struct il_priv *il) |
124 | { | 124 | { |
125 | u16 eeprom_ver; | 125 | u16 eeprom_ver; |
126 | u16 calib_ver; | 126 | u16 calib_ver; |
127 | 127 | ||
128 | eeprom_ver = il_eeprom_query16(priv, EEPROM_VERSION); | 128 | eeprom_ver = il_eeprom_query16(il, EEPROM_VERSION); |
129 | calib_ver = il_eeprom_query16(priv, | 129 | calib_ver = il_eeprom_query16(il, |
130 | EEPROM_4965_CALIB_VERSION_OFFSET); | 130 | EEPROM_4965_CALIB_VERSION_OFFSET); |
131 | 131 | ||
132 | if (eeprom_ver < priv->cfg->eeprom_ver || | 132 | if (eeprom_ver < il->cfg->eeprom_ver || |
133 | calib_ver < priv->cfg->eeprom_calib_ver) | 133 | calib_ver < il->cfg->eeprom_calib_ver) |
134 | goto err; | 134 | goto err; |
135 | 135 | ||
136 | IL_INFO(priv, "device EEPROM VER=0x%x, CALIB=0x%x\n", | 136 | IL_INFO(il, "device EEPROM VER=0x%x, CALIB=0x%x\n", |
137 | eeprom_ver, calib_ver); | 137 | eeprom_ver, calib_ver); |
138 | 138 | ||
139 | return 0; | 139 | return 0; |
140 | err: | 140 | err: |
141 | IL_ERR(priv, "Unsupported (too old) EEPROM VER=0x%x < 0x%x " | 141 | IL_ERR(il, "Unsupported (too old) EEPROM VER=0x%x < 0x%x " |
142 | "CALIB=0x%x < 0x%x\n", | 142 | "CALIB=0x%x < 0x%x\n", |
143 | eeprom_ver, priv->cfg->eeprom_ver, | 143 | eeprom_ver, il->cfg->eeprom_ver, |
144 | calib_ver, priv->cfg->eeprom_calib_ver); | 144 | calib_ver, il->cfg->eeprom_calib_ver); |
145 | return -EINVAL; | 145 | return -EINVAL; |
146 | 146 | ||
147 | } | 147 | } |
148 | 148 | ||
149 | void il4965_eeprom_get_mac(const struct il_priv *priv, u8 *mac) | 149 | void il4965_eeprom_get_mac(const struct il_priv *il, u8 *mac) |
150 | { | 150 | { |
151 | const u8 *addr = il_eeprom_query_addr(priv, | 151 | const u8 *addr = il_eeprom_query_addr(il, |
152 | EEPROM_MAC_ADDRESS); | 152 | EEPROM_MAC_ADDRESS); |
153 | memcpy(mac, addr, ETH_ALEN); | 153 | memcpy(mac, addr, ETH_ALEN); |
154 | } | 154 | } |
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-led.c b/drivers/net/wireless/iwlegacy/iwl-4965-led.c index d2c8eacd683..1436a1b7ebf 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-led.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-led.c | |||
@@ -44,7 +44,7 @@ | |||
44 | 44 | ||
45 | /* Send led command */ | 45 | /* Send led command */ |
46 | static int | 46 | static int |
47 | il4965_send_led_cmd(struct il_priv *priv, struct il_led_cmd *led_cmd) | 47 | il4965_send_led_cmd(struct il_priv *il, struct il_led_cmd *led_cmd) |
48 | { | 48 | { |
49 | struct il_host_cmd cmd = { | 49 | struct il_host_cmd cmd = { |
50 | .id = REPLY_LEDS_CMD, | 50 | .id = REPLY_LEDS_CMD, |
@@ -55,17 +55,17 @@ il4965_send_led_cmd(struct il_priv *priv, struct il_led_cmd *led_cmd) | |||
55 | }; | 55 | }; |
56 | u32 reg; | 56 | u32 reg; |
57 | 57 | ||
58 | reg = il_read32(priv, CSR_LED_REG); | 58 | reg = il_read32(il, CSR_LED_REG); |
59 | if (reg != (reg & CSR_LED_BSM_CTRL_MSK)) | 59 | if (reg != (reg & CSR_LED_BSM_CTRL_MSK)) |
60 | il_write32(priv, CSR_LED_REG, reg & CSR_LED_BSM_CTRL_MSK); | 60 | il_write32(il, CSR_LED_REG, reg & CSR_LED_BSM_CTRL_MSK); |
61 | 61 | ||
62 | return il_send_cmd(priv, &cmd); | 62 | return il_send_cmd(il, &cmd); |
63 | } | 63 | } |
64 | 64 | ||
65 | /* Set led register off */ | 65 | /* Set led register off */ |
66 | void il4965_led_enable(struct il_priv *priv) | 66 | void il4965_led_enable(struct il_priv *il) |
67 | { | 67 | { |
68 | il_write32(priv, CSR_LED_REG, CSR_LED_REG_TRUN_ON); | 68 | il_write32(il, CSR_LED_REG, CSR_LED_REG_TRUN_ON); |
69 | } | 69 | } |
70 | 70 | ||
71 | const struct il_led_ops il4965_led_ops = { | 71 | 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 ab03dff812f..e804fe16cae 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-led.h +++ b/drivers/net/wireless/iwlegacy/iwl-4965-led.h | |||
@@ -28,6 +28,6 @@ | |||
28 | #define __il_4965_led_h__ | 28 | #define __il_4965_led_h__ |
29 | 29 | ||
30 | extern const struct il_led_ops il4965_led_ops; | 30 | extern const struct il_led_ops il4965_led_ops; |
31 | void il4965_led_enable(struct il_priv *priv); | 31 | void il4965_led_enable(struct il_priv *il); |
32 | 32 | ||
33 | #endif /* __il_4965_led_h__ */ | 33 | #endif /* __il_4965_led_h__ */ |
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c index 25f1d4768e7..4d25590b033 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c | |||
@@ -40,13 +40,13 @@ | |||
40 | #include "iwl-4965.h" | 40 | #include "iwl-4965.h" |
41 | #include "iwl-sta.h" | 41 | #include "iwl-sta.h" |
42 | 42 | ||
43 | void il4965_check_abort_status(struct il_priv *priv, | 43 | void il4965_check_abort_status(struct il_priv *il, |
44 | u8 frame_count, u32 status) | 44 | u8 frame_count, u32 status) |
45 | { | 45 | { |
46 | if (frame_count == 1 && status == TX_STATUS_FAIL_RFKILL_FLUSH) { | 46 | if (frame_count == 1 && status == TX_STATUS_FAIL_RFKILL_FLUSH) { |
47 | IL_ERR(priv, "Tx flush command to flush out all frames\n"); | 47 | IL_ERR(il, "Tx flush command to flush out all frames\n"); |
48 | if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) | 48 | if (!test_bit(STATUS_EXIT_PENDING, &il->status)) |
49 | queue_work(priv->workqueue, &priv->tx_flush); | 49 | queue_work(il->workqueue, &il->tx_flush); |
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
@@ -59,7 +59,7 @@ struct il_mod_params il4965_mod_params = { | |||
59 | /* the rest are 0 by default */ | 59 | /* the rest are 0 by default */ |
60 | }; | 60 | }; |
61 | 61 | ||
62 | void il4965_rx_queue_reset(struct il_priv *priv, struct il_rx_queue *rxq) | 62 | void il4965_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq) |
63 | { | 63 | { |
64 | unsigned long flags; | 64 | unsigned long flags; |
65 | int i; | 65 | int i; |
@@ -71,10 +71,10 @@ void il4965_rx_queue_reset(struct il_priv *priv, struct il_rx_queue *rxq) | |||
71 | /* In the reset function, these buffers may have been allocated | 71 | /* In the reset function, these buffers may have been allocated |
72 | * to an SKB, so we need to unmap and free potential storage */ | 72 | * to an SKB, so we need to unmap and free potential storage */ |
73 | if (rxq->pool[i].page != NULL) { | 73 | if (rxq->pool[i].page != NULL) { |
74 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 74 | pci_unmap_page(il->pci_dev, rxq->pool[i].page_dma, |
75 | PAGE_SIZE << priv->hw_params.rx_page_order, | 75 | PAGE_SIZE << il->hw_params.rx_page_order, |
76 | PCI_DMA_FROMDEVICE); | 76 | PCI_DMA_FROMDEVICE); |
77 | __il_free_pages(priv, rxq->pool[i].page); | 77 | __il_free_pages(il, rxq->pool[i].page); |
78 | rxq->pool[i].page = NULL; | 78 | rxq->pool[i].page = NULL; |
79 | } | 79 | } |
80 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); | 80 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); |
@@ -91,29 +91,29 @@ void il4965_rx_queue_reset(struct il_priv *priv, struct il_rx_queue *rxq) | |||
91 | spin_unlock_irqrestore(&rxq->lock, flags); | 91 | spin_unlock_irqrestore(&rxq->lock, flags); |
92 | } | 92 | } |
93 | 93 | ||
94 | int il4965_rx_init(struct il_priv *priv, struct il_rx_queue *rxq) | 94 | int il4965_rx_init(struct il_priv *il, struct il_rx_queue *rxq) |
95 | { | 95 | { |
96 | u32 rb_size; | 96 | u32 rb_size; |
97 | const u32 rfdnlog = RX_QUEUE_SIZE_LOG; /* 256 RBDs */ | 97 | const u32 rfdnlog = RX_QUEUE_SIZE_LOG; /* 256 RBDs */ |
98 | u32 rb_timeout = 0; | 98 | u32 rb_timeout = 0; |
99 | 99 | ||
100 | if (priv->cfg->mod_params->amsdu_size_8K) | 100 | if (il->cfg->mod_params->amsdu_size_8K) |
101 | rb_size = FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_8K; | 101 | rb_size = FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_8K; |
102 | else | 102 | else |
103 | rb_size = FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K; | 103 | rb_size = FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K; |
104 | 104 | ||
105 | /* Stop Rx DMA */ | 105 | /* Stop Rx DMA */ |
106 | il_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); | 106 | il_write_direct32(il, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); |
107 | 107 | ||
108 | /* Reset driver's Rx queue write index */ | 108 | /* Reset driver's Rx queue write index */ |
109 | il_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_WPTR_REG, 0); | 109 | il_write_direct32(il, FH_RSCSR_CHNL0_RBDCB_WPTR_REG, 0); |
110 | 110 | ||
111 | /* Tell device where to find RBD circular buffer in DRAM */ | 111 | /* Tell device where to find RBD circular buffer in DRAM */ |
112 | il_write_direct32(priv, FH_RSCSR_CHNL0_RBDCB_BASE_REG, | 112 | il_write_direct32(il, FH_RSCSR_CHNL0_RBDCB_BASE_REG, |
113 | (u32)(rxq->bd_dma >> 8)); | 113 | (u32)(rxq->bd_dma >> 8)); |
114 | 114 | ||
115 | /* Tell device where in DRAM to update its Rx status */ | 115 | /* Tell device where in DRAM to update its Rx status */ |
116 | il_write_direct32(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG, | 116 | il_write_direct32(il, FH_RSCSR_CHNL0_STTS_WPTR_REG, |
117 | rxq->rb_stts_dma >> 4); | 117 | rxq->rb_stts_dma >> 4); |
118 | 118 | ||
119 | /* Enable Rx DMA | 119 | /* Enable Rx DMA |
@@ -122,7 +122,7 @@ int il4965_rx_init(struct il_priv *priv, struct il_rx_queue *rxq) | |||
122 | * RB timeout 0x10 | 122 | * RB timeout 0x10 |
123 | * 256 RBDs | 123 | * 256 RBDs |
124 | */ | 124 | */ |
125 | il_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, | 125 | il_write_direct32(il, FH_MEM_RCSR_CHNL0_CONFIG_REG, |
126 | FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL | | 126 | FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL | |
127 | FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL | | 127 | FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL | |
128 | FH_RCSR_CHNL0_RX_CONFIG_SINGLE_FRAME_MSK | | 128 | FH_RCSR_CHNL0_RX_CONFIG_SINGLE_FRAME_MSK | |
@@ -131,77 +131,77 @@ int il4965_rx_init(struct il_priv *priv, struct il_rx_queue *rxq) | |||
131 | (rfdnlog << FH_RCSR_RX_CONFIG_RBDCB_SIZE_POS)); | 131 | (rfdnlog << FH_RCSR_RX_CONFIG_RBDCB_SIZE_POS)); |
132 | 132 | ||
133 | /* Set interrupt coalescing timer to default (2048 usecs) */ | 133 | /* Set interrupt coalescing timer to default (2048 usecs) */ |
134 | il_write8(priv, CSR_INT_COALESCING, IL_HOST_INT_TIMEOUT_DEF); | 134 | il_write8(il, CSR_INT_COALESCING, IL_HOST_INT_TIMEOUT_DEF); |
135 | 135 | ||
136 | return 0; | 136 | return 0; |
137 | } | 137 | } |
138 | 138 | ||
139 | static void il4965_set_pwr_vmain(struct il_priv *priv) | 139 | static void il4965_set_pwr_vmain(struct il_priv *il) |
140 | { | 140 | { |
141 | /* | 141 | /* |
142 | * (for documentation purposes) | 142 | * (for documentation purposes) |
143 | * to set power to V_AUX, do: | 143 | * to set power to V_AUX, do: |
144 | 144 | ||
145 | if (pci_pme_capable(priv->pci_dev, PCI_D3cold)) | 145 | if (pci_pme_capable(il->pci_dev, PCI_D3cold)) |
146 | il_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, | 146 | il_set_bits_mask_prph(il, APMG_PS_CTRL_REG, |
147 | APMG_PS_CTRL_VAL_PWR_SRC_VAUX, | 147 | APMG_PS_CTRL_VAL_PWR_SRC_VAUX, |
148 | ~APMG_PS_CTRL_MSK_PWR_SRC); | 148 | ~APMG_PS_CTRL_MSK_PWR_SRC); |
149 | */ | 149 | */ |
150 | 150 | ||
151 | il_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, | 151 | il_set_bits_mask_prph(il, APMG_PS_CTRL_REG, |
152 | APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, | 152 | APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, |
153 | ~APMG_PS_CTRL_MSK_PWR_SRC); | 153 | ~APMG_PS_CTRL_MSK_PWR_SRC); |
154 | } | 154 | } |
155 | 155 | ||
156 | int il4965_hw_nic_init(struct il_priv *priv) | 156 | int il4965_hw_nic_init(struct il_priv *il) |
157 | { | 157 | { |
158 | unsigned long flags; | 158 | unsigned long flags; |
159 | struct il_rx_queue *rxq = &priv->rxq; | 159 | struct il_rx_queue *rxq = &il->rxq; |
160 | int ret; | 160 | int ret; |
161 | 161 | ||
162 | /* nic_init */ | 162 | /* nic_init */ |
163 | spin_lock_irqsave(&priv->lock, flags); | 163 | spin_lock_irqsave(&il->lock, flags); |
164 | priv->cfg->ops->lib->apm_ops.init(priv); | 164 | il->cfg->ops->lib->apm_ops.init(il); |
165 | 165 | ||
166 | /* Set interrupt coalescing calibration timer to default (512 usecs) */ | 166 | /* Set interrupt coalescing calibration timer to default (512 usecs) */ |
167 | il_write8(priv, CSR_INT_COALESCING, IL_HOST_INT_CALIB_TIMEOUT_DEF); | 167 | il_write8(il, CSR_INT_COALESCING, IL_HOST_INT_CALIB_TIMEOUT_DEF); |
168 | 168 | ||
169 | spin_unlock_irqrestore(&priv->lock, flags); | 169 | spin_unlock_irqrestore(&il->lock, flags); |
170 | 170 | ||
171 | il4965_set_pwr_vmain(priv); | 171 | il4965_set_pwr_vmain(il); |
172 | 172 | ||
173 | priv->cfg->ops->lib->apm_ops.config(priv); | 173 | il->cfg->ops->lib->apm_ops.config(il); |
174 | 174 | ||
175 | /* Allocate the RX queue, or reset if it is already allocated */ | 175 | /* Allocate the RX queue, or reset if it is already allocated */ |
176 | if (!rxq->bd) { | 176 | if (!rxq->bd) { |
177 | ret = il_rx_queue_alloc(priv); | 177 | ret = il_rx_queue_alloc(il); |
178 | if (ret) { | 178 | if (ret) { |
179 | IL_ERR(priv, "Unable to initialize Rx queue\n"); | 179 | IL_ERR(il, "Unable to initialize Rx queue\n"); |
180 | return -ENOMEM; | 180 | return -ENOMEM; |
181 | } | 181 | } |
182 | } else | 182 | } else |
183 | il4965_rx_queue_reset(priv, rxq); | 183 | il4965_rx_queue_reset(il, rxq); |
184 | 184 | ||
185 | il4965_rx_replenish(priv); | 185 | il4965_rx_replenish(il); |
186 | 186 | ||
187 | il4965_rx_init(priv, rxq); | 187 | il4965_rx_init(il, rxq); |
188 | 188 | ||
189 | spin_lock_irqsave(&priv->lock, flags); | 189 | spin_lock_irqsave(&il->lock, flags); |
190 | 190 | ||
191 | rxq->need_update = 1; | 191 | rxq->need_update = 1; |
192 | il_rx_queue_update_write_ptr(priv, rxq); | 192 | il_rx_queue_update_write_ptr(il, rxq); |
193 | 193 | ||
194 | spin_unlock_irqrestore(&priv->lock, flags); | 194 | spin_unlock_irqrestore(&il->lock, flags); |
195 | 195 | ||
196 | /* Allocate or reset and init all Tx and Command queues */ | 196 | /* Allocate or reset and init all Tx and Command queues */ |
197 | if (!priv->txq) { | 197 | if (!il->txq) { |
198 | ret = il4965_txq_ctx_alloc(priv); | 198 | ret = il4965_txq_ctx_alloc(il); |
199 | if (ret) | 199 | if (ret) |
200 | return ret; | 200 | return ret; |
201 | } else | 201 | } else |
202 | il4965_txq_ctx_reset(priv); | 202 | il4965_txq_ctx_reset(il); |
203 | 203 | ||
204 | set_bit(STATUS_INIT, &priv->status); | 204 | set_bit(STATUS_INIT, &il->status); |
205 | 205 | ||
206 | return 0; | 206 | return 0; |
207 | } | 207 | } |
@@ -209,7 +209,7 @@ int il4965_hw_nic_init(struct il_priv *priv) | |||
209 | /** | 209 | /** |
210 | * il4965_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr | 210 | * il4965_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr |
211 | */ | 211 | */ |
212 | static inline __le32 il4965_dma_addr2rbd_ptr(struct il_priv *priv, | 212 | static inline __le32 il4965_dma_addr2rbd_ptr(struct il_priv *il, |
213 | dma_addr_t dma_addr) | 213 | dma_addr_t dma_addr) |
214 | { | 214 | { |
215 | return cpu_to_le32((u32)(dma_addr >> 8)); | 215 | return cpu_to_le32((u32)(dma_addr >> 8)); |
@@ -226,9 +226,9 @@ static inline __le32 il4965_dma_addr2rbd_ptr(struct il_priv *priv, | |||
226 | * also updates the memory address in the firmware to reference the new | 226 | * also updates the memory address in the firmware to reference the new |
227 | * target buffer. | 227 | * target buffer. |
228 | */ | 228 | */ |
229 | void il4965_rx_queue_restock(struct il_priv *priv) | 229 | void il4965_rx_queue_restock(struct il_priv *il) |
230 | { | 230 | { |
231 | struct il_rx_queue *rxq = &priv->rxq; | 231 | struct il_rx_queue *rxq = &il->rxq; |
232 | struct list_head *element; | 232 | struct list_head *element; |
233 | struct il_rx_mem_buffer *rxb; | 233 | struct il_rx_mem_buffer *rxb; |
234 | unsigned long flags; | 234 | unsigned long flags; |
@@ -245,7 +245,7 @@ void il4965_rx_queue_restock(struct il_priv *priv) | |||
245 | list_del(element); | 245 | list_del(element); |
246 | 246 | ||
247 | /* Point to Rx buffer via next RBD in circular buffer */ | 247 | /* Point to Rx buffer via next RBD in circular buffer */ |
248 | rxq->bd[rxq->write] = il4965_dma_addr2rbd_ptr(priv, | 248 | rxq->bd[rxq->write] = il4965_dma_addr2rbd_ptr(il, |
249 | rxb->page_dma); | 249 | rxb->page_dma); |
250 | rxq->queue[rxq->write] = rxb; | 250 | rxq->queue[rxq->write] = rxb; |
251 | rxq->write = (rxq->write + 1) & RX_QUEUE_MASK; | 251 | rxq->write = (rxq->write + 1) & RX_QUEUE_MASK; |
@@ -255,7 +255,7 @@ void il4965_rx_queue_restock(struct il_priv *priv) | |||
255 | /* If the pre-allocated buffer pool is dropping low, schedule to | 255 | /* If the pre-allocated buffer pool is dropping low, schedule to |
256 | * refill it */ | 256 | * refill it */ |
257 | if (rxq->free_count <= RX_LOW_WATERMARK) | 257 | if (rxq->free_count <= RX_LOW_WATERMARK) |
258 | queue_work(priv->workqueue, &priv->rx_replenish); | 258 | queue_work(il->workqueue, &il->rx_replenish); |
259 | 259 | ||
260 | 260 | ||
261 | /* If we've added more space for the firmware to place data, tell it. | 261 | /* 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) | |||
264 | spin_lock_irqsave(&rxq->lock, flags); | 264 | spin_lock_irqsave(&rxq->lock, flags); |
265 | rxq->need_update = 1; | 265 | rxq->need_update = 1; |
266 | spin_unlock_irqrestore(&rxq->lock, flags); | 266 | spin_unlock_irqrestore(&rxq->lock, flags); |
267 | il_rx_queue_update_write_ptr(priv, rxq); | 267 | il_rx_queue_update_write_ptr(il, rxq); |
268 | } | 268 | } |
269 | } | 269 | } |
270 | 270 | ||
@@ -276,9 +276,9 @@ void il4965_rx_queue_restock(struct il_priv *priv) | |||
276 | * Also restock the Rx queue via il_rx_queue_restock. | 276 | * Also restock the Rx queue via il_rx_queue_restock. |
277 | * This is called as a scheduled work item (except for during initialization) | 277 | * This is called as a scheduled work item (except for during initialization) |
278 | */ | 278 | */ |
279 | static void il4965_rx_allocate(struct il_priv *priv, gfp_t priority) | 279 | static void il4965_rx_allocate(struct il_priv *il, gfp_t priority) |
280 | { | 280 | { |
281 | struct il_rx_queue *rxq = &priv->rxq; | 281 | struct il_rx_queue *rxq = &il->rxq; |
282 | struct list_head *element; | 282 | struct list_head *element; |
283 | struct il_rx_mem_buffer *rxb; | 283 | struct il_rx_mem_buffer *rxb; |
284 | struct page *page; | 284 | struct page *page; |
@@ -296,20 +296,20 @@ static void il4965_rx_allocate(struct il_priv *priv, gfp_t priority) | |||
296 | if (rxq->free_count > RX_LOW_WATERMARK) | 296 | if (rxq->free_count > RX_LOW_WATERMARK) |
297 | gfp_mask |= __GFP_NOWARN; | 297 | gfp_mask |= __GFP_NOWARN; |
298 | 298 | ||
299 | if (priv->hw_params.rx_page_order > 0) | 299 | if (il->hw_params.rx_page_order > 0) |
300 | gfp_mask |= __GFP_COMP; | 300 | gfp_mask |= __GFP_COMP; |
301 | 301 | ||
302 | /* Alloc a new receive buffer */ | 302 | /* Alloc a new receive buffer */ |
303 | page = alloc_pages(gfp_mask, priv->hw_params.rx_page_order); | 303 | page = alloc_pages(gfp_mask, il->hw_params.rx_page_order); |
304 | if (!page) { | 304 | if (!page) { |
305 | if (net_ratelimit()) | 305 | if (net_ratelimit()) |
306 | IL_DEBUG_INFO(priv, "alloc_pages failed, " | 306 | IL_DEBUG_INFO(il, "alloc_pages failed, " |
307 | "order: %d\n", | 307 | "order: %d\n", |
308 | priv->hw_params.rx_page_order); | 308 | il->hw_params.rx_page_order); |
309 | 309 | ||
310 | if ((rxq->free_count <= RX_LOW_WATERMARK) && | 310 | if ((rxq->free_count <= RX_LOW_WATERMARK) && |
311 | net_ratelimit()) | 311 | net_ratelimit()) |
312 | IL_CRIT(priv, | 312 | IL_CRIT(il, |
313 | "Failed to alloc_pages with %s. " | 313 | "Failed to alloc_pages with %s. " |
314 | "Only %u free buffers remaining.\n", | 314 | "Only %u free buffers remaining.\n", |
315 | priority == GFP_ATOMIC ? | 315 | priority == GFP_ATOMIC ? |
@@ -325,7 +325,7 @@ static void il4965_rx_allocate(struct il_priv *priv, gfp_t priority) | |||
325 | 325 | ||
326 | if (list_empty(&rxq->rx_used)) { | 326 | if (list_empty(&rxq->rx_used)) { |
327 | spin_unlock_irqrestore(&rxq->lock, flags); | 327 | spin_unlock_irqrestore(&rxq->lock, flags); |
328 | __free_pages(page, priv->hw_params.rx_page_order); | 328 | __free_pages(page, il->hw_params.rx_page_order); |
329 | return; | 329 | return; |
330 | } | 330 | } |
331 | element = rxq->rx_used.next; | 331 | element = rxq->rx_used.next; |
@@ -337,8 +337,8 @@ static void il4965_rx_allocate(struct il_priv *priv, gfp_t priority) | |||
337 | BUG_ON(rxb->page); | 337 | BUG_ON(rxb->page); |
338 | rxb->page = page; | 338 | rxb->page = page; |
339 | /* Get physical address of the RB */ | 339 | /* Get physical address of the RB */ |
340 | rxb->page_dma = pci_map_page(priv->pci_dev, page, 0, | 340 | rxb->page_dma = pci_map_page(il->pci_dev, page, 0, |
341 | PAGE_SIZE << priv->hw_params.rx_page_order, | 341 | PAGE_SIZE << il->hw_params.rx_page_order, |
342 | PCI_DMA_FROMDEVICE); | 342 | PCI_DMA_FROMDEVICE); |
343 | /* dma address must be no more than 36 bits */ | 343 | /* dma address must be no more than 36 bits */ |
344 | BUG_ON(rxb->page_dma & ~DMA_BIT_MASK(36)); | 344 | 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) | |||
349 | 349 | ||
350 | list_add_tail(&rxb->list, &rxq->rx_free); | 350 | list_add_tail(&rxb->list, &rxq->rx_free); |
351 | rxq->free_count++; | 351 | rxq->free_count++; |
352 | priv->alloc_rxb_page++; | 352 | il->alloc_rxb_page++; |
353 | 353 | ||
354 | spin_unlock_irqrestore(&rxq->lock, flags); | 354 | spin_unlock_irqrestore(&rxq->lock, flags); |
355 | } | 355 | } |
356 | } | 356 | } |
357 | 357 | ||
358 | void il4965_rx_replenish(struct il_priv *priv) | 358 | void il4965_rx_replenish(struct il_priv *il) |
359 | { | 359 | { |
360 | unsigned long flags; | 360 | unsigned long flags; |
361 | 361 | ||
362 | il4965_rx_allocate(priv, GFP_KERNEL); | 362 | il4965_rx_allocate(il, GFP_KERNEL); |
363 | 363 | ||
364 | spin_lock_irqsave(&priv->lock, flags); | 364 | spin_lock_irqsave(&il->lock, flags); |
365 | il4965_rx_queue_restock(priv); | 365 | il4965_rx_queue_restock(il); |
366 | spin_unlock_irqrestore(&priv->lock, flags); | 366 | spin_unlock_irqrestore(&il->lock, flags); |
367 | } | 367 | } |
368 | 368 | ||
369 | void il4965_rx_replenish_now(struct il_priv *priv) | 369 | void il4965_rx_replenish_now(struct il_priv *il) |
370 | { | 370 | { |
371 | il4965_rx_allocate(priv, GFP_ATOMIC); | 371 | il4965_rx_allocate(il, GFP_ATOMIC); |
372 | 372 | ||
373 | il4965_rx_queue_restock(priv); | 373 | il4965_rx_queue_restock(il); |
374 | } | 374 | } |
375 | 375 | ||
376 | /* Assumes that the skb field of the buffers in 'pool' is kept accurate. | 376 | /* Assumes that the skb field of the buffers in 'pool' is kept accurate. |
@@ -378,33 +378,33 @@ void il4965_rx_replenish_now(struct il_priv *priv) | |||
378 | * This free routine walks the list of POOL entries and if SKB is set to | 378 | * This free routine walks the list of POOL entries and if SKB is set to |
379 | * non NULL it is unmapped and freed | 379 | * non NULL it is unmapped and freed |
380 | */ | 380 | */ |
381 | void il4965_rx_queue_free(struct il_priv *priv, struct il_rx_queue *rxq) | 381 | void il4965_rx_queue_free(struct il_priv *il, struct il_rx_queue *rxq) |
382 | { | 382 | { |
383 | int i; | 383 | int i; |
384 | for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { | 384 | for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { |
385 | if (rxq->pool[i].page != NULL) { | 385 | if (rxq->pool[i].page != NULL) { |
386 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 386 | pci_unmap_page(il->pci_dev, rxq->pool[i].page_dma, |
387 | PAGE_SIZE << priv->hw_params.rx_page_order, | 387 | PAGE_SIZE << il->hw_params.rx_page_order, |
388 | PCI_DMA_FROMDEVICE); | 388 | PCI_DMA_FROMDEVICE); |
389 | __il_free_pages(priv, rxq->pool[i].page); | 389 | __il_free_pages(il, rxq->pool[i].page); |
390 | rxq->pool[i].page = NULL; | 390 | rxq->pool[i].page = NULL; |
391 | } | 391 | } |
392 | } | 392 | } |
393 | 393 | ||
394 | dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, | 394 | dma_free_coherent(&il->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, |
395 | rxq->bd_dma); | 395 | rxq->bd_dma); |
396 | dma_free_coherent(&priv->pci_dev->dev, sizeof(struct il_rb_status), | 396 | dma_free_coherent(&il->pci_dev->dev, sizeof(struct il_rb_status), |
397 | rxq->rb_stts, rxq->rb_stts_dma); | 397 | rxq->rb_stts, rxq->rb_stts_dma); |
398 | rxq->bd = NULL; | 398 | rxq->bd = NULL; |
399 | rxq->rb_stts = NULL; | 399 | rxq->rb_stts = NULL; |
400 | } | 400 | } |
401 | 401 | ||
402 | int il4965_rxq_stop(struct il_priv *priv) | 402 | int il4965_rxq_stop(struct il_priv *il) |
403 | { | 403 | { |
404 | 404 | ||
405 | /* stop Rx DMA */ | 405 | /* stop Rx DMA */ |
406 | il_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); | 406 | il_write_direct32(il, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); |
407 | il_poll_direct_bit(priv, FH_MEM_RSSR_RX_STATUS_REG, | 407 | il_poll_direct_bit(il, FH_MEM_RSSR_RX_STATUS_REG, |
408 | FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000); | 408 | FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000); |
409 | 409 | ||
410 | return 0; | 410 | return 0; |
@@ -431,7 +431,7 @@ int il4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band) | |||
431 | return -1; | 431 | return -1; |
432 | } | 432 | } |
433 | 433 | ||
434 | static int il4965_calc_rssi(struct il_priv *priv, | 434 | static int il4965_calc_rssi(struct il_priv *il, |
435 | struct il_rx_phy_res *rx_resp) | 435 | struct il_rx_phy_res *rx_resp) |
436 | { | 436 | { |
437 | /* data from PHY/DSP regarding signal strength, etc., | 437 | /* data from PHY/DSP regarding signal strength, etc., |
@@ -456,7 +456,7 @@ static int il4965_calc_rssi(struct il_priv *priv, | |||
456 | if (valid_antennae & (1 << i)) | 456 | if (valid_antennae & (1 << i)) |
457 | max_rssi = max(ncphy->rssi_info[i << 1], max_rssi); | 457 | max_rssi = max(ncphy->rssi_info[i << 1], max_rssi); |
458 | 458 | ||
459 | IL_DEBUG_STATS(priv, "Rssi In A %d B %d C %d Max %d AGC dB %d\n", | 459 | IL_DEBUG_STATS(il, "Rssi In A %d B %d C %d Max %d AGC dB %d\n", |
460 | ncphy->rssi_info[0], ncphy->rssi_info[2], ncphy->rssi_info[4], | 460 | ncphy->rssi_info[0], ncphy->rssi_info[2], ncphy->rssi_info[4], |
461 | max_rssi, agc); | 461 | max_rssi, agc); |
462 | 462 | ||
@@ -466,7 +466,7 @@ static int il4965_calc_rssi(struct il_priv *priv, | |||
466 | } | 466 | } |
467 | 467 | ||
468 | 468 | ||
469 | static u32 il4965_translate_rx_status(struct il_priv *priv, u32 decrypt_in) | 469 | static u32 il4965_translate_rx_status(struct il_priv *il, u32 decrypt_in) |
470 | { | 470 | { |
471 | u32 decrypt_out = 0; | 471 | u32 decrypt_out = 0; |
472 | 472 | ||
@@ -519,13 +519,13 @@ static u32 il4965_translate_rx_status(struct il_priv *priv, u32 decrypt_in) | |||
519 | break; | 519 | break; |
520 | } | 520 | } |
521 | 521 | ||
522 | IL_DEBUG_RX(priv, "decrypt_in:0x%x decrypt_out = 0x%x\n", | 522 | IL_DEBUG_RX(il, "decrypt_in:0x%x decrypt_out = 0x%x\n", |
523 | decrypt_in, decrypt_out); | 523 | decrypt_in, decrypt_out); |
524 | 524 | ||
525 | return decrypt_out; | 525 | return decrypt_out; |
526 | } | 526 | } |
527 | 527 | ||
528 | static void il4965_pass_packet_to_mac80211(struct il_priv *priv, | 528 | static void il4965_pass_packet_to_mac80211(struct il_priv *il, |
529 | struct ieee80211_hdr *hdr, | 529 | struct ieee80211_hdr *hdr, |
530 | u16 len, | 530 | u16 len, |
531 | u32 ampdu_status, | 531 | u32 ampdu_status, |
@@ -536,36 +536,36 @@ static void il4965_pass_packet_to_mac80211(struct il_priv *priv, | |||
536 | __le16 fc = hdr->frame_control; | 536 | __le16 fc = hdr->frame_control; |
537 | 537 | ||
538 | /* We only process data packets if the interface is open */ | 538 | /* We only process data packets if the interface is open */ |
539 | if (unlikely(!priv->is_open)) { | 539 | if (unlikely(!il->is_open)) { |
540 | IL_DEBUG_DROP_LIMIT(priv, | 540 | IL_DEBUG_DROP_LIMIT(il, |
541 | "Dropping packet while interface is not open.\n"); | 541 | "Dropping packet while interface is not open.\n"); |
542 | return; | 542 | return; |
543 | } | 543 | } |
544 | 544 | ||
545 | /* In case of HW accelerated crypto and bad decryption, drop */ | 545 | /* In case of HW accelerated crypto and bad decryption, drop */ |
546 | if (!priv->cfg->mod_params->sw_crypto && | 546 | if (!il->cfg->mod_params->sw_crypto && |
547 | il_set_decrypted_flag(priv, hdr, ampdu_status, stats)) | 547 | il_set_decrypted_flag(il, hdr, ampdu_status, stats)) |
548 | return; | 548 | return; |
549 | 549 | ||
550 | skb = dev_alloc_skb(128); | 550 | skb = dev_alloc_skb(128); |
551 | if (!skb) { | 551 | if (!skb) { |
552 | IL_ERR(priv, "dev_alloc_skb failed\n"); | 552 | IL_ERR(il, "dev_alloc_skb failed\n"); |
553 | return; | 553 | return; |
554 | } | 554 | } |
555 | 555 | ||
556 | skb_add_rx_frag(skb, 0, rxb->page, (void *)hdr - rxb_addr(rxb), len); | 556 | skb_add_rx_frag(skb, 0, rxb->page, (void *)hdr - rxb_addr(rxb), len); |
557 | 557 | ||
558 | il_update_stats(priv, false, fc, len); | 558 | il_update_stats(il, false, fc, len); |
559 | memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); | 559 | memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); |
560 | 560 | ||
561 | ieee80211_rx(priv->hw, skb); | 561 | ieee80211_rx(il->hw, skb); |
562 | priv->alloc_rxb_page--; | 562 | il->alloc_rxb_page--; |
563 | rxb->page = NULL; | 563 | rxb->page = NULL; |
564 | } | 564 | } |
565 | 565 | ||
566 | /* Called for REPLY_RX (legacy ABG frames), or | 566 | /* Called for REPLY_RX (legacy ABG frames), or |
567 | * REPLY_RX_MPDU_CMD (HT high-throughput N frames). */ | 567 | * REPLY_RX_MPDU_CMD (HT high-throughput N frames). */ |
568 | void il4965_rx_reply_rx(struct il_priv *priv, | 568 | void il4965_rx_reply_rx(struct il_priv *il, |
569 | struct il_rx_mem_buffer *rxb) | 569 | struct il_rx_mem_buffer *rxb) |
570 | { | 570 | { |
571 | struct ieee80211_hdr *header; | 571 | struct ieee80211_hdr *header; |
@@ -582,7 +582,7 @@ void il4965_rx_reply_rx(struct il_priv *priv, | |||
582 | * REPLY_RX and REPLY_RX_MPDU_CMD are handled differently. | 582 | * REPLY_RX and REPLY_RX_MPDU_CMD are handled differently. |
583 | * REPLY_RX: physical layer info is in this buffer | 583 | * REPLY_RX: physical layer info is in this buffer |
584 | * REPLY_RX_MPDU_CMD: physical layer info was sent in separate | 584 | * REPLY_RX_MPDU_CMD: physical layer info was sent in separate |
585 | * command and cached in priv->last_phy_res | 585 | * command and cached in il->last_phy_res |
586 | * | 586 | * |
587 | * Here we set up local variables depending on which command is | 587 | * Here we set up local variables depending on which command is |
588 | * received. | 588 | * received. |
@@ -597,28 +597,28 @@ void il4965_rx_reply_rx(struct il_priv *priv, | |||
597 | phy_res->cfg_phy_cnt + len); | 597 | phy_res->cfg_phy_cnt + len); |
598 | ampdu_status = le32_to_cpu(rx_pkt_status); | 598 | ampdu_status = le32_to_cpu(rx_pkt_status); |
599 | } else { | 599 | } else { |
600 | if (!priv->_4965.last_phy_res_valid) { | 600 | if (!il->_4965.last_phy_res_valid) { |
601 | IL_ERR(priv, "MPDU frame without cached PHY data\n"); | 601 | IL_ERR(il, "MPDU frame without cached PHY data\n"); |
602 | return; | 602 | return; |
603 | } | 603 | } |
604 | phy_res = &priv->_4965.last_phy_res; | 604 | phy_res = &il->_4965.last_phy_res; |
605 | amsdu = (struct il_rx_mpdu_res_start *)pkt->u.raw; | 605 | amsdu = (struct il_rx_mpdu_res_start *)pkt->u.raw; |
606 | header = (struct ieee80211_hdr *)(pkt->u.raw + sizeof(*amsdu)); | 606 | header = (struct ieee80211_hdr *)(pkt->u.raw + sizeof(*amsdu)); |
607 | len = le16_to_cpu(amsdu->byte_count); | 607 | len = le16_to_cpu(amsdu->byte_count); |
608 | rx_pkt_status = *(__le32 *)(pkt->u.raw + sizeof(*amsdu) + len); | 608 | rx_pkt_status = *(__le32 *)(pkt->u.raw + sizeof(*amsdu) + len); |
609 | ampdu_status = il4965_translate_rx_status(priv, | 609 | ampdu_status = il4965_translate_rx_status(il, |
610 | le32_to_cpu(rx_pkt_status)); | 610 | le32_to_cpu(rx_pkt_status)); |
611 | } | 611 | } |
612 | 612 | ||
613 | if ((unlikely(phy_res->cfg_phy_cnt > 20))) { | 613 | if ((unlikely(phy_res->cfg_phy_cnt > 20))) { |
614 | IL_DEBUG_DROP(priv, "dsp size out of range [0,20]: %d/n", | 614 | IL_DEBUG_DROP(il, "dsp size out of range [0,20]: %d/n", |
615 | phy_res->cfg_phy_cnt); | 615 | phy_res->cfg_phy_cnt); |
616 | return; | 616 | return; |
617 | } | 617 | } |
618 | 618 | ||
619 | if (!(rx_pkt_status & RX_RES_STATUS_NO_CRC32_ERROR) || | 619 | if (!(rx_pkt_status & RX_RES_STATUS_NO_CRC32_ERROR) || |
620 | !(rx_pkt_status & RX_RES_STATUS_NO_RXE_OVERFLOW)) { | 620 | !(rx_pkt_status & RX_RES_STATUS_NO_RXE_OVERFLOW)) { |
621 | IL_DEBUG_RX(priv, "Bad CRC or FIFO: 0x%08X.\n", | 621 | IL_DEBUG_RX(il, "Bad CRC or FIFO: 0x%08X.\n", |
622 | le32_to_cpu(rx_pkt_status)); | 622 | le32_to_cpu(rx_pkt_status)); |
623 | return; | 623 | return; |
624 | } | 624 | } |
@@ -641,13 +641,13 @@ void il4965_rx_reply_rx(struct il_priv *priv, | |||
641 | * this W/A doesn't propagate it to the mac80211 */ | 641 | * this W/A doesn't propagate it to the mac80211 */ |
642 | /*rx_status.flag |= RX_FLAG_MACTIME_MPDU;*/ | 642 | /*rx_status.flag |= RX_FLAG_MACTIME_MPDU;*/ |
643 | 643 | ||
644 | priv->ucode_beacon_time = le32_to_cpu(phy_res->beacon_time_stamp); | 644 | il->ucode_beacon_time = le32_to_cpu(phy_res->beacon_time_stamp); |
645 | 645 | ||
646 | /* Find max signal strength (dBm) among 3 antenna/receiver chains */ | 646 | /* Find max signal strength (dBm) among 3 antenna/receiver chains */ |
647 | rx_status.signal = il4965_calc_rssi(priv, phy_res); | 647 | rx_status.signal = il4965_calc_rssi(il, phy_res); |
648 | 648 | ||
649 | il_dbg_log_rx_data_frame(priv, len, header); | 649 | il_dbg_log_rx_data_frame(il, len, header); |
650 | IL_DEBUG_STATS_LIMIT(priv, "Rssi %d, TSF %llu\n", | 650 | IL_DEBUG_STATS_LIMIT(il, "Rssi %d, TSF %llu\n", |
651 | rx_status.signal, (unsigned long long)rx_status.mactime); | 651 | rx_status.signal, (unsigned long long)rx_status.mactime); |
652 | 652 | ||
653 | /* | 653 | /* |
@@ -679,22 +679,22 @@ void il4965_rx_reply_rx(struct il_priv *priv, | |||
679 | if (rate_n_flags & RATE_MCS_SGI_MSK) | 679 | if (rate_n_flags & RATE_MCS_SGI_MSK) |
680 | rx_status.flag |= RX_FLAG_SHORT_GI; | 680 | rx_status.flag |= RX_FLAG_SHORT_GI; |
681 | 681 | ||
682 | il4965_pass_packet_to_mac80211(priv, header, len, ampdu_status, | 682 | il4965_pass_packet_to_mac80211(il, header, len, ampdu_status, |
683 | rxb, &rx_status); | 683 | rxb, &rx_status); |
684 | } | 684 | } |
685 | 685 | ||
686 | /* Cache phy data (Rx signal strength, etc) for HT frame (REPLY_RX_PHY_CMD). | 686 | /* Cache phy data (Rx signal strength, etc) for HT frame (REPLY_RX_PHY_CMD). |
687 | * This will be used later in il_rx_reply_rx() for REPLY_RX_MPDU_CMD. */ | 687 | * This will be used later in il_rx_reply_rx() for REPLY_RX_MPDU_CMD. */ |
688 | void il4965_rx_reply_rx_phy(struct il_priv *priv, | 688 | void il4965_rx_reply_rx_phy(struct il_priv *il, |
689 | struct il_rx_mem_buffer *rxb) | 689 | struct il_rx_mem_buffer *rxb) |
690 | { | 690 | { |
691 | struct il_rx_packet *pkt = rxb_addr(rxb); | 691 | struct il_rx_packet *pkt = rxb_addr(rxb); |
692 | priv->_4965.last_phy_res_valid = true; | 692 | il->_4965.last_phy_res_valid = true; |
693 | memcpy(&priv->_4965.last_phy_res, pkt->u.raw, | 693 | memcpy(&il->_4965.last_phy_res, pkt->u.raw, |
694 | sizeof(struct il_rx_phy_res)); | 694 | sizeof(struct il_rx_phy_res)); |
695 | } | 695 | } |
696 | 696 | ||
697 | static int il4965_get_channels_for_scan(struct il_priv *priv, | 697 | static int il4965_get_channels_for_scan(struct il_priv *il, |
698 | struct ieee80211_vif *vif, | 698 | struct ieee80211_vif *vif, |
699 | enum ieee80211_band band, | 699 | enum ieee80211_band band, |
700 | u8 is_active, u8 n_probes, | 700 | u8 is_active, u8 n_probes, |
@@ -708,18 +708,18 @@ static int il4965_get_channels_for_scan(struct il_priv *priv, | |||
708 | int added, i; | 708 | int added, i; |
709 | u16 channel; | 709 | u16 channel; |
710 | 710 | ||
711 | sband = il_get_hw_mode(priv, band); | 711 | sband = il_get_hw_mode(il, band); |
712 | if (!sband) | 712 | if (!sband) |
713 | return 0; | 713 | return 0; |
714 | 714 | ||
715 | active_dwell = il_get_active_dwell_time(priv, band, n_probes); | 715 | active_dwell = il_get_active_dwell_time(il, band, n_probes); |
716 | passive_dwell = il_get_passive_dwell_time(priv, band, vif); | 716 | passive_dwell = il_get_passive_dwell_time(il, band, vif); |
717 | 717 | ||
718 | if (passive_dwell <= active_dwell) | 718 | if (passive_dwell <= active_dwell) |
719 | passive_dwell = active_dwell + 1; | 719 | passive_dwell = active_dwell + 1; |
720 | 720 | ||
721 | for (i = 0, added = 0; i < priv->scan_request->n_channels; i++) { | 721 | for (i = 0, added = 0; i < il->scan_request->n_channels; i++) { |
722 | chan = priv->scan_request->channels[i]; | 722 | chan = il->scan_request->channels[i]; |
723 | 723 | ||
724 | if (chan->band != band) | 724 | if (chan->band != band) |
725 | continue; | 725 | continue; |
@@ -727,9 +727,9 @@ static int il4965_get_channels_for_scan(struct il_priv *priv, | |||
727 | channel = chan->hw_value; | 727 | channel = chan->hw_value; |
728 | scan_ch->channel = cpu_to_le16(channel); | 728 | scan_ch->channel = cpu_to_le16(channel); |
729 | 729 | ||
730 | ch_info = il_get_channel_info(priv, band, channel); | 730 | ch_info = il_get_channel_info(il, band, channel); |
731 | if (!il_is_channel_valid(ch_info)) { | 731 | if (!il_is_channel_valid(ch_info)) { |
732 | IL_DEBUG_SCAN(priv, | 732 | IL_DEBUG_SCAN(il, |
733 | "Channel %d is INVALID for this band.\n", | 733 | "Channel %d is INVALID for this band.\n", |
734 | channel); | 734 | channel); |
735 | continue; | 735 | continue; |
@@ -759,7 +759,7 @@ static int il4965_get_channels_for_scan(struct il_priv *priv, | |||
759 | else | 759 | else |
760 | scan_ch->tx_gain = ((1 << 5) | (5 << 3)); | 760 | scan_ch->tx_gain = ((1 << 5) | (5 << 3)); |
761 | 761 | ||
762 | IL_DEBUG_SCAN(priv, "Scanning ch=%d prob=0x%X [%s %d]\n", | 762 | IL_DEBUG_SCAN(il, "Scanning ch=%d prob=0x%X [%s %d]\n", |
763 | channel, le32_to_cpu(scan_ch->type), | 763 | channel, le32_to_cpu(scan_ch->type), |
764 | (scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE) ? | 764 | (scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE) ? |
765 | "ACTIVE" : "PASSIVE", | 765 | "ACTIVE" : "PASSIVE", |
@@ -770,11 +770,11 @@ static int il4965_get_channels_for_scan(struct il_priv *priv, | |||
770 | added++; | 770 | added++; |
771 | } | 771 | } |
772 | 772 | ||
773 | IL_DEBUG_SCAN(priv, "total channels to scan %d\n", added); | 773 | IL_DEBUG_SCAN(il, "total channels to scan %d\n", added); |
774 | return added; | 774 | return added; |
775 | } | 775 | } |
776 | 776 | ||
777 | int il4965_request_scan(struct il_priv *priv, struct ieee80211_vif *vif) | 777 | int il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif) |
778 | { | 778 | { |
779 | struct il_host_cmd cmd = { | 779 | struct il_host_cmd cmd = { |
780 | .id = REPLY_SCAN_CMD, | 780 | .id = REPLY_SCAN_CMD, |
@@ -782,47 +782,47 @@ int il4965_request_scan(struct il_priv *priv, struct ieee80211_vif *vif) | |||
782 | .flags = CMD_SIZE_HUGE, | 782 | .flags = CMD_SIZE_HUGE, |
783 | }; | 783 | }; |
784 | struct il_scan_cmd *scan; | 784 | struct il_scan_cmd *scan; |
785 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 785 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
786 | u32 rate_flags = 0; | 786 | u32 rate_flags = 0; |
787 | u16 cmd_len; | 787 | u16 cmd_len; |
788 | u16 rx_chain = 0; | 788 | u16 rx_chain = 0; |
789 | enum ieee80211_band band; | 789 | enum ieee80211_band band; |
790 | u8 n_probes = 0; | 790 | u8 n_probes = 0; |
791 | u8 rx_ant = priv->hw_params.valid_rx_ant; | 791 | u8 rx_ant = il->hw_params.valid_rx_ant; |
792 | u8 rate; | 792 | u8 rate; |
793 | bool is_active = false; | 793 | bool is_active = false; |
794 | int chan_mod; | 794 | int chan_mod; |
795 | u8 active_chains; | 795 | u8 active_chains; |
796 | u8 scan_tx_antennas = priv->hw_params.valid_tx_ant; | 796 | u8 scan_tx_antennas = il->hw_params.valid_tx_ant; |
797 | int ret; | 797 | int ret; |
798 | 798 | ||
799 | lockdep_assert_held(&priv->mutex); | 799 | lockdep_assert_held(&il->mutex); |
800 | 800 | ||
801 | if (vif) | 801 | if (vif) |
802 | ctx = il_rxon_ctx_from_vif(vif); | 802 | ctx = il_rxon_ctx_from_vif(vif); |
803 | 803 | ||
804 | if (!priv->scan_cmd) { | 804 | if (!il->scan_cmd) { |
805 | priv->scan_cmd = kmalloc(sizeof(struct il_scan_cmd) + | 805 | il->scan_cmd = kmalloc(sizeof(struct il_scan_cmd) + |
806 | IL_MAX_SCAN_SIZE, GFP_KERNEL); | 806 | IL_MAX_SCAN_SIZE, GFP_KERNEL); |
807 | if (!priv->scan_cmd) { | 807 | if (!il->scan_cmd) { |
808 | IL_DEBUG_SCAN(priv, | 808 | IL_DEBUG_SCAN(il, |
809 | "fail to allocate memory for scan\n"); | 809 | "fail to allocate memory for scan\n"); |
810 | return -ENOMEM; | 810 | return -ENOMEM; |
811 | } | 811 | } |
812 | } | 812 | } |
813 | scan = priv->scan_cmd; | 813 | scan = il->scan_cmd; |
814 | memset(scan, 0, sizeof(struct il_scan_cmd) + IL_MAX_SCAN_SIZE); | 814 | memset(scan, 0, sizeof(struct il_scan_cmd) + IL_MAX_SCAN_SIZE); |
815 | 815 | ||
816 | scan->quiet_plcp_th = IL_PLCP_QUIET_THRESH; | 816 | scan->quiet_plcp_th = IL_PLCP_QUIET_THRESH; |
817 | scan->quiet_time = IL_ACTIVE_QUIET_TIME; | 817 | scan->quiet_time = IL_ACTIVE_QUIET_TIME; |
818 | 818 | ||
819 | if (il_is_any_associated(priv)) { | 819 | if (il_is_any_associated(il)) { |
820 | u16 interval; | 820 | u16 interval; |
821 | u32 extra; | 821 | u32 extra; |
822 | u32 suspend_time = 100; | 822 | u32 suspend_time = 100; |
823 | u32 scan_suspend_time = 100; | 823 | u32 scan_suspend_time = 100; |
824 | 824 | ||
825 | IL_DEBUG_INFO(priv, "Scanning while associated...\n"); | 825 | IL_DEBUG_INFO(il, "Scanning while associated...\n"); |
826 | interval = vif->bss_conf.beacon_int; | 826 | interval = vif->bss_conf.beacon_int; |
827 | 827 | ||
828 | scan->suspend_time = 0; | 828 | scan->suspend_time = 0; |
@@ -834,39 +834,39 @@ int il4965_request_scan(struct il_priv *priv, struct ieee80211_vif *vif) | |||
834 | scan_suspend_time = (extra | | 834 | scan_suspend_time = (extra | |
835 | ((suspend_time % interval) * 1024)); | 835 | ((suspend_time % interval) * 1024)); |
836 | scan->suspend_time = cpu_to_le32(scan_suspend_time); | 836 | scan->suspend_time = cpu_to_le32(scan_suspend_time); |
837 | IL_DEBUG_SCAN(priv, "suspend_time 0x%X beacon interval %d\n", | 837 | IL_DEBUG_SCAN(il, "suspend_time 0x%X beacon interval %d\n", |
838 | scan_suspend_time, interval); | 838 | scan_suspend_time, interval); |
839 | } | 839 | } |
840 | 840 | ||
841 | if (priv->scan_request->n_ssids) { | 841 | if (il->scan_request->n_ssids) { |
842 | int i, p = 0; | 842 | int i, p = 0; |
843 | IL_DEBUG_SCAN(priv, "Kicking off active scan\n"); | 843 | IL_DEBUG_SCAN(il, "Kicking off active scan\n"); |
844 | for (i = 0; i < priv->scan_request->n_ssids; i++) { | 844 | for (i = 0; i < il->scan_request->n_ssids; i++) { |
845 | /* always does wildcard anyway */ | 845 | /* always does wildcard anyway */ |
846 | if (!priv->scan_request->ssids[i].ssid_len) | 846 | if (!il->scan_request->ssids[i].ssid_len) |
847 | continue; | 847 | continue; |
848 | scan->direct_scan[p].id = WLAN_EID_SSID; | 848 | scan->direct_scan[p].id = WLAN_EID_SSID; |
849 | scan->direct_scan[p].len = | 849 | scan->direct_scan[p].len = |
850 | priv->scan_request->ssids[i].ssid_len; | 850 | il->scan_request->ssids[i].ssid_len; |
851 | memcpy(scan->direct_scan[p].ssid, | 851 | memcpy(scan->direct_scan[p].ssid, |
852 | priv->scan_request->ssids[i].ssid, | 852 | il->scan_request->ssids[i].ssid, |
853 | priv->scan_request->ssids[i].ssid_len); | 853 | il->scan_request->ssids[i].ssid_len); |
854 | n_probes++; | 854 | n_probes++; |
855 | p++; | 855 | p++; |
856 | } | 856 | } |
857 | is_active = true; | 857 | is_active = true; |
858 | } else | 858 | } else |
859 | IL_DEBUG_SCAN(priv, "Start passive scan.\n"); | 859 | IL_DEBUG_SCAN(il, "Start passive scan.\n"); |
860 | 860 | ||
861 | scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; | 861 | scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; |
862 | scan->tx_cmd.sta_id = ctx->bcast_sta_id; | 862 | scan->tx_cmd.sta_id = ctx->bcast_sta_id; |
863 | scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; | 863 | scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; |
864 | 864 | ||
865 | switch (priv->scan_band) { | 865 | switch (il->scan_band) { |
866 | case IEEE80211_BAND_2GHZ: | 866 | case IEEE80211_BAND_2GHZ: |
867 | scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; | 867 | scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; |
868 | chan_mod = le32_to_cpu( | 868 | chan_mod = le32_to_cpu( |
869 | priv->contexts[IL_RXON_CTX_BSS].active.flags & | 869 | il->contexts[IL_RXON_CTX_BSS].active.flags & |
870 | RXON_FLG_CHANNEL_MODE_MSK) | 870 | RXON_FLG_CHANNEL_MODE_MSK) |
871 | >> RXON_FLG_CHANNEL_MODE_POS; | 871 | >> RXON_FLG_CHANNEL_MODE_POS; |
872 | if (chan_mod == CHANNEL_MODE_PURE_40) { | 872 | if (chan_mod == CHANNEL_MODE_PURE_40) { |
@@ -880,7 +880,7 @@ int il4965_request_scan(struct il_priv *priv, struct ieee80211_vif *vif) | |||
880 | rate = IL_RATE_6M_PLCP; | 880 | rate = IL_RATE_6M_PLCP; |
881 | break; | 881 | break; |
882 | default: | 882 | default: |
883 | IL_WARN(priv, "Invalid scan band\n"); | 883 | IL_WARN(il, "Invalid scan band\n"); |
884 | return -EIO; | 884 | return -EIO; |
885 | } | 885 | } |
886 | 886 | ||
@@ -904,54 +904,54 @@ int il4965_request_scan(struct il_priv *priv, struct ieee80211_vif *vif) | |||
904 | scan->good_CRC_th = is_active ? IL_GOOD_CRC_TH_DEFAULT : | 904 | scan->good_CRC_th = is_active ? IL_GOOD_CRC_TH_DEFAULT : |
905 | IL_GOOD_CRC_TH_NEVER; | 905 | IL_GOOD_CRC_TH_NEVER; |
906 | 906 | ||
907 | band = priv->scan_band; | 907 | band = il->scan_band; |
908 | 908 | ||
909 | if (priv->cfg->scan_rx_antennas[band]) | 909 | if (il->cfg->scan_rx_antennas[band]) |
910 | rx_ant = priv->cfg->scan_rx_antennas[band]; | 910 | rx_ant = il->cfg->scan_rx_antennas[band]; |
911 | 911 | ||
912 | priv->scan_tx_ant[band] = il4965_toggle_tx_ant(priv, | 912 | il->scan_tx_ant[band] = il4965_toggle_tx_ant(il, |
913 | priv->scan_tx_ant[band], | 913 | il->scan_tx_ant[band], |
914 | scan_tx_antennas); | 914 | scan_tx_antennas); |
915 | rate_flags |= il4965_ant_idx_to_flags(priv->scan_tx_ant[band]); | 915 | rate_flags |= il4965_ant_idx_to_flags(il->scan_tx_ant[band]); |
916 | scan->tx_cmd.rate_n_flags = il4965_hw_set_rate_n_flags(rate, rate_flags); | 916 | scan->tx_cmd.rate_n_flags = il4965_hw_set_rate_n_flags(rate, rate_flags); |
917 | 917 | ||
918 | /* In power save mode use one chain, otherwise use all chains */ | 918 | /* In power save mode use one chain, otherwise use all chains */ |
919 | if (test_bit(STATUS_POWER_PMI, &priv->status)) { | 919 | if (test_bit(STATUS_POWER_PMI, &il->status)) { |
920 | /* rx_ant has been set to all valid chains previously */ | 920 | /* rx_ant has been set to all valid chains previously */ |
921 | active_chains = rx_ant & | 921 | active_chains = rx_ant & |
922 | ((u8)(priv->chain_noise_data.active_chains)); | 922 | ((u8)(il->chain_noise_data.active_chains)); |
923 | if (!active_chains) | 923 | if (!active_chains) |
924 | active_chains = rx_ant; | 924 | active_chains = rx_ant; |
925 | 925 | ||
926 | IL_DEBUG_SCAN(priv, "chain_noise_data.active_chains: %u\n", | 926 | IL_DEBUG_SCAN(il, "chain_noise_data.active_chains: %u\n", |
927 | priv->chain_noise_data.active_chains); | 927 | il->chain_noise_data.active_chains); |
928 | 928 | ||
929 | rx_ant = il4965_first_antenna(active_chains); | 929 | rx_ant = il4965_first_antenna(active_chains); |
930 | } | 930 | } |
931 | 931 | ||
932 | /* MIMO is not used here, but value is required */ | 932 | /* MIMO is not used here, but value is required */ |
933 | rx_chain |= priv->hw_params.valid_rx_ant << RXON_RX_CHAIN_VALID_POS; | 933 | rx_chain |= il->hw_params.valid_rx_ant << RXON_RX_CHAIN_VALID_POS; |
934 | rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS; | 934 | rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS; |
935 | rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_SEL_POS; | 935 | rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_SEL_POS; |
936 | rx_chain |= 0x1 << RXON_RX_CHAIN_DRIVER_FORCE_POS; | 936 | rx_chain |= 0x1 << RXON_RX_CHAIN_DRIVER_FORCE_POS; |
937 | scan->rx_chain = cpu_to_le16(rx_chain); | 937 | scan->rx_chain = cpu_to_le16(rx_chain); |
938 | 938 | ||
939 | cmd_len = il_fill_probe_req(priv, | 939 | cmd_len = il_fill_probe_req(il, |
940 | (struct ieee80211_mgmt *)scan->data, | 940 | (struct ieee80211_mgmt *)scan->data, |
941 | vif->addr, | 941 | vif->addr, |
942 | priv->scan_request->ie, | 942 | il->scan_request->ie, |
943 | priv->scan_request->ie_len, | 943 | il->scan_request->ie_len, |
944 | IL_MAX_SCAN_SIZE - sizeof(*scan)); | 944 | IL_MAX_SCAN_SIZE - sizeof(*scan)); |
945 | scan->tx_cmd.len = cpu_to_le16(cmd_len); | 945 | scan->tx_cmd.len = cpu_to_le16(cmd_len); |
946 | 946 | ||
947 | scan->filter_flags |= (RXON_FILTER_ACCEPT_GRP_MSK | | 947 | scan->filter_flags |= (RXON_FILTER_ACCEPT_GRP_MSK | |
948 | RXON_FILTER_BCON_AWARE_MSK); | 948 | RXON_FILTER_BCON_AWARE_MSK); |
949 | 949 | ||
950 | scan->channel_count = il4965_get_channels_for_scan(priv, vif, band, | 950 | scan->channel_count = il4965_get_channels_for_scan(il, vif, band, |
951 | is_active, n_probes, | 951 | is_active, n_probes, |
952 | (void *)&scan->data[cmd_len]); | 952 | (void *)&scan->data[cmd_len]); |
953 | if (scan->channel_count == 0) { | 953 | if (scan->channel_count == 0) { |
954 | IL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); | 954 | IL_DEBUG_SCAN(il, "channel count %d\n", scan->channel_count); |
955 | return -EIO; | 955 | return -EIO; |
956 | } | 956 | } |
957 | 957 | ||
@@ -960,49 +960,49 @@ int il4965_request_scan(struct il_priv *priv, struct ieee80211_vif *vif) | |||
960 | cmd.data = scan; | 960 | cmd.data = scan; |
961 | scan->len = cpu_to_le16(cmd.len); | 961 | scan->len = cpu_to_le16(cmd.len); |
962 | 962 | ||
963 | set_bit(STATUS_SCAN_HW, &priv->status); | 963 | set_bit(STATUS_SCAN_HW, &il->status); |
964 | 964 | ||
965 | ret = il_send_cmd_sync(priv, &cmd); | 965 | ret = il_send_cmd_sync(il, &cmd); |
966 | if (ret) | 966 | if (ret) |
967 | clear_bit(STATUS_SCAN_HW, &priv->status); | 967 | clear_bit(STATUS_SCAN_HW, &il->status); |
968 | 968 | ||
969 | return ret; | 969 | return ret; |
970 | } | 970 | } |
971 | 971 | ||
972 | int il4965_manage_ibss_station(struct il_priv *priv, | 972 | int il4965_manage_ibss_station(struct il_priv *il, |
973 | struct ieee80211_vif *vif, bool add) | 973 | struct ieee80211_vif *vif, bool add) |
974 | { | 974 | { |
975 | struct il_vif_priv *vif_priv = (void *)vif->drv_priv; | 975 | struct il_vif_priv *vif_priv = (void *)vif->drv_priv; |
976 | 976 | ||
977 | if (add) | 977 | if (add) |
978 | return il4965_add_bssid_station(priv, vif_priv->ctx, | 978 | return il4965_add_bssid_station(il, vif_priv->ctx, |
979 | vif->bss_conf.bssid, | 979 | vif->bss_conf.bssid, |
980 | &vif_priv->ibss_bssid_sta_id); | 980 | &vif_priv->ibss_bssid_sta_id); |
981 | return il_remove_station(priv, vif_priv->ibss_bssid_sta_id, | 981 | return il_remove_station(il, vif_priv->ibss_bssid_sta_id, |
982 | vif->bss_conf.bssid); | 982 | vif->bss_conf.bssid); |
983 | } | 983 | } |
984 | 984 | ||
985 | void il4965_free_tfds_in_queue(struct il_priv *priv, | 985 | void il4965_free_tfds_in_queue(struct il_priv *il, |
986 | int sta_id, int tid, int freed) | 986 | int sta_id, int tid, int freed) |
987 | { | 987 | { |
988 | lockdep_assert_held(&priv->sta_lock); | 988 | lockdep_assert_held(&il->sta_lock); |
989 | 989 | ||
990 | if (priv->stations[sta_id].tid[tid].tfds_in_queue >= freed) | 990 | if (il->stations[sta_id].tid[tid].tfds_in_queue >= freed) |
991 | priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; | 991 | il->stations[sta_id].tid[tid].tfds_in_queue -= freed; |
992 | else { | 992 | else { |
993 | IL_DEBUG_TX(priv, "free more than tfds_in_queue (%u:%d)\n", | 993 | IL_DEBUG_TX(il, "free more than tfds_in_queue (%u:%d)\n", |
994 | priv->stations[sta_id].tid[tid].tfds_in_queue, | 994 | il->stations[sta_id].tid[tid].tfds_in_queue, |
995 | freed); | 995 | freed); |
996 | priv->stations[sta_id].tid[tid].tfds_in_queue = 0; | 996 | il->stations[sta_id].tid[tid].tfds_in_queue = 0; |
997 | } | 997 | } |
998 | } | 998 | } |
999 | 999 | ||
1000 | #define IL_TX_QUEUE_MSK 0xfffff | 1000 | #define IL_TX_QUEUE_MSK 0xfffff |
1001 | 1001 | ||
1002 | static bool il4965_is_single_rx_stream(struct il_priv *priv) | 1002 | static bool il4965_is_single_rx_stream(struct il_priv *il) |
1003 | { | 1003 | { |
1004 | return priv->current_ht_config.smps == IEEE80211_SMPS_STATIC || | 1004 | return il->current_ht_config.smps == IEEE80211_SMPS_STATIC || |
1005 | priv->current_ht_config.single_chain_sufficient; | 1005 | il->current_ht_config.single_chain_sufficient; |
1006 | } | 1006 | } |
1007 | 1007 | ||
1008 | #define IL_NUM_RX_CHAINS_MULTIPLE 3 | 1008 | #define IL_NUM_RX_CHAINS_MULTIPLE 3 |
@@ -1020,10 +1020,10 @@ static bool il4965_is_single_rx_stream(struct il_priv *priv) | |||
1020 | * MIMO (dual stream) requires at least 2, but works better with 3. | 1020 | * MIMO (dual stream) requires at least 2, but works better with 3. |
1021 | * This does not determine *which* chains to use, just how many. | 1021 | * This does not determine *which* chains to use, just how many. |
1022 | */ | 1022 | */ |
1023 | static int il4965_get_active_rx_chain_count(struct il_priv *priv) | 1023 | static int il4965_get_active_rx_chain_count(struct il_priv *il) |
1024 | { | 1024 | { |
1025 | /* # of Rx chains to use when expecting MIMO. */ | 1025 | /* # of Rx chains to use when expecting MIMO. */ |
1026 | if (il4965_is_single_rx_stream(priv)) | 1026 | if (il4965_is_single_rx_stream(il)) |
1027 | return IL_NUM_RX_CHAINS_SINGLE; | 1027 | return IL_NUM_RX_CHAINS_SINGLE; |
1028 | else | 1028 | else |
1029 | return IL_NUM_RX_CHAINS_MULTIPLE; | 1029 | return IL_NUM_RX_CHAINS_MULTIPLE; |
@@ -1034,10 +1034,10 @@ static int il4965_get_active_rx_chain_count(struct il_priv *priv) | |||
1034 | * multiplexing power save, use the active count for rx chain count. | 1034 | * multiplexing power save, use the active count for rx chain count. |
1035 | */ | 1035 | */ |
1036 | static int | 1036 | static int |
1037 | il4965_get_idle_rx_chain_count(struct il_priv *priv, int active_cnt) | 1037 | il4965_get_idle_rx_chain_count(struct il_priv *il, int active_cnt) |
1038 | { | 1038 | { |
1039 | /* # Rx chains when idling, depending on SMPS mode */ | 1039 | /* # Rx chains when idling, depending on SMPS mode */ |
1040 | switch (priv->current_ht_config.smps) { | 1040 | switch (il->current_ht_config.smps) { |
1041 | case IEEE80211_SMPS_STATIC: | 1041 | case IEEE80211_SMPS_STATIC: |
1042 | case IEEE80211_SMPS_DYNAMIC: | 1042 | case IEEE80211_SMPS_DYNAMIC: |
1043 | return IL_NUM_IDLE_CHAINS_SINGLE; | 1043 | return IL_NUM_IDLE_CHAINS_SINGLE; |
@@ -1045,7 +1045,7 @@ il4965_get_idle_rx_chain_count(struct il_priv *priv, int active_cnt) | |||
1045 | return active_cnt; | 1045 | return active_cnt; |
1046 | default: | 1046 | default: |
1047 | WARN(1, "invalid SMPS mode %d", | 1047 | WARN(1, "invalid SMPS mode %d", |
1048 | priv->current_ht_config.smps); | 1048 | il->current_ht_config.smps); |
1049 | return active_cnt; | 1049 | return active_cnt; |
1050 | } | 1050 | } |
1051 | } | 1051 | } |
@@ -1067,10 +1067,10 @@ static u8 il4965_count_chain_bitmap(u32 chain_bitmap) | |||
1067 | * Selects how many and which Rx receivers/antennas/chains to use. | 1067 | * Selects how many and which Rx receivers/antennas/chains to use. |
1068 | * This should not be used for scan command ... it puts data in wrong place. | 1068 | * This should not be used for scan command ... it puts data in wrong place. |
1069 | */ | 1069 | */ |
1070 | void il4965_set_rxon_chain(struct il_priv *priv, struct il_rxon_context *ctx) | 1070 | void il4965_set_rxon_chain(struct il_priv *il, struct il_rxon_context *ctx) |
1071 | { | 1071 | { |
1072 | bool is_single = il4965_is_single_rx_stream(priv); | 1072 | bool is_single = il4965_is_single_rx_stream(il); |
1073 | bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status); | 1073 | bool is_cam = !test_bit(STATUS_POWER_PMI, &il->status); |
1074 | u8 idle_rx_cnt, active_rx_cnt, valid_rx_cnt; | 1074 | u8 idle_rx_cnt, active_rx_cnt, valid_rx_cnt; |
1075 | u32 active_chains; | 1075 | u32 active_chains; |
1076 | u16 rx_chain; | 1076 | u16 rx_chain; |
@@ -1079,16 +1079,16 @@ void il4965_set_rxon_chain(struct il_priv *priv, struct il_rxon_context *ctx) | |||
1079 | * Before first association, we assume all antennas are connected. | 1079 | * Before first association, we assume all antennas are connected. |
1080 | * Just after first association, il4965_chain_noise_calibration() | 1080 | * Just after first association, il4965_chain_noise_calibration() |
1081 | * checks which antennas actually *are* connected. */ | 1081 | * checks which antennas actually *are* connected. */ |
1082 | if (priv->chain_noise_data.active_chains) | 1082 | if (il->chain_noise_data.active_chains) |
1083 | active_chains = priv->chain_noise_data.active_chains; | 1083 | active_chains = il->chain_noise_data.active_chains; |
1084 | else | 1084 | else |
1085 | active_chains = priv->hw_params.valid_rx_ant; | 1085 | active_chains = il->hw_params.valid_rx_ant; |
1086 | 1086 | ||
1087 | rx_chain = active_chains << RXON_RX_CHAIN_VALID_POS; | 1087 | rx_chain = active_chains << RXON_RX_CHAIN_VALID_POS; |
1088 | 1088 | ||
1089 | /* How many receivers should we use? */ | 1089 | /* How many receivers should we use? */ |
1090 | active_rx_cnt = il4965_get_active_rx_chain_count(priv); | 1090 | active_rx_cnt = il4965_get_active_rx_chain_count(il); |
1091 | idle_rx_cnt = il4965_get_idle_rx_chain_count(priv, active_rx_cnt); | 1091 | idle_rx_cnt = il4965_get_idle_rx_chain_count(il, active_rx_cnt); |
1092 | 1092 | ||
1093 | 1093 | ||
1094 | /* correct rx chain count according hw settings | 1094 | /* 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) | |||
1111 | else | 1111 | else |
1112 | ctx->staging.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK; | 1112 | ctx->staging.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK; |
1113 | 1113 | ||
1114 | IL_DEBUG_ASSOC(priv, "rx_chain=0x%X active=%d idle=%d\n", | 1114 | IL_DEBUG_ASSOC(il, "rx_chain=0x%X active=%d idle=%d\n", |
1115 | ctx->staging.rx_chain, | 1115 | ctx->staging.rx_chain, |
1116 | active_rx_cnt, idle_rx_cnt); | 1116 | active_rx_cnt, idle_rx_cnt); |
1117 | 1117 | ||
@@ -1119,7 +1119,7 @@ void il4965_set_rxon_chain(struct il_priv *priv, struct il_rxon_context *ctx) | |||
1119 | active_rx_cnt < idle_rx_cnt); | 1119 | active_rx_cnt < idle_rx_cnt); |
1120 | } | 1120 | } |
1121 | 1121 | ||
1122 | u8 il4965_toggle_tx_ant(struct il_priv *priv, u8 ant, u8 valid) | 1122 | u8 il4965_toggle_tx_ant(struct il_priv *il, u8 ant, u8 valid) |
1123 | { | 1123 | { |
1124 | int i; | 1124 | int i; |
1125 | u8 ind = ant; | 1125 | u8 ind = ant; |
@@ -1149,7 +1149,7 @@ static const char *il4965_get_fh_string(int cmd) | |||
1149 | } | 1149 | } |
1150 | } | 1150 | } |
1151 | 1151 | ||
1152 | int il4965_dump_fh(struct il_priv *priv, char **buf, bool display) | 1152 | int il4965_dump_fh(struct il_priv *il, char **buf, bool display) |
1153 | { | 1153 | { |
1154 | int i; | 1154 | int i; |
1155 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 1155 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
@@ -1179,16 +1179,16 @@ int il4965_dump_fh(struct il_priv *priv, char **buf, bool display) | |||
1179 | pos += scnprintf(*buf + pos, bufsz - pos, | 1179 | pos += scnprintf(*buf + pos, bufsz - pos, |
1180 | " %34s: 0X%08x\n", | 1180 | " %34s: 0X%08x\n", |
1181 | il4965_get_fh_string(fh_tbl[i]), | 1181 | il4965_get_fh_string(fh_tbl[i]), |
1182 | il_read_direct32(priv, fh_tbl[i])); | 1182 | il_read_direct32(il, fh_tbl[i])); |
1183 | } | 1183 | } |
1184 | return pos; | 1184 | return pos; |
1185 | } | 1185 | } |
1186 | #endif | 1186 | #endif |
1187 | IL_ERR(priv, "FH register values:\n"); | 1187 | IL_ERR(il, "FH register values:\n"); |
1188 | for (i = 0; i < ARRAY_SIZE(fh_tbl); i++) { | 1188 | for (i = 0; i < ARRAY_SIZE(fh_tbl); i++) { |
1189 | IL_ERR(priv, " %34s: 0X%08x\n", | 1189 | IL_ERR(il, " %34s: 0X%08x\n", |
1190 | il4965_get_fh_string(fh_tbl[i]), | 1190 | il4965_get_fh_string(fh_tbl[i]), |
1191 | il_read_direct32(priv, fh_tbl[i])); | 1191 | il_read_direct32(il, fh_tbl[i])); |
1192 | } | 1192 | } |
1193 | return 0; | 1193 | return 0; |
1194 | } | 1194 | } |
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c index a7298f5997a..e53ed1a5d5d 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) | |||
140 | return -1; | 140 | return -1; |
141 | } | 141 | } |
142 | 142 | ||
143 | static void il4965_rs_rate_scale_perform(struct il_priv *priv, | 143 | static void il4965_rs_rate_scale_perform(struct il_priv *il, |
144 | struct sk_buff *skb, | 144 | struct sk_buff *skb, |
145 | struct ieee80211_sta *sta, | 145 | struct ieee80211_sta *sta, |
146 | struct il_lq_sta *lq_sta); | 146 | struct il_lq_sta *lq_sta); |
147 | static void il4965_rs_fill_link_cmd(struct il_priv *priv, | 147 | static void il4965_rs_fill_link_cmd(struct il_priv *il, |
148 | struct il_lq_sta *lq_sta, u32 rate_n_flags); | 148 | struct il_lq_sta *lq_sta, u32 rate_n_flags); |
149 | static void il4965_rs_stay_in_table(struct il_lq_sta *lq_sta, | 149 | static void il4965_rs_stay_in_table(struct il_lq_sta *lq_sta, |
150 | bool force_search); | 150 | bool force_search); |
@@ -348,7 +348,7 @@ static u32 il4965_rs_tl_get_load(struct il_lq_sta *lq_data, u8 tid) | |||
348 | return tl->total; | 348 | return tl->total; |
349 | } | 349 | } |
350 | 350 | ||
351 | static int il4965_rs_tl_turn_on_agg_for_tid(struct il_priv *priv, | 351 | static int il4965_rs_tl_turn_on_agg_for_tid(struct il_priv *il, |
352 | struct il_lq_sta *lq_data, u8 tid, | 352 | struct il_lq_sta *lq_data, u8 tid, |
353 | struct ieee80211_sta *sta) | 353 | struct ieee80211_sta *sta) |
354 | { | 354 | { |
@@ -358,7 +358,7 @@ static int il4965_rs_tl_turn_on_agg_for_tid(struct il_priv *priv, | |||
358 | load = il4965_rs_tl_get_load(lq_data, tid); | 358 | load = il4965_rs_tl_get_load(lq_data, tid); |
359 | 359 | ||
360 | if (load > IL_AGG_LOAD_THRESHOLD) { | 360 | if (load > IL_AGG_LOAD_THRESHOLD) { |
361 | IL_DEBUG_HT(priv, "Starting Tx agg: STA: %pM tid: %d\n", | 361 | IL_DEBUG_HT(il, "Starting Tx agg: STA: %pM tid: %d\n", |
362 | sta->addr, tid); | 362 | sta->addr, tid); |
363 | ret = ieee80211_start_tx_ba_session(sta, tid, 5000); | 363 | ret = ieee80211_start_tx_ba_session(sta, tid, 5000); |
364 | if (ret == -EAGAIN) { | 364 | if (ret == -EAGAIN) { |
@@ -367,25 +367,25 @@ static int il4965_rs_tl_turn_on_agg_for_tid(struct il_priv *priv, | |||
367 | * this might be cause by reloading firmware | 367 | * this might be cause by reloading firmware |
368 | * stop the tx ba session here | 368 | * stop the tx ba session here |
369 | */ | 369 | */ |
370 | IL_ERR(priv, "Fail start Tx agg on tid: %d\n", | 370 | IL_ERR(il, "Fail start Tx agg on tid: %d\n", |
371 | tid); | 371 | tid); |
372 | ieee80211_stop_tx_ba_session(sta, tid); | 372 | ieee80211_stop_tx_ba_session(sta, tid); |
373 | } | 373 | } |
374 | } else { | 374 | } else { |
375 | IL_ERR(priv, "Aggregation not enabled for tid %d " | 375 | IL_ERR(il, "Aggregation not enabled for tid %d " |
376 | "because load = %u\n", tid, load); | 376 | "because load = %u\n", tid, load); |
377 | } | 377 | } |
378 | return ret; | 378 | return ret; |
379 | } | 379 | } |
380 | 380 | ||
381 | static void il4965_rs_tl_turn_on_agg(struct il_priv *priv, u8 tid, | 381 | static void il4965_rs_tl_turn_on_agg(struct il_priv *il, u8 tid, |
382 | struct il_lq_sta *lq_data, | 382 | struct il_lq_sta *lq_data, |
383 | struct ieee80211_sta *sta) | 383 | struct ieee80211_sta *sta) |
384 | { | 384 | { |
385 | if (tid < TID_MAX_LOAD_COUNT) | 385 | if (tid < TID_MAX_LOAD_COUNT) |
386 | il4965_rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta); | 386 | il4965_rs_tl_turn_on_agg_for_tid(il, lq_data, tid, sta); |
387 | else | 387 | else |
388 | IL_ERR(priv, "tid exceeds max load count: %d/%d\n", | 388 | IL_ERR(il, "tid exceeds max load count: %d/%d\n", |
389 | tid, TID_MAX_LOAD_COUNT); | 389 | tid, TID_MAX_LOAD_COUNT); |
390 | } | 390 | } |
391 | 391 | ||
@@ -492,7 +492,7 @@ static int il4965_rs_collect_tx_data(struct il_scale_tbl_info *tbl, | |||
492 | /* | 492 | /* |
493 | * Fill uCode API rate_n_flags field, based on "search" or "active" table. | 493 | * Fill uCode API rate_n_flags field, based on "search" or "active" table. |
494 | */ | 494 | */ |
495 | static u32 il4965_rate_n_flags_from_tbl(struct il_priv *priv, | 495 | static u32 il4965_rate_n_flags_from_tbl(struct il_priv *il, |
496 | struct il_scale_tbl_info *tbl, | 496 | struct il_scale_tbl_info *tbl, |
497 | int index, u8 use_green) | 497 | int index, u8 use_green) |
498 | { | 498 | { |
@@ -505,7 +505,7 @@ static u32 il4965_rate_n_flags_from_tbl(struct il_priv *priv, | |||
505 | 505 | ||
506 | } else if (is_Ht(tbl->lq_type)) { | 506 | } else if (is_Ht(tbl->lq_type)) { |
507 | if (index > IL_LAST_OFDM_RATE) { | 507 | if (index > IL_LAST_OFDM_RATE) { |
508 | IL_ERR(priv, "Invalid HT rate index %d\n", index); | 508 | IL_ERR(il, "Invalid HT rate index %d\n", index); |
509 | index = IL_LAST_OFDM_RATE; | 509 | index = IL_LAST_OFDM_RATE; |
510 | } | 510 | } |
511 | rate_n_flags = RATE_MCS_HT_MSK; | 511 | rate_n_flags = RATE_MCS_HT_MSK; |
@@ -515,7 +515,7 @@ static u32 il4965_rate_n_flags_from_tbl(struct il_priv *priv, | |||
515 | else | 515 | else |
516 | rate_n_flags |= iwlegacy_rates[index].plcp_mimo2; | 516 | rate_n_flags |= iwlegacy_rates[index].plcp_mimo2; |
517 | } else { | 517 | } else { |
518 | IL_ERR(priv, "Invalid tbl->lq_type %d\n", tbl->lq_type); | 518 | IL_ERR(il, "Invalid tbl->lq_type %d\n", tbl->lq_type); |
519 | } | 519 | } |
520 | 520 | ||
521 | rate_n_flags |= ((tbl->ant_type << RATE_MCS_ANT_POS) & | 521 | rate_n_flags |= ((tbl->ant_type << RATE_MCS_ANT_POS) & |
@@ -535,7 +535,7 @@ static u32 il4965_rate_n_flags_from_tbl(struct il_priv *priv, | |||
535 | rate_n_flags |= RATE_MCS_GF_MSK; | 535 | rate_n_flags |= RATE_MCS_GF_MSK; |
536 | if (is_siso(tbl->lq_type) && tbl->is_SGI) { | 536 | if (is_siso(tbl->lq_type) && tbl->is_SGI) { |
537 | rate_n_flags &= ~RATE_MCS_SGI_MSK; | 537 | rate_n_flags &= ~RATE_MCS_SGI_MSK; |
538 | IL_ERR(priv, "GF was set with SGI:SISO\n"); | 538 | IL_ERR(il, "GF was set with SGI:SISO\n"); |
539 | } | 539 | } |
540 | } | 540 | } |
541 | } | 541 | } |
@@ -667,7 +667,7 @@ static u16 il4965_rs_get_supported_rates(struct il_lq_sta *lq_sta, | |||
667 | } | 667 | } |
668 | 668 | ||
669 | static u16 | 669 | static u16 |
670 | il4965_rs_get_adjacent_rate(struct il_priv *priv, u8 index, u16 rate_mask, | 670 | il4965_rs_get_adjacent_rate(struct il_priv *il, u8 index, u16 rate_mask, |
671 | int rate_type) | 671 | int rate_type) |
672 | { | 672 | { |
673 | u8 high = IL_RATE_INVALID; | 673 | u8 high = IL_RATE_INVALID; |
@@ -707,7 +707,7 @@ il4965_rs_get_adjacent_rate(struct il_priv *priv, u8 index, u16 rate_mask, | |||
707 | break; | 707 | break; |
708 | if (rate_mask & (1 << low)) | 708 | if (rate_mask & (1 << low)) |
709 | break; | 709 | break; |
710 | IL_DEBUG_RATE(priv, "Skipping masked lower rate: %d\n", low); | 710 | IL_DEBUG_RATE(il, "Skipping masked lower rate: %d\n", low); |
711 | } | 711 | } |
712 | 712 | ||
713 | high = index; | 713 | high = index; |
@@ -717,7 +717,7 @@ il4965_rs_get_adjacent_rate(struct il_priv *priv, u8 index, u16 rate_mask, | |||
717 | break; | 717 | break; |
718 | if (rate_mask & (1 << high)) | 718 | if (rate_mask & (1 << high)) |
719 | break; | 719 | break; |
720 | IL_DEBUG_RATE(priv, "Skipping masked higher rate: %d\n", high); | 720 | IL_DEBUG_RATE(il, "Skipping masked higher rate: %d\n", high); |
721 | } | 721 | } |
722 | 722 | ||
723 | return (high << 8) | low; | 723 | return (high << 8) | low; |
@@ -732,7 +732,7 @@ static u32 il4965_rs_get_lower_rate(struct il_lq_sta *lq_sta, | |||
732 | u16 high_low; | 732 | u16 high_low; |
733 | u8 switch_to_legacy = 0; | 733 | u8 switch_to_legacy = 0; |
734 | u8 is_green = lq_sta->is_green; | 734 | u8 is_green = lq_sta->is_green; |
735 | struct il_priv *priv = lq_sta->drv; | 735 | struct il_priv *il = lq_sta->drv; |
736 | 736 | ||
737 | /* check if we need to switch from HT to legacy rates. | 737 | /* check if we need to switch from HT to legacy rates. |
738 | * assumption is that mandatory rates (1Mbps or 6Mbps) | 738 | * assumption is that mandatory rates (1Mbps or 6Mbps) |
@@ -747,7 +747,7 @@ static u32 il4965_rs_get_lower_rate(struct il_lq_sta *lq_sta, | |||
747 | 747 | ||
748 | if (il4965_num_of_ant(tbl->ant_type) > 1) | 748 | if (il4965_num_of_ant(tbl->ant_type) > 1) |
749 | tbl->ant_type = | 749 | tbl->ant_type = |
750 | il4965_first_antenna(priv->hw_params.valid_tx_ant); | 750 | il4965_first_antenna(il->hw_params.valid_tx_ant); |
751 | 751 | ||
752 | tbl->is_ht40 = 0; | 752 | tbl->is_ht40 = 0; |
753 | tbl->is_SGI = 0; | 753 | tbl->is_SGI = 0; |
@@ -798,17 +798,17 @@ static bool il4965_table_type_matches(struct il_scale_tbl_info *a, | |||
798 | * mac80211 sends us Tx status | 798 | * mac80211 sends us Tx status |
799 | */ | 799 | */ |
800 | static void | 800 | static void |
801 | il4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | 801 | il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband, |
802 | struct ieee80211_sta *sta, void *priv_sta, | 802 | struct ieee80211_sta *sta, void *il_sta, |
803 | struct sk_buff *skb) | 803 | struct sk_buff *skb) |
804 | { | 804 | { |
805 | int legacy_success; | 805 | int legacy_success; |
806 | int retries; | 806 | int retries; |
807 | int rs_index, mac_index, i; | 807 | int rs_index, mac_index, i; |
808 | struct il_lq_sta *lq_sta = priv_sta; | 808 | struct il_lq_sta *lq_sta = il_sta; |
809 | struct il_link_quality_cmd *table; | 809 | struct il_link_quality_cmd *table; |
810 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 810 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
811 | struct il_priv *priv = (struct il_priv *)priv_r; | 811 | struct il_priv *il = (struct il_priv *)il_r; |
812 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 812 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
813 | enum mac80211_rate_control_flags mac_flags; | 813 | enum mac80211_rate_control_flags mac_flags; |
814 | u32 tx_rate; | 814 | u32 tx_rate; |
@@ -817,15 +817,15 @@ il4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
817 | struct il_station_priv *sta_priv = (void *)sta->drv_priv; | 817 | struct il_station_priv *sta_priv = (void *)sta->drv_priv; |
818 | struct il_rxon_context *ctx = sta_priv->common.ctx; | 818 | struct il_rxon_context *ctx = sta_priv->common.ctx; |
819 | 819 | ||
820 | IL_DEBUG_RATE_LIMIT(priv, | 820 | IL_DEBUG_RATE_LIMIT(il, |
821 | "get frame ack response, update rate scale window\n"); | 821 | "get frame ack response, update rate scale window\n"); |
822 | 822 | ||
823 | /* Treat uninitialized rate scaling data same as non-existing. */ | 823 | /* Treat uninitialized rate scaling data same as non-existing. */ |
824 | if (!lq_sta) { | 824 | if (!lq_sta) { |
825 | IL_DEBUG_RATE(priv, "Station rate scaling not created yet.\n"); | 825 | IL_DEBUG_RATE(il, "Station rate scaling not created yet.\n"); |
826 | return; | 826 | return; |
827 | } else if (!lq_sta->drv) { | 827 | } else if (!lq_sta->drv) { |
828 | IL_DEBUG_RATE(priv, "Rate scaling not initialized yet.\n"); | 828 | IL_DEBUG_RATE(il, "Rate scaling not initialized yet.\n"); |
829 | return; | 829 | return; |
830 | } | 830 | } |
831 | 831 | ||
@@ -849,8 +849,8 @@ il4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
849 | table = &lq_sta->lq; | 849 | table = &lq_sta->lq; |
850 | tx_rate = le32_to_cpu(table->rs_table[0].rate_n_flags); | 850 | tx_rate = le32_to_cpu(table->rs_table[0].rate_n_flags); |
851 | il4965_rs_get_tbl_info_from_mcs(tx_rate, | 851 | il4965_rs_get_tbl_info_from_mcs(tx_rate, |
852 | priv->band, &tbl_type, &rs_index); | 852 | il->band, &tbl_type, &rs_index); |
853 | if (priv->band == IEEE80211_BAND_5GHZ) | 853 | if (il->band == IEEE80211_BAND_5GHZ) |
854 | rs_index -= IL_FIRST_OFDM_RATE; | 854 | rs_index -= IL_FIRST_OFDM_RATE; |
855 | mac_flags = info->status.rates[0].flags; | 855 | mac_flags = info->status.rates[0].flags; |
856 | mac_index = info->status.rates[0].idx; | 856 | mac_index = info->status.rates[0].idx; |
@@ -863,7 +863,7 @@ il4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
863 | * mac80211 HT index is always zero-indexed; we need to move | 863 | * mac80211 HT index is always zero-indexed; we need to move |
864 | * HT OFDM rates after CCK rates in 2.4 GHz band | 864 | * HT OFDM rates after CCK rates in 2.4 GHz band |
865 | */ | 865 | */ |
866 | if (priv->band == IEEE80211_BAND_2GHZ) | 866 | if (il->band == IEEE80211_BAND_2GHZ) |
867 | mac_index += IL_FIRST_OFDM_RATE; | 867 | mac_index += IL_FIRST_OFDM_RATE; |
868 | } | 868 | } |
869 | /* Here we actually compare this rate to the latest LQ command */ | 869 | /* Here we actually compare this rate to the latest LQ command */ |
@@ -880,7 +880,7 @@ il4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
880 | (!!(tx_rate & RATE_MCS_GF_MSK) != | 880 | (!!(tx_rate & RATE_MCS_GF_MSK) != |
881 | !!(mac_flags & IEEE80211_TX_RC_GREEN_FIELD)) || | 881 | !!(mac_flags & IEEE80211_TX_RC_GREEN_FIELD)) || |
882 | (rs_index != mac_index)) { | 882 | (rs_index != mac_index)) { |
883 | IL_DEBUG_RATE(priv, | 883 | IL_DEBUG_RATE(il, |
884 | "initial rate %d does not match %d (0x%x)\n", | 884 | "initial rate %d does not match %d (0x%x)\n", |
885 | mac_index, rs_index, tx_rate); | 885 | mac_index, rs_index, tx_rate); |
886 | /* | 886 | /* |
@@ -891,7 +891,7 @@ il4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
891 | lq_sta->missed_rate_counter++; | 891 | lq_sta->missed_rate_counter++; |
892 | if (lq_sta->missed_rate_counter > IL_MISSED_RATE_MAX) { | 892 | if (lq_sta->missed_rate_counter > IL_MISSED_RATE_MAX) { |
893 | lq_sta->missed_rate_counter = 0; | 893 | lq_sta->missed_rate_counter = 0; |
894 | il_send_lq_cmd(priv, ctx, &lq_sta->lq, | 894 | il_send_lq_cmd(il, ctx, &lq_sta->lq, |
895 | CMD_ASYNC, false); | 895 | CMD_ASYNC, false); |
896 | } | 896 | } |
897 | /* Regardless, ignore this status info for outdated rate */ | 897 | /* Regardless, ignore this status info for outdated rate */ |
@@ -910,15 +910,15 @@ il4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
910 | curr_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); | 910 | curr_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); |
911 | other_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); | 911 | other_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); |
912 | } else { | 912 | } else { |
913 | IL_DEBUG_RATE(priv, | 913 | IL_DEBUG_RATE(il, |
914 | "Neither active nor search matches tx rate\n"); | 914 | "Neither active nor search matches tx rate\n"); |
915 | tmp_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); | 915 | tmp_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); |
916 | IL_DEBUG_RATE(priv, "active- lq:%x, ant:%x, SGI:%d\n", | 916 | IL_DEBUG_RATE(il, "active- lq:%x, ant:%x, SGI:%d\n", |
917 | tmp_tbl->lq_type, tmp_tbl->ant_type, tmp_tbl->is_SGI); | 917 | tmp_tbl->lq_type, tmp_tbl->ant_type, tmp_tbl->is_SGI); |
918 | tmp_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); | 918 | tmp_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); |
919 | IL_DEBUG_RATE(priv, "search- lq:%x, ant:%x, SGI:%d\n", | 919 | IL_DEBUG_RATE(il, "search- lq:%x, ant:%x, SGI:%d\n", |
920 | tmp_tbl->lq_type, tmp_tbl->ant_type, tmp_tbl->is_SGI); | 920 | tmp_tbl->lq_type, tmp_tbl->ant_type, tmp_tbl->is_SGI); |
921 | IL_DEBUG_RATE(priv, "actual- lq:%x, ant:%x, SGI:%d\n", | 921 | IL_DEBUG_RATE(il, "actual- lq:%x, ant:%x, SGI:%d\n", |
922 | tbl_type.lq_type, tbl_type.ant_type, tbl_type.is_SGI); | 922 | tbl_type.lq_type, tbl_type.ant_type, tbl_type.is_SGI); |
923 | /* | 923 | /* |
924 | * no matching table found, let's by-pass the data collection | 924 | * no matching table found, let's by-pass the data collection |
@@ -937,7 +937,7 @@ il4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
937 | */ | 937 | */ |
938 | if (info->flags & IEEE80211_TX_STAT_AMPDU) { | 938 | if (info->flags & IEEE80211_TX_STAT_AMPDU) { |
939 | tx_rate = le32_to_cpu(table->rs_table[0].rate_n_flags); | 939 | tx_rate = le32_to_cpu(table->rs_table[0].rate_n_flags); |
940 | il4965_rs_get_tbl_info_from_mcs(tx_rate, priv->band, &tbl_type, | 940 | il4965_rs_get_tbl_info_from_mcs(tx_rate, il->band, &tbl_type, |
941 | &rs_index); | 941 | &rs_index); |
942 | il4965_rs_collect_tx_data(curr_tbl, rs_index, | 942 | il4965_rs_collect_tx_data(curr_tbl, rs_index, |
943 | info->status.ampdu_len, | 943 | info->status.ampdu_len, |
@@ -962,7 +962,7 @@ il4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
962 | /* Collect data for each rate used during failed TX attempts */ | 962 | /* Collect data for each rate used during failed TX attempts */ |
963 | for (i = 0; i <= retries; ++i) { | 963 | for (i = 0; i <= retries; ++i) { |
964 | tx_rate = le32_to_cpu(table->rs_table[i].rate_n_flags); | 964 | tx_rate = le32_to_cpu(table->rs_table[i].rate_n_flags); |
965 | il4965_rs_get_tbl_info_from_mcs(tx_rate, priv->band, | 965 | il4965_rs_get_tbl_info_from_mcs(tx_rate, il->band, |
966 | &tbl_type, &rs_index); | 966 | &tbl_type, &rs_index); |
967 | /* | 967 | /* |
968 | * Only collect stats if retried rate is in the same RS | 968 | * Only collect stats if retried rate is in the same RS |
@@ -990,7 +990,7 @@ il4965_rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
990 | done: | 990 | done: |
991 | /* See if there's a better rate or modulation mode to try. */ | 991 | /* See if there's a better rate or modulation mode to try. */ |
992 | if (sta && sta->supp_rates[sband->band]) | 992 | if (sta && sta->supp_rates[sband->band]) |
993 | il4965_rs_rate_scale_perform(priv, skb, sta, lq_sta); | 993 | il4965_rs_rate_scale_perform(il, skb, sta, lq_sta); |
994 | } | 994 | } |
995 | 995 | ||
996 | /* | 996 | /* |
@@ -1001,10 +1001,10 @@ done: | |||
1001 | * These control how long we stay using same modulation mode before | 1001 | * These control how long we stay using same modulation mode before |
1002 | * searching for a new mode. | 1002 | * searching for a new mode. |
1003 | */ | 1003 | */ |
1004 | static void il4965_rs_set_stay_in_table(struct il_priv *priv, u8 is_legacy, | 1004 | static void il4965_rs_set_stay_in_table(struct il_priv *il, u8 is_legacy, |
1005 | struct il_lq_sta *lq_sta) | 1005 | struct il_lq_sta *lq_sta) |
1006 | { | 1006 | { |
1007 | IL_DEBUG_RATE(priv, "we are staying in the same table\n"); | 1007 | IL_DEBUG_RATE(il, "we are staying in the same table\n"); |
1008 | lq_sta->stay_in_tbl = 1; /* only place this gets set */ | 1008 | lq_sta->stay_in_tbl = 1; /* only place this gets set */ |
1009 | if (is_legacy) { | 1009 | if (is_legacy) { |
1010 | lq_sta->table_count_limit = IL_LEGACY_TABLE_COUNT; | 1010 | 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, | |||
1077 | * to decrease to match "active" throughput. When moving from MIMO to SISO, | 1077 | * to decrease to match "active" throughput. When moving from MIMO to SISO, |
1078 | * bit rate will typically need to increase, but not if performance was bad. | 1078 | * bit rate will typically need to increase, but not if performance was bad. |
1079 | */ | 1079 | */ |
1080 | static s32 il4965_rs_get_best_rate(struct il_priv *priv, | 1080 | static s32 il4965_rs_get_best_rate(struct il_priv *il, |
1081 | struct il_lq_sta *lq_sta, | 1081 | struct il_lq_sta *lq_sta, |
1082 | struct il_scale_tbl_info *tbl, /* "search" */ | 1082 | struct il_scale_tbl_info *tbl, /* "search" */ |
1083 | u16 rate_mask, s8 index) | 1083 | u16 rate_mask, s8 index) |
@@ -1098,7 +1098,7 @@ static s32 il4965_rs_get_best_rate(struct il_priv *priv, | |||
1098 | new_rate = high = low = start_hi = IL_RATE_INVALID; | 1098 | new_rate = high = low = start_hi = IL_RATE_INVALID; |
1099 | 1099 | ||
1100 | for (; ;) { | 1100 | for (; ;) { |
1101 | high_low = il4965_rs_get_adjacent_rate(priv, rate, rate_mask, | 1101 | high_low = il4965_rs_get_adjacent_rate(il, rate, rate_mask, |
1102 | tbl->lq_type); | 1102 | tbl->lq_type); |
1103 | 1103 | ||
1104 | low = high_low & 0xff; | 1104 | low = high_low & 0xff; |
@@ -1171,7 +1171,7 @@ static s32 il4965_rs_get_best_rate(struct il_priv *priv, | |||
1171 | /* | 1171 | /* |
1172 | * Set up search table for MIMO2 | 1172 | * Set up search table for MIMO2 |
1173 | */ | 1173 | */ |
1174 | static int il4965_rs_switch_to_mimo2(struct il_priv *priv, | 1174 | static int il4965_rs_switch_to_mimo2(struct il_priv *il, |
1175 | struct il_lq_sta *lq_sta, | 1175 | struct il_lq_sta *lq_sta, |
1176 | struct ieee80211_conf *conf, | 1176 | struct ieee80211_conf *conf, |
1177 | struct ieee80211_sta *sta, | 1177 | struct ieee80211_sta *sta, |
@@ -1191,10 +1191,10 @@ static int il4965_rs_switch_to_mimo2(struct il_priv *priv, | |||
1191 | return -1; | 1191 | return -1; |
1192 | 1192 | ||
1193 | /* Need both Tx chains/antennas to support MIMO */ | 1193 | /* Need both Tx chains/antennas to support MIMO */ |
1194 | if (priv->hw_params.tx_chains_num < 2) | 1194 | if (il->hw_params.tx_chains_num < 2) |
1195 | return -1; | 1195 | return -1; |
1196 | 1196 | ||
1197 | IL_DEBUG_RATE(priv, "LQ: try to switch to MIMO2\n"); | 1197 | IL_DEBUG_RATE(il, "LQ: try to switch to MIMO2\n"); |
1198 | 1198 | ||
1199 | tbl->lq_type = LQ_MIMO2; | 1199 | tbl->lq_type = LQ_MIMO2; |
1200 | tbl->is_dup = lq_sta->is_dup; | 1200 | tbl->is_dup = lq_sta->is_dup; |
@@ -1202,27 +1202,27 @@ static int il4965_rs_switch_to_mimo2(struct il_priv *priv, | |||
1202 | tbl->max_search = IL_MAX_SEARCH; | 1202 | tbl->max_search = IL_MAX_SEARCH; |
1203 | rate_mask = lq_sta->active_mimo2_rate; | 1203 | rate_mask = lq_sta->active_mimo2_rate; |
1204 | 1204 | ||
1205 | if (il_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap)) | 1205 | if (il_is_ht40_tx_allowed(il, ctx, &sta->ht_cap)) |
1206 | tbl->is_ht40 = 1; | 1206 | tbl->is_ht40 = 1; |
1207 | else | 1207 | else |
1208 | tbl->is_ht40 = 0; | 1208 | tbl->is_ht40 = 0; |
1209 | 1209 | ||
1210 | il4965_rs_set_expected_tpt_table(lq_sta, tbl); | 1210 | il4965_rs_set_expected_tpt_table(lq_sta, tbl); |
1211 | 1211 | ||
1212 | rate = il4965_rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index); | 1212 | rate = il4965_rs_get_best_rate(il, lq_sta, tbl, rate_mask, index); |
1213 | 1213 | ||
1214 | IL_DEBUG_RATE(priv, "LQ: MIMO2 best rate %d mask %X\n", | 1214 | IL_DEBUG_RATE(il, "LQ: MIMO2 best rate %d mask %X\n", |
1215 | rate, rate_mask); | 1215 | rate, rate_mask); |
1216 | if ((rate == IL_RATE_INVALID) || !((1 << rate) & rate_mask)) { | 1216 | if ((rate == IL_RATE_INVALID) || !((1 << rate) & rate_mask)) { |
1217 | IL_DEBUG_RATE(priv, | 1217 | IL_DEBUG_RATE(il, |
1218 | "Can't switch with index %d rate mask %x\n", | 1218 | "Can't switch with index %d rate mask %x\n", |
1219 | rate, rate_mask); | 1219 | rate, rate_mask); |
1220 | return -1; | 1220 | return -1; |
1221 | } | 1221 | } |
1222 | tbl->current_rate = il4965_rate_n_flags_from_tbl(priv, | 1222 | tbl->current_rate = il4965_rate_n_flags_from_tbl(il, |
1223 | tbl, rate, is_green); | 1223 | tbl, rate, is_green); |
1224 | 1224 | ||
1225 | IL_DEBUG_RATE(priv, "LQ: Switch to new mcs %X index is green %X\n", | 1225 | IL_DEBUG_RATE(il, "LQ: Switch to new mcs %X index is green %X\n", |
1226 | tbl->current_rate, is_green); | 1226 | tbl->current_rate, is_green); |
1227 | return 0; | 1227 | return 0; |
1228 | } | 1228 | } |
@@ -1230,7 +1230,7 @@ static int il4965_rs_switch_to_mimo2(struct il_priv *priv, | |||
1230 | /* | 1230 | /* |
1231 | * Set up search table for SISO | 1231 | * Set up search table for SISO |
1232 | */ | 1232 | */ |
1233 | static int il4965_rs_switch_to_siso(struct il_priv *priv, | 1233 | static int il4965_rs_switch_to_siso(struct il_priv *il, |
1234 | struct il_lq_sta *lq_sta, | 1234 | struct il_lq_sta *lq_sta, |
1235 | struct ieee80211_conf *conf, | 1235 | struct ieee80211_conf *conf, |
1236 | struct ieee80211_sta *sta, | 1236 | struct ieee80211_sta *sta, |
@@ -1245,7 +1245,7 @@ static int il4965_rs_switch_to_siso(struct il_priv *priv, | |||
1245 | if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) | 1245 | if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) |
1246 | return -1; | 1246 | return -1; |
1247 | 1247 | ||
1248 | IL_DEBUG_RATE(priv, "LQ: try to switch to SISO\n"); | 1248 | IL_DEBUG_RATE(il, "LQ: try to switch to SISO\n"); |
1249 | 1249 | ||
1250 | tbl->is_dup = lq_sta->is_dup; | 1250 | tbl->is_dup = lq_sta->is_dup; |
1251 | tbl->lq_type = LQ_SISO; | 1251 | tbl->lq_type = LQ_SISO; |
@@ -1253,7 +1253,7 @@ static int il4965_rs_switch_to_siso(struct il_priv *priv, | |||
1253 | tbl->max_search = IL_MAX_SEARCH; | 1253 | tbl->max_search = IL_MAX_SEARCH; |
1254 | rate_mask = lq_sta->active_siso_rate; | 1254 | rate_mask = lq_sta->active_siso_rate; |
1255 | 1255 | ||
1256 | if (il_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap)) | 1256 | if (il_is_ht40_tx_allowed(il, ctx, &sta->ht_cap)) |
1257 | tbl->is_ht40 = 1; | 1257 | tbl->is_ht40 = 1; |
1258 | else | 1258 | else |
1259 | tbl->is_ht40 = 0; | 1259 | tbl->is_ht40 = 0; |
@@ -1262,18 +1262,18 @@ static int il4965_rs_switch_to_siso(struct il_priv *priv, | |||
1262 | tbl->is_SGI = 0; /*11n spec: no SGI in SISO+Greenfield*/ | 1262 | tbl->is_SGI = 0; /*11n spec: no SGI in SISO+Greenfield*/ |
1263 | 1263 | ||
1264 | il4965_rs_set_expected_tpt_table(lq_sta, tbl); | 1264 | il4965_rs_set_expected_tpt_table(lq_sta, tbl); |
1265 | rate = il4965_rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index); | 1265 | rate = il4965_rs_get_best_rate(il, lq_sta, tbl, rate_mask, index); |
1266 | 1266 | ||
1267 | IL_DEBUG_RATE(priv, "LQ: get best rate %d mask %X\n", rate, rate_mask); | 1267 | IL_DEBUG_RATE(il, "LQ: get best rate %d mask %X\n", rate, rate_mask); |
1268 | if ((rate == IL_RATE_INVALID) || !((1 << rate) & rate_mask)) { | 1268 | if ((rate == IL_RATE_INVALID) || !((1 << rate) & rate_mask)) { |
1269 | IL_DEBUG_RATE(priv, | 1269 | IL_DEBUG_RATE(il, |
1270 | "can not switch with index %d rate mask %x\n", | 1270 | "can not switch with index %d rate mask %x\n", |
1271 | rate, rate_mask); | 1271 | rate, rate_mask); |
1272 | return -1; | 1272 | return -1; |
1273 | } | 1273 | } |
1274 | tbl->current_rate = il4965_rate_n_flags_from_tbl(priv, | 1274 | tbl->current_rate = il4965_rate_n_flags_from_tbl(il, |
1275 | tbl, rate, is_green); | 1275 | tbl, rate, is_green); |
1276 | IL_DEBUG_RATE(priv, "LQ: Switch to new mcs %X index is green %X\n", | 1276 | IL_DEBUG_RATE(il, "LQ: Switch to new mcs %X index is green %X\n", |
1277 | tbl->current_rate, is_green); | 1277 | tbl->current_rate, is_green); |
1278 | return 0; | 1278 | return 0; |
1279 | } | 1279 | } |
@@ -1281,7 +1281,7 @@ static int il4965_rs_switch_to_siso(struct il_priv *priv, | |||
1281 | /* | 1281 | /* |
1282 | * Try to switch to new modulation mode from legacy | 1282 | * Try to switch to new modulation mode from legacy |
1283 | */ | 1283 | */ |
1284 | static int il4965_rs_move_legacy_other(struct il_priv *priv, | 1284 | static int il4965_rs_move_legacy_other(struct il_priv *il, |
1285 | struct il_lq_sta *lq_sta, | 1285 | struct il_lq_sta *lq_sta, |
1286 | struct ieee80211_conf *conf, | 1286 | struct ieee80211_conf *conf, |
1287 | struct ieee80211_sta *sta, | 1287 | struct ieee80211_sta *sta, |
@@ -1294,8 +1294,8 @@ static int il4965_rs_move_legacy_other(struct il_priv *priv, | |||
1294 | u32 sz = (sizeof(struct il_scale_tbl_info) - | 1294 | u32 sz = (sizeof(struct il_scale_tbl_info) - |
1295 | (sizeof(struct il_rate_scale_data) * IL_RATE_COUNT)); | 1295 | (sizeof(struct il_rate_scale_data) * IL_RATE_COUNT)); |
1296 | u8 start_action; | 1296 | u8 start_action; |
1297 | u8 valid_tx_ant = priv->hw_params.valid_tx_ant; | 1297 | u8 valid_tx_ant = il->hw_params.valid_tx_ant; |
1298 | u8 tx_chains_num = priv->hw_params.tx_chains_num; | 1298 | u8 tx_chains_num = il->hw_params.tx_chains_num; |
1299 | int ret = 0; | 1299 | int ret = 0; |
1300 | u8 update_search_tbl_counter = 0; | 1300 | u8 update_search_tbl_counter = 0; |
1301 | 1301 | ||
@@ -1307,7 +1307,7 @@ static int il4965_rs_move_legacy_other(struct il_priv *priv, | |||
1307 | switch (tbl->action) { | 1307 | switch (tbl->action) { |
1308 | case IL_LEGACY_SWITCH_ANTENNA1: | 1308 | case IL_LEGACY_SWITCH_ANTENNA1: |
1309 | case IL_LEGACY_SWITCH_ANTENNA2: | 1309 | case IL_LEGACY_SWITCH_ANTENNA2: |
1310 | IL_DEBUG_RATE(priv, "LQ: Legacy toggle Antenna\n"); | 1310 | IL_DEBUG_RATE(il, "LQ: Legacy toggle Antenna\n"); |
1311 | 1311 | ||
1312 | if ((tbl->action == IL_LEGACY_SWITCH_ANTENNA1 && | 1312 | if ((tbl->action == IL_LEGACY_SWITCH_ANTENNA1 && |
1313 | tx_chains_num <= 1) || | 1313 | tx_chains_num <= 1) || |
@@ -1331,12 +1331,12 @@ static int il4965_rs_move_legacy_other(struct il_priv *priv, | |||
1331 | } | 1331 | } |
1332 | break; | 1332 | break; |
1333 | case IL_LEGACY_SWITCH_SISO: | 1333 | case IL_LEGACY_SWITCH_SISO: |
1334 | IL_DEBUG_RATE(priv, "LQ: Legacy switch to SISO\n"); | 1334 | IL_DEBUG_RATE(il, "LQ: Legacy switch to SISO\n"); |
1335 | 1335 | ||
1336 | /* Set up search table to try SISO */ | 1336 | /* Set up search table to try SISO */ |
1337 | memcpy(search_tbl, tbl, sz); | 1337 | memcpy(search_tbl, tbl, sz); |
1338 | search_tbl->is_SGI = 0; | 1338 | search_tbl->is_SGI = 0; |
1339 | ret = il4965_rs_switch_to_siso(priv, lq_sta, conf, sta, | 1339 | ret = il4965_rs_switch_to_siso(il, lq_sta, conf, sta, |
1340 | search_tbl, index); | 1340 | search_tbl, index); |
1341 | if (!ret) { | 1341 | if (!ret) { |
1342 | lq_sta->action_counter = 0; | 1342 | lq_sta->action_counter = 0; |
@@ -1347,7 +1347,7 @@ static int il4965_rs_move_legacy_other(struct il_priv *priv, | |||
1347 | case IL_LEGACY_SWITCH_MIMO2_AB: | 1347 | case IL_LEGACY_SWITCH_MIMO2_AB: |
1348 | case IL_LEGACY_SWITCH_MIMO2_AC: | 1348 | case IL_LEGACY_SWITCH_MIMO2_AC: |
1349 | case IL_LEGACY_SWITCH_MIMO2_BC: | 1349 | case IL_LEGACY_SWITCH_MIMO2_BC: |
1350 | IL_DEBUG_RATE(priv, "LQ: Legacy switch to MIMO2\n"); | 1350 | IL_DEBUG_RATE(il, "LQ: Legacy switch to MIMO2\n"); |
1351 | 1351 | ||
1352 | /* Set up search table to try MIMO */ | 1352 | /* Set up search table to try MIMO */ |
1353 | memcpy(search_tbl, tbl, sz); | 1353 | memcpy(search_tbl, tbl, sz); |
@@ -1364,7 +1364,7 @@ static int il4965_rs_move_legacy_other(struct il_priv *priv, | |||
1364 | search_tbl->ant_type)) | 1364 | search_tbl->ant_type)) |
1365 | break; | 1365 | break; |
1366 | 1366 | ||
1367 | ret = il4965_rs_switch_to_mimo2(priv, lq_sta, | 1367 | ret = il4965_rs_switch_to_mimo2(il, lq_sta, |
1368 | conf, sta, | 1368 | conf, sta, |
1369 | search_tbl, index); | 1369 | search_tbl, index); |
1370 | if (!ret) { | 1370 | if (!ret) { |
@@ -1398,7 +1398,7 @@ out: | |||
1398 | /* | 1398 | /* |
1399 | * Try to switch to new modulation mode from SISO | 1399 | * Try to switch to new modulation mode from SISO |
1400 | */ | 1400 | */ |
1401 | static int il4965_rs_move_siso_to_other(struct il_priv *priv, | 1401 | static int il4965_rs_move_siso_to_other(struct il_priv *il, |
1402 | struct il_lq_sta *lq_sta, | 1402 | struct il_lq_sta *lq_sta, |
1403 | struct ieee80211_conf *conf, | 1403 | struct ieee80211_conf *conf, |
1404 | struct ieee80211_sta *sta, int index) | 1404 | struct ieee80211_sta *sta, int index) |
@@ -1412,8 +1412,8 @@ static int il4965_rs_move_siso_to_other(struct il_priv *priv, | |||
1412 | u32 sz = (sizeof(struct il_scale_tbl_info) - | 1412 | u32 sz = (sizeof(struct il_scale_tbl_info) - |
1413 | (sizeof(struct il_rate_scale_data) * IL_RATE_COUNT)); | 1413 | (sizeof(struct il_rate_scale_data) * IL_RATE_COUNT)); |
1414 | u8 start_action; | 1414 | u8 start_action; |
1415 | u8 valid_tx_ant = priv->hw_params.valid_tx_ant; | 1415 | u8 valid_tx_ant = il->hw_params.valid_tx_ant; |
1416 | u8 tx_chains_num = priv->hw_params.tx_chains_num; | 1416 | u8 tx_chains_num = il->hw_params.tx_chains_num; |
1417 | u8 update_search_tbl_counter = 0; | 1417 | u8 update_search_tbl_counter = 0; |
1418 | int ret; | 1418 | int ret; |
1419 | 1419 | ||
@@ -1424,7 +1424,7 @@ static int il4965_rs_move_siso_to_other(struct il_priv *priv, | |||
1424 | switch (tbl->action) { | 1424 | switch (tbl->action) { |
1425 | case IL_SISO_SWITCH_ANTENNA1: | 1425 | case IL_SISO_SWITCH_ANTENNA1: |
1426 | case IL_SISO_SWITCH_ANTENNA2: | 1426 | case IL_SISO_SWITCH_ANTENNA2: |
1427 | IL_DEBUG_RATE(priv, "LQ: SISO toggle Antenna\n"); | 1427 | IL_DEBUG_RATE(il, "LQ: SISO toggle Antenna\n"); |
1428 | if ((tbl->action == IL_SISO_SWITCH_ANTENNA1 && | 1428 | if ((tbl->action == IL_SISO_SWITCH_ANTENNA1 && |
1429 | tx_chains_num <= 1) || | 1429 | tx_chains_num <= 1) || |
1430 | (tbl->action == IL_SISO_SWITCH_ANTENNA2 && | 1430 | (tbl->action == IL_SISO_SWITCH_ANTENNA2 && |
@@ -1444,7 +1444,7 @@ static int il4965_rs_move_siso_to_other(struct il_priv *priv, | |||
1444 | case IL_SISO_SWITCH_MIMO2_AB: | 1444 | case IL_SISO_SWITCH_MIMO2_AB: |
1445 | case IL_SISO_SWITCH_MIMO2_AC: | 1445 | case IL_SISO_SWITCH_MIMO2_AC: |
1446 | case IL_SISO_SWITCH_MIMO2_BC: | 1446 | case IL_SISO_SWITCH_MIMO2_BC: |
1447 | IL_DEBUG_RATE(priv, "LQ: SISO switch to MIMO2\n"); | 1447 | IL_DEBUG_RATE(il, "LQ: SISO switch to MIMO2\n"); |
1448 | memcpy(search_tbl, tbl, sz); | 1448 | memcpy(search_tbl, tbl, sz); |
1449 | search_tbl->is_SGI = 0; | 1449 | search_tbl->is_SGI = 0; |
1450 | 1450 | ||
@@ -1459,7 +1459,7 @@ static int il4965_rs_move_siso_to_other(struct il_priv *priv, | |||
1459 | search_tbl->ant_type)) | 1459 | search_tbl->ant_type)) |
1460 | break; | 1460 | break; |
1461 | 1461 | ||
1462 | ret = il4965_rs_switch_to_mimo2(priv, lq_sta, | 1462 | ret = il4965_rs_switch_to_mimo2(il, lq_sta, |
1463 | conf, sta, | 1463 | conf, sta, |
1464 | search_tbl, index); | 1464 | search_tbl, index); |
1465 | if (!ret) | 1465 | if (!ret) |
@@ -1473,14 +1473,14 @@ static int il4965_rs_move_siso_to_other(struct il_priv *priv, | |||
1473 | IEEE80211_HT_CAP_SGI_40)) | 1473 | IEEE80211_HT_CAP_SGI_40)) |
1474 | break; | 1474 | break; |
1475 | 1475 | ||
1476 | IL_DEBUG_RATE(priv, "LQ: SISO toggle SGI/NGI\n"); | 1476 | IL_DEBUG_RATE(il, "LQ: SISO toggle SGI/NGI\n"); |
1477 | 1477 | ||
1478 | memcpy(search_tbl, tbl, sz); | 1478 | memcpy(search_tbl, tbl, sz); |
1479 | if (is_green) { | 1479 | if (is_green) { |
1480 | if (!tbl->is_SGI) | 1480 | if (!tbl->is_SGI) |
1481 | break; | 1481 | break; |
1482 | else | 1482 | else |
1483 | IL_ERR(priv, | 1483 | IL_ERR(il, |
1484 | "SGI was set in GF+SISO\n"); | 1484 | "SGI was set in GF+SISO\n"); |
1485 | } | 1485 | } |
1486 | search_tbl->is_SGI = !tbl->is_SGI; | 1486 | search_tbl->is_SGI = !tbl->is_SGI; |
@@ -1491,7 +1491,7 @@ static int il4965_rs_move_siso_to_other(struct il_priv *priv, | |||
1491 | break; | 1491 | break; |
1492 | } | 1492 | } |
1493 | search_tbl->current_rate = | 1493 | search_tbl->current_rate = |
1494 | il4965_rate_n_flags_from_tbl(priv, search_tbl, | 1494 | il4965_rate_n_flags_from_tbl(il, search_tbl, |
1495 | index, is_green); | 1495 | index, is_green); |
1496 | update_search_tbl_counter = 1; | 1496 | update_search_tbl_counter = 1; |
1497 | goto out; | 1497 | goto out; |
@@ -1520,7 +1520,7 @@ static int il4965_rs_move_siso_to_other(struct il_priv *priv, | |||
1520 | /* | 1520 | /* |
1521 | * Try to switch to new modulation mode from MIMO2 | 1521 | * Try to switch to new modulation mode from MIMO2 |
1522 | */ | 1522 | */ |
1523 | static int il4965_rs_move_mimo2_to_other(struct il_priv *priv, | 1523 | static int il4965_rs_move_mimo2_to_other(struct il_priv *il, |
1524 | struct il_lq_sta *lq_sta, | 1524 | struct il_lq_sta *lq_sta, |
1525 | struct ieee80211_conf *conf, | 1525 | struct ieee80211_conf *conf, |
1526 | struct ieee80211_sta *sta, int index) | 1526 | struct ieee80211_sta *sta, int index) |
@@ -1534,8 +1534,8 @@ static int il4965_rs_move_mimo2_to_other(struct il_priv *priv, | |||
1534 | u32 sz = (sizeof(struct il_scale_tbl_info) - | 1534 | u32 sz = (sizeof(struct il_scale_tbl_info) - |
1535 | (sizeof(struct il_rate_scale_data) * IL_RATE_COUNT)); | 1535 | (sizeof(struct il_rate_scale_data) * IL_RATE_COUNT)); |
1536 | u8 start_action; | 1536 | u8 start_action; |
1537 | u8 valid_tx_ant = priv->hw_params.valid_tx_ant; | 1537 | u8 valid_tx_ant = il->hw_params.valid_tx_ant; |
1538 | u8 tx_chains_num = priv->hw_params.tx_chains_num; | 1538 | u8 tx_chains_num = il->hw_params.tx_chains_num; |
1539 | u8 update_search_tbl_counter = 0; | 1539 | u8 update_search_tbl_counter = 0; |
1540 | int ret; | 1540 | int ret; |
1541 | 1541 | ||
@@ -1545,7 +1545,7 @@ static int il4965_rs_move_mimo2_to_other(struct il_priv *priv, | |||
1545 | switch (tbl->action) { | 1545 | switch (tbl->action) { |
1546 | case IL_MIMO2_SWITCH_ANTENNA1: | 1546 | case IL_MIMO2_SWITCH_ANTENNA1: |
1547 | case IL_MIMO2_SWITCH_ANTENNA2: | 1547 | case IL_MIMO2_SWITCH_ANTENNA2: |
1548 | IL_DEBUG_RATE(priv, "LQ: MIMO2 toggle Antennas\n"); | 1548 | IL_DEBUG_RATE(il, "LQ: MIMO2 toggle Antennas\n"); |
1549 | 1549 | ||
1550 | if (tx_chains_num <= 2) | 1550 | if (tx_chains_num <= 2) |
1551 | break; | 1551 | break; |
@@ -1563,7 +1563,7 @@ static int il4965_rs_move_mimo2_to_other(struct il_priv *priv, | |||
1563 | case IL_MIMO2_SWITCH_SISO_A: | 1563 | case IL_MIMO2_SWITCH_SISO_A: |
1564 | case IL_MIMO2_SWITCH_SISO_B: | 1564 | case IL_MIMO2_SWITCH_SISO_B: |
1565 | case IL_MIMO2_SWITCH_SISO_C: | 1565 | case IL_MIMO2_SWITCH_SISO_C: |
1566 | IL_DEBUG_RATE(priv, "LQ: MIMO2 switch to SISO\n"); | 1566 | IL_DEBUG_RATE(il, "LQ: MIMO2 switch to SISO\n"); |
1567 | 1567 | ||
1568 | /* Set up new search table for SISO */ | 1568 | /* Set up new search table for SISO */ |
1569 | memcpy(search_tbl, tbl, sz); | 1569 | memcpy(search_tbl, tbl, sz); |
@@ -1579,7 +1579,7 @@ static int il4965_rs_move_mimo2_to_other(struct il_priv *priv, | |||
1579 | search_tbl->ant_type)) | 1579 | search_tbl->ant_type)) |
1580 | break; | 1580 | break; |
1581 | 1581 | ||
1582 | ret = il4965_rs_switch_to_siso(priv, lq_sta, | 1582 | ret = il4965_rs_switch_to_siso(il, lq_sta, |
1583 | conf, sta, | 1583 | conf, sta, |
1584 | search_tbl, index); | 1584 | search_tbl, index); |
1585 | if (!ret) | 1585 | if (!ret) |
@@ -1595,7 +1595,7 @@ static int il4965_rs_move_mimo2_to_other(struct il_priv *priv, | |||
1595 | IEEE80211_HT_CAP_SGI_40)) | 1595 | IEEE80211_HT_CAP_SGI_40)) |
1596 | break; | 1596 | break; |
1597 | 1597 | ||
1598 | IL_DEBUG_RATE(priv, "LQ: MIMO2 toggle SGI/NGI\n"); | 1598 | IL_DEBUG_RATE(il, "LQ: MIMO2 toggle SGI/NGI\n"); |
1599 | 1599 | ||
1600 | /* Set up new search table for MIMO2 */ | 1600 | /* Set up new search table for MIMO2 */ |
1601 | memcpy(search_tbl, tbl, sz); | 1601 | memcpy(search_tbl, tbl, sz); |
@@ -1613,7 +1613,7 @@ static int il4965_rs_move_mimo2_to_other(struct il_priv *priv, | |||
1613 | break; | 1613 | break; |
1614 | } | 1614 | } |
1615 | search_tbl->current_rate = | 1615 | search_tbl->current_rate = |
1616 | il4965_rate_n_flags_from_tbl(priv, search_tbl, | 1616 | il4965_rate_n_flags_from_tbl(il, search_tbl, |
1617 | index, is_green); | 1617 | index, is_green); |
1618 | update_search_tbl_counter = 1; | 1618 | update_search_tbl_counter = 1; |
1619 | goto out; | 1619 | goto out; |
@@ -1654,9 +1654,9 @@ il4965_rs_stay_in_table(struct il_lq_sta *lq_sta, bool force_search) | |||
1654 | int i; | 1654 | int i; |
1655 | int active_tbl; | 1655 | int active_tbl; |
1656 | int flush_interval_passed = 0; | 1656 | int flush_interval_passed = 0; |
1657 | struct il_priv *priv; | 1657 | struct il_priv *il; |
1658 | 1658 | ||
1659 | priv = lq_sta->drv; | 1659 | il = lq_sta->drv; |
1660 | active_tbl = lq_sta->active_tbl; | 1660 | active_tbl = lq_sta->active_tbl; |
1661 | 1661 | ||
1662 | tbl = &(lq_sta->lq_info[active_tbl]); | 1662 | 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) | |||
1684 | (lq_sta->total_success > lq_sta->max_success_limit) || | 1684 | (lq_sta->total_success > lq_sta->max_success_limit) || |
1685 | ((!lq_sta->search_better_tbl) && (lq_sta->flush_timer) | 1685 | ((!lq_sta->search_better_tbl) && (lq_sta->flush_timer) |
1686 | && (flush_interval_passed))) { | 1686 | && (flush_interval_passed))) { |
1687 | IL_DEBUG_RATE(priv, "LQ: stay is expired %d %d %d\n:", | 1687 | IL_DEBUG_RATE(il, "LQ: stay is expired %d %d %d\n:", |
1688 | lq_sta->total_failed, | 1688 | lq_sta->total_failed, |
1689 | lq_sta->total_success, | 1689 | lq_sta->total_success, |
1690 | flush_interval_passed); | 1690 | flush_interval_passed); |
@@ -1707,7 +1707,7 @@ il4965_rs_stay_in_table(struct il_lq_sta *lq_sta, bool force_search) | |||
1707 | lq_sta->table_count_limit) { | 1707 | lq_sta->table_count_limit) { |
1708 | lq_sta->table_count = 0; | 1708 | lq_sta->table_count = 0; |
1709 | 1709 | ||
1710 | IL_DEBUG_RATE(priv, | 1710 | IL_DEBUG_RATE(il, |
1711 | "LQ: stay in table clear win\n"); | 1711 | "LQ: stay in table clear win\n"); |
1712 | for (i = 0; i < IL_RATE_COUNT; i++) | 1712 | for (i = 0; i < IL_RATE_COUNT; i++) |
1713 | il4965_rs_rate_scale_clear_window( | 1713 | il4965_rs_rate_scale_clear_window( |
@@ -1730,7 +1730,7 @@ il4965_rs_stay_in_table(struct il_lq_sta *lq_sta, bool force_search) | |||
1730 | * setup rate table in uCode | 1730 | * setup rate table in uCode |
1731 | * return rate_n_flags as used in the table | 1731 | * return rate_n_flags as used in the table |
1732 | */ | 1732 | */ |
1733 | static u32 il4965_rs_update_rate_tbl(struct il_priv *priv, | 1733 | static u32 il4965_rs_update_rate_tbl(struct il_priv *il, |
1734 | struct il_rxon_context *ctx, | 1734 | struct il_rxon_context *ctx, |
1735 | struct il_lq_sta *lq_sta, | 1735 | struct il_lq_sta *lq_sta, |
1736 | struct il_scale_tbl_info *tbl, | 1736 | struct il_scale_tbl_info *tbl, |
@@ -1739,9 +1739,9 @@ static u32 il4965_rs_update_rate_tbl(struct il_priv *priv, | |||
1739 | u32 rate; | 1739 | u32 rate; |
1740 | 1740 | ||
1741 | /* Update uCode's rate table. */ | 1741 | /* Update uCode's rate table. */ |
1742 | rate = il4965_rate_n_flags_from_tbl(priv, tbl, index, is_green); | 1742 | rate = il4965_rate_n_flags_from_tbl(il, tbl, index, is_green); |
1743 | il4965_rs_fill_link_cmd(priv, lq_sta, rate); | 1743 | il4965_rs_fill_link_cmd(il, lq_sta, rate); |
1744 | il_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false); | 1744 | il_send_lq_cmd(il, ctx, &lq_sta->lq, CMD_ASYNC, false); |
1745 | 1745 | ||
1746 | return rate; | 1746 | return rate; |
1747 | } | 1747 | } |
@@ -1749,12 +1749,12 @@ static u32 il4965_rs_update_rate_tbl(struct il_priv *priv, | |||
1749 | /* | 1749 | /* |
1750 | * Do rate scaling and search for new modulation mode. | 1750 | * Do rate scaling and search for new modulation mode. |
1751 | */ | 1751 | */ |
1752 | static void il4965_rs_rate_scale_perform(struct il_priv *priv, | 1752 | static void il4965_rs_rate_scale_perform(struct il_priv *il, |
1753 | struct sk_buff *skb, | 1753 | struct sk_buff *skb, |
1754 | struct ieee80211_sta *sta, | 1754 | struct ieee80211_sta *sta, |
1755 | struct il_lq_sta *lq_sta) | 1755 | struct il_lq_sta *lq_sta) |
1756 | { | 1756 | { |
1757 | struct ieee80211_hw *hw = priv->hw; | 1757 | struct ieee80211_hw *hw = il->hw; |
1758 | struct ieee80211_conf *conf = &hw->conf; | 1758 | struct ieee80211_conf *conf = &hw->conf; |
1759 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 1759 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
1760 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 1760 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
@@ -1783,7 +1783,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, | |||
1783 | struct il_station_priv *sta_priv = (void *)sta->drv_priv; | 1783 | struct il_station_priv *sta_priv = (void *)sta->drv_priv; |
1784 | struct il_rxon_context *ctx = sta_priv->common.ctx; | 1784 | struct il_rxon_context *ctx = sta_priv->common.ctx; |
1785 | 1785 | ||
1786 | IL_DEBUG_RATE(priv, "rate scale calculate new rate for skb\n"); | 1786 | IL_DEBUG_RATE(il, "rate scale calculate new rate for skb\n"); |
1787 | 1787 | ||
1788 | /* Send management frames and NO_ACK data using lowest rate. */ | 1788 | /* Send management frames and NO_ACK data using lowest rate. */ |
1789 | /* TODO: this could probably be improved.. */ | 1789 | /* TODO: this could probably be improved.. */ |
@@ -1798,7 +1798,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, | |||
1798 | 1798 | ||
1799 | tid = il4965_rs_tl_add_packet(lq_sta, hdr); | 1799 | tid = il4965_rs_tl_add_packet(lq_sta, hdr); |
1800 | if ((tid != MAX_TID_COUNT) && (lq_sta->tx_agg_tid_en & (1 << tid))) { | 1800 | if ((tid != MAX_TID_COUNT) && (lq_sta->tx_agg_tid_en & (1 << tid))) { |
1801 | tid_data = &priv->stations[lq_sta->lq.sta_id].tid[tid]; | 1801 | tid_data = &il->stations[lq_sta->lq.sta_id].tid[tid]; |
1802 | if (tid_data->agg.state == IL_AGG_OFF) | 1802 | if (tid_data->agg.state == IL_AGG_OFF) |
1803 | lq_sta->is_agg = 0; | 1803 | lq_sta->is_agg = 0; |
1804 | else | 1804 | else |
@@ -1826,13 +1826,13 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, | |||
1826 | /* current tx rate */ | 1826 | /* current tx rate */ |
1827 | index = lq_sta->last_txrate_idx; | 1827 | index = lq_sta->last_txrate_idx; |
1828 | 1828 | ||
1829 | IL_DEBUG_RATE(priv, "Rate scale index %d for type %d\n", index, | 1829 | IL_DEBUG_RATE(il, "Rate scale index %d for type %d\n", index, |
1830 | tbl->lq_type); | 1830 | tbl->lq_type); |
1831 | 1831 | ||
1832 | /* rates available for this association, and for modulation mode */ | 1832 | /* rates available for this association, and for modulation mode */ |
1833 | rate_mask = il4965_rs_get_supported_rates(lq_sta, hdr, tbl->lq_type); | 1833 | rate_mask = il4965_rs_get_supported_rates(lq_sta, hdr, tbl->lq_type); |
1834 | 1834 | ||
1835 | IL_DEBUG_RATE(priv, "mask 0x%04X\n", rate_mask); | 1835 | IL_DEBUG_RATE(il, "mask 0x%04X\n", rate_mask); |
1836 | 1836 | ||
1837 | /* mask with station rate restriction */ | 1837 | /* mask with station rate restriction */ |
1838 | if (is_legacy(tbl->lq_type)) { | 1838 | if (is_legacy(tbl->lq_type)) { |
@@ -1851,7 +1851,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, | |||
1851 | rate_scale_index_msk = rate_mask; | 1851 | rate_scale_index_msk = rate_mask; |
1852 | 1852 | ||
1853 | if (!((1 << index) & rate_scale_index_msk)) { | 1853 | if (!((1 << index) & rate_scale_index_msk)) { |
1854 | IL_ERR(priv, "Current Rate is not valid\n"); | 1854 | IL_ERR(il, "Current Rate is not valid\n"); |
1855 | if (lq_sta->search_better_tbl) { | 1855 | if (lq_sta->search_better_tbl) { |
1856 | /* revert to active table if search table is not valid*/ | 1856 | /* revert to active table if search table is not valid*/ |
1857 | tbl->lq_type = LQ_NONE; | 1857 | tbl->lq_type = LQ_NONE; |
@@ -1859,7 +1859,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, | |||
1859 | tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); | 1859 | tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); |
1860 | /* get "active" rate info */ | 1860 | /* get "active" rate info */ |
1861 | index = il4965_hwrate_to_plcp_idx(tbl->current_rate); | 1861 | index = il4965_hwrate_to_plcp_idx(tbl->current_rate); |
1862 | rate = il4965_rs_update_rate_tbl(priv, ctx, lq_sta, | 1862 | rate = il4965_rs_update_rate_tbl(il, ctx, lq_sta, |
1863 | tbl, index, is_green); | 1863 | tbl, index, is_green); |
1864 | } | 1864 | } |
1865 | return; | 1865 | return; |
@@ -1867,7 +1867,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, | |||
1867 | 1867 | ||
1868 | /* Get expected throughput table and history window for current rate */ | 1868 | /* Get expected throughput table and history window for current rate */ |
1869 | if (!tbl->expected_tpt) { | 1869 | if (!tbl->expected_tpt) { |
1870 | IL_ERR(priv, "tbl->expected_tpt is NULL\n"); | 1870 | IL_ERR(il, "tbl->expected_tpt is NULL\n"); |
1871 | return; | 1871 | return; |
1872 | } | 1872 | } |
1873 | 1873 | ||
@@ -1892,7 +1892,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, | |||
1892 | fail_count = window->counter - window->success_counter; | 1892 | fail_count = window->counter - window->success_counter; |
1893 | if ((fail_count < IL_RATE_MIN_FAILURE_TH) && | 1893 | if ((fail_count < IL_RATE_MIN_FAILURE_TH) && |
1894 | (window->success_counter < IL_RATE_MIN_SUCCESS_TH)) { | 1894 | (window->success_counter < IL_RATE_MIN_SUCCESS_TH)) { |
1895 | IL_DEBUG_RATE(priv, "LQ: still below TH. succ=%d total=%d " | 1895 | IL_DEBUG_RATE(il, "LQ: still below TH. succ=%d total=%d " |
1896 | "for index %d\n", | 1896 | "for index %d\n", |
1897 | window->success_counter, window->counter, index); | 1897 | window->success_counter, window->counter, index); |
1898 | 1898 | ||
@@ -1909,7 +1909,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, | |||
1909 | * actual average throughput */ | 1909 | * actual average throughput */ |
1910 | if (window->average_tpt != ((window->success_ratio * | 1910 | if (window->average_tpt != ((window->success_ratio * |
1911 | tbl->expected_tpt[index] + 64) / 128)) { | 1911 | tbl->expected_tpt[index] + 64) / 128)) { |
1912 | IL_ERR(priv, | 1912 | IL_ERR(il, |
1913 | "expected_tpt should have been calculated by now\n"); | 1913 | "expected_tpt should have been calculated by now\n"); |
1914 | window->average_tpt = ((window->success_ratio * | 1914 | window->average_tpt = ((window->success_ratio * |
1915 | tbl->expected_tpt[index] + 64) / 128); | 1915 | tbl->expected_tpt[index] + 64) / 128); |
@@ -1922,7 +1922,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, | |||
1922 | * continuing to use the setup that we've been trying. */ | 1922 | * continuing to use the setup that we've been trying. */ |
1923 | if (window->average_tpt > lq_sta->last_tpt) { | 1923 | if (window->average_tpt > lq_sta->last_tpt) { |
1924 | 1924 | ||
1925 | IL_DEBUG_RATE(priv, "LQ: SWITCHING TO NEW TABLE " | 1925 | IL_DEBUG_RATE(il, "LQ: SWITCHING TO NEW TABLE " |
1926 | "suc=%d cur-tpt=%d old-tpt=%d\n", | 1926 | "suc=%d cur-tpt=%d old-tpt=%d\n", |
1927 | window->success_ratio, | 1927 | window->success_ratio, |
1928 | window->average_tpt, | 1928 | window->average_tpt, |
@@ -1938,7 +1938,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, | |||
1938 | /* Else poor success; go back to mode in "active" table */ | 1938 | /* Else poor success; go back to mode in "active" table */ |
1939 | } else { | 1939 | } else { |
1940 | 1940 | ||
1941 | IL_DEBUG_RATE(priv, "LQ: GOING BACK TO THE OLD TABLE " | 1941 | IL_DEBUG_RATE(il, "LQ: GOING BACK TO THE OLD TABLE " |
1942 | "suc=%d cur-tpt=%d old-tpt=%d\n", | 1942 | "suc=%d cur-tpt=%d old-tpt=%d\n", |
1943 | window->success_ratio, | 1943 | window->success_ratio, |
1944 | window->average_tpt, | 1944 | window->average_tpt, |
@@ -1968,7 +1968,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, | |||
1968 | 1968 | ||
1969 | /* (Else) not in search of better modulation mode, try for better | 1969 | /* (Else) not in search of better modulation mode, try for better |
1970 | * starting rate, while staying in this mode. */ | 1970 | * starting rate, while staying in this mode. */ |
1971 | high_low = il4965_rs_get_adjacent_rate(priv, index, | 1971 | high_low = il4965_rs_get_adjacent_rate(il, index, |
1972 | rate_scale_index_msk, | 1972 | rate_scale_index_msk, |
1973 | tbl->lq_type); | 1973 | tbl->lq_type); |
1974 | low = high_low & 0xff; | 1974 | low = high_low & 0xff; |
@@ -1992,7 +1992,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, | |||
1992 | 1992 | ||
1993 | /* Too many failures, decrease rate */ | 1993 | /* Too many failures, decrease rate */ |
1994 | if ((sr <= IL_RATE_DECREASE_TH) || (current_tpt == 0)) { | 1994 | if ((sr <= IL_RATE_DECREASE_TH) || (current_tpt == 0)) { |
1995 | IL_DEBUG_RATE(priv, | 1995 | IL_DEBUG_RATE(il, |
1996 | "decrease rate because of low success_ratio\n"); | 1996 | "decrease rate because of low success_ratio\n"); |
1997 | scale_action = -1; | 1997 | scale_action = -1; |
1998 | 1998 | ||
@@ -2031,7 +2031,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, | |||
2031 | } else if (low_tpt != IL_INVALID_VALUE) { | 2031 | } else if (low_tpt != IL_INVALID_VALUE) { |
2032 | /* Lower rate has better throughput */ | 2032 | /* Lower rate has better throughput */ |
2033 | if (low_tpt > current_tpt) { | 2033 | if (low_tpt > current_tpt) { |
2034 | IL_DEBUG_RATE(priv, | 2034 | IL_DEBUG_RATE(il, |
2035 | "decrease rate because of low tpt\n"); | 2035 | "decrease rate because of low tpt\n"); |
2036 | scale_action = -1; | 2036 | scale_action = -1; |
2037 | } else if (sr >= IL_RATE_INCREASE_TH) { | 2037 | } else if (sr >= IL_RATE_INCREASE_TH) { |
@@ -2070,14 +2070,14 @@ static void il4965_rs_rate_scale_perform(struct il_priv *priv, | |||
2070 | break; | 2070 | break; |
2071 | } | 2071 | } |
2072 | 2072 | ||
2073 | IL_DEBUG_RATE(priv, "choose rate scale index %d action %d low %d " | 2073 | IL_DEBUG_RATE(il, "choose rate scale index %d action %d low %d " |
2074 | "high %d type %d\n", | 2074 | "high %d type %d\n", |
2075 | index, scale_action, low, high, tbl->lq_type); | 2075 | index, scale_action, low, high, tbl->lq_type); |
2076 | 2076 | ||
2077 | lq_update: | 2077 | lq_update: |
2078 | /* Replace uCode's rate table for the destination station. */ | 2078 | /* Replace uCode's rate table for the destination station. */ |
2079 | if (update_lq) | 2079 | if (update_lq) |
2080 | rate = il4965_rs_update_rate_tbl(priv, ctx, lq_sta, | 2080 | rate = il4965_rs_update_rate_tbl(il, ctx, lq_sta, |
2081 | tbl, index, is_green); | 2081 | tbl, index, is_green); |
2082 | 2082 | ||
2083 | /* Should we stay with this modulation mode, | 2083 | /* Should we stay with this modulation mode, |
@@ -2098,13 +2098,13 @@ lq_update: | |||
2098 | /* Select a new "search" modulation mode to try. | 2098 | /* Select a new "search" modulation mode to try. |
2099 | * If one is found, set up the new "search" table. */ | 2099 | * If one is found, set up the new "search" table. */ |
2100 | if (is_legacy(tbl->lq_type)) | 2100 | if (is_legacy(tbl->lq_type)) |
2101 | il4965_rs_move_legacy_other(priv, lq_sta, | 2101 | il4965_rs_move_legacy_other(il, lq_sta, |
2102 | conf, sta, index); | 2102 | conf, sta, index); |
2103 | else if (is_siso(tbl->lq_type)) | 2103 | else if (is_siso(tbl->lq_type)) |
2104 | il4965_rs_move_siso_to_other(priv, lq_sta, | 2104 | il4965_rs_move_siso_to_other(il, lq_sta, |
2105 | conf, sta, index); | 2105 | conf, sta, index); |
2106 | else /* (is_mimo2(tbl->lq_type)) */ | 2106 | else /* (is_mimo2(tbl->lq_type)) */ |
2107 | il4965_rs_move_mimo2_to_other(priv, lq_sta, | 2107 | il4965_rs_move_mimo2_to_other(il, lq_sta, |
2108 | conf, sta, index); | 2108 | conf, sta, index); |
2109 | 2109 | ||
2110 | /* If new "search" mode was selected, set up in uCode table */ | 2110 | /* If new "search" mode was selected, set up in uCode table */ |
@@ -2118,12 +2118,12 @@ lq_update: | |||
2118 | /* Use new "search" start rate */ | 2118 | /* Use new "search" start rate */ |
2119 | index = il4965_hwrate_to_plcp_idx(tbl->current_rate); | 2119 | index = il4965_hwrate_to_plcp_idx(tbl->current_rate); |
2120 | 2120 | ||
2121 | IL_DEBUG_RATE(priv, | 2121 | IL_DEBUG_RATE(il, |
2122 | "Switch current mcs: %X index: %d\n", | 2122 | "Switch current mcs: %X index: %d\n", |
2123 | tbl->current_rate, index); | 2123 | tbl->current_rate, index); |
2124 | il4965_rs_fill_link_cmd(priv, lq_sta, | 2124 | il4965_rs_fill_link_cmd(il, lq_sta, |
2125 | tbl->current_rate); | 2125 | tbl->current_rate); |
2126 | il_send_lq_cmd(priv, ctx, | 2126 | il_send_lq_cmd(il, ctx, |
2127 | &lq_sta->lq, CMD_ASYNC, false); | 2127 | &lq_sta->lq, CMD_ASYNC, false); |
2128 | } else | 2128 | } else |
2129 | done_search = 1; | 2129 | done_search = 1; |
@@ -2138,8 +2138,8 @@ lq_update: | |||
2138 | tbl1 = &(lq_sta->lq_info[lq_sta->active_tbl]); | 2138 | tbl1 = &(lq_sta->lq_info[lq_sta->active_tbl]); |
2139 | if (is_legacy(tbl1->lq_type) && !conf_is_ht(conf) && | 2139 | if (is_legacy(tbl1->lq_type) && !conf_is_ht(conf) && |
2140 | lq_sta->action_counter > tbl1->max_search) { | 2140 | lq_sta->action_counter > tbl1->max_search) { |
2141 | IL_DEBUG_RATE(priv, "LQ: STAY in legacy table\n"); | 2141 | IL_DEBUG_RATE(il, "LQ: STAY in legacy table\n"); |
2142 | il4965_rs_set_stay_in_table(priv, 1, lq_sta); | 2142 | il4965_rs_set_stay_in_table(il, 1, lq_sta); |
2143 | } | 2143 | } |
2144 | 2144 | ||
2145 | /* If we're in an HT mode, and all 3 mode switch actions | 2145 | /* If we're in an HT mode, and all 3 mode switch actions |
@@ -2151,21 +2151,21 @@ lq_update: | |||
2151 | (lq_sta->tx_agg_tid_en & (1 << tid)) && | 2151 | (lq_sta->tx_agg_tid_en & (1 << tid)) && |
2152 | (tid != MAX_TID_COUNT)) { | 2152 | (tid != MAX_TID_COUNT)) { |
2153 | tid_data = | 2153 | tid_data = |
2154 | &priv->stations[lq_sta->lq.sta_id].tid[tid]; | 2154 | &il->stations[lq_sta->lq.sta_id].tid[tid]; |
2155 | if (tid_data->agg.state == IL_AGG_OFF) { | 2155 | if (tid_data->agg.state == IL_AGG_OFF) { |
2156 | IL_DEBUG_RATE(priv, | 2156 | IL_DEBUG_RATE(il, |
2157 | "try to aggregate tid %d\n", | 2157 | "try to aggregate tid %d\n", |
2158 | tid); | 2158 | tid); |
2159 | il4965_rs_tl_turn_on_agg(priv, tid, | 2159 | il4965_rs_tl_turn_on_agg(il, tid, |
2160 | lq_sta, sta); | 2160 | lq_sta, sta); |
2161 | } | 2161 | } |
2162 | } | 2162 | } |
2163 | il4965_rs_set_stay_in_table(priv, 0, lq_sta); | 2163 | il4965_rs_set_stay_in_table(il, 0, lq_sta); |
2164 | } | 2164 | } |
2165 | } | 2165 | } |
2166 | 2166 | ||
2167 | out: | 2167 | out: |
2168 | tbl->current_rate = il4965_rate_n_flags_from_tbl(priv, tbl, | 2168 | tbl->current_rate = il4965_rate_n_flags_from_tbl(il, tbl, |
2169 | index, is_green); | 2169 | index, is_green); |
2170 | i = index; | 2170 | i = index; |
2171 | lq_sta->last_txrate_idx = i; | 2171 | lq_sta->last_txrate_idx = i; |
@@ -2185,7 +2185,7 @@ out: | |||
2185 | * calling this function (which runs REPLY_TX_LINK_QUALITY_CMD, | 2185 | * calling this function (which runs REPLY_TX_LINK_QUALITY_CMD, |
2186 | * which requires station table entry to exist). | 2186 | * which requires station table entry to exist). |
2187 | */ | 2187 | */ |
2188 | static void il4965_rs_initialize_lq(struct il_priv *priv, | 2188 | static void il4965_rs_initialize_lq(struct il_priv *il, |
2189 | struct ieee80211_conf *conf, | 2189 | struct ieee80211_conf *conf, |
2190 | struct ieee80211_sta *sta, | 2190 | struct ieee80211_sta *sta, |
2191 | struct il_lq_sta *lq_sta) | 2191 | struct il_lq_sta *lq_sta) |
@@ -2208,7 +2208,7 @@ static void il4965_rs_initialize_lq(struct il_priv *priv, | |||
2208 | 2208 | ||
2209 | i = lq_sta->last_txrate_idx; | 2209 | i = lq_sta->last_txrate_idx; |
2210 | 2210 | ||
2211 | valid_tx_ant = priv->hw_params.valid_tx_ant; | 2211 | valid_tx_ant = il->hw_params.valid_tx_ant; |
2212 | 2212 | ||
2213 | if (!lq_sta->search_better_tbl) | 2213 | if (!lq_sta->search_better_tbl) |
2214 | active_tbl = lq_sta->active_tbl; | 2214 | active_tbl = lq_sta->active_tbl; |
@@ -2227,31 +2227,31 @@ static void il4965_rs_initialize_lq(struct il_priv *priv, | |||
2227 | if (i >= IL_FIRST_CCK_RATE && i <= IL_LAST_CCK_RATE) | 2227 | if (i >= IL_FIRST_CCK_RATE && i <= IL_LAST_CCK_RATE) |
2228 | rate |= RATE_MCS_CCK_MSK; | 2228 | rate |= RATE_MCS_CCK_MSK; |
2229 | 2229 | ||
2230 | il4965_rs_get_tbl_info_from_mcs(rate, priv->band, tbl, &rate_idx); | 2230 | il4965_rs_get_tbl_info_from_mcs(rate, il->band, tbl, &rate_idx); |
2231 | if (!il4965_rs_is_valid_ant(valid_tx_ant, tbl->ant_type)) | 2231 | if (!il4965_rs_is_valid_ant(valid_tx_ant, tbl->ant_type)) |
2232 | il4965_rs_toggle_antenna(valid_tx_ant, &rate, tbl); | 2232 | il4965_rs_toggle_antenna(valid_tx_ant, &rate, tbl); |
2233 | 2233 | ||
2234 | rate = il4965_rate_n_flags_from_tbl(priv, tbl, rate_idx, use_green); | 2234 | rate = il4965_rate_n_flags_from_tbl(il, tbl, rate_idx, use_green); |
2235 | tbl->current_rate = rate; | 2235 | tbl->current_rate = rate; |
2236 | il4965_rs_set_expected_tpt_table(lq_sta, tbl); | 2236 | il4965_rs_set_expected_tpt_table(lq_sta, tbl); |
2237 | il4965_rs_fill_link_cmd(NULL, lq_sta, rate); | 2237 | il4965_rs_fill_link_cmd(NULL, lq_sta, rate); |
2238 | priv->stations[lq_sta->lq.sta_id].lq = &lq_sta->lq; | 2238 | il->stations[lq_sta->lq.sta_id].lq = &lq_sta->lq; |
2239 | il_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_SYNC, true); | 2239 | il_send_lq_cmd(il, ctx, &lq_sta->lq, CMD_SYNC, true); |
2240 | } | 2240 | } |
2241 | 2241 | ||
2242 | static void | 2242 | static void |
2243 | il4965_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, | 2243 | il4965_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta, |
2244 | struct ieee80211_tx_rate_control *txrc) | 2244 | struct ieee80211_tx_rate_control *txrc) |
2245 | { | 2245 | { |
2246 | 2246 | ||
2247 | struct sk_buff *skb = txrc->skb; | 2247 | struct sk_buff *skb = txrc->skb; |
2248 | struct ieee80211_supported_band *sband = txrc->sband; | 2248 | struct ieee80211_supported_band *sband = txrc->sband; |
2249 | struct il_priv *priv __maybe_unused = (struct il_priv *)priv_r; | 2249 | struct il_priv *il __maybe_unused = (struct il_priv *)il_r; |
2250 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 2250 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
2251 | struct il_lq_sta *lq_sta = priv_sta; | 2251 | struct il_lq_sta *lq_sta = il_sta; |
2252 | int rate_idx; | 2252 | int rate_idx; |
2253 | 2253 | ||
2254 | IL_DEBUG_RATE_LIMIT(priv, "rate scale calculate new rate for skb\n"); | 2254 | IL_DEBUG_RATE_LIMIT(il, "rate scale calculate new rate for skb\n"); |
2255 | 2255 | ||
2256 | /* Get max rate if user set max rate */ | 2256 | /* Get max rate if user set max rate */ |
2257 | if (lq_sta) { | 2257 | if (lq_sta) { |
@@ -2266,12 +2266,12 @@ il4965_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, | |||
2266 | 2266 | ||
2267 | /* Treat uninitialized rate scaling data same as non-existing. */ | 2267 | /* Treat uninitialized rate scaling data same as non-existing. */ |
2268 | if (lq_sta && !lq_sta->drv) { | 2268 | if (lq_sta && !lq_sta->drv) { |
2269 | IL_DEBUG_RATE(priv, "Rate scaling not initialized yet.\n"); | 2269 | IL_DEBUG_RATE(il, "Rate scaling not initialized yet.\n"); |
2270 | priv_sta = NULL; | 2270 | il_sta = NULL; |
2271 | } | 2271 | } |
2272 | 2272 | ||
2273 | /* Send management frames and NO_ACK data using lowest rate. */ | 2273 | /* Send management frames and NO_ACK data using lowest rate. */ |
2274 | if (rate_control_send_low(sta, priv_sta, txrc)) | 2274 | if (rate_control_send_low(sta, il_sta, txrc)) |
2275 | return; | 2275 | return; |
2276 | 2276 | ||
2277 | if (!lq_sta) | 2277 | if (!lq_sta) |
@@ -2314,16 +2314,16 @@ il4965_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, | |||
2314 | 2314 | ||
2315 | } | 2315 | } |
2316 | 2316 | ||
2317 | static void *il4965_rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta, | 2317 | static void *il4965_rs_alloc_sta(void *il_rate, struct ieee80211_sta *sta, |
2318 | gfp_t gfp) | 2318 | gfp_t gfp) |
2319 | { | 2319 | { |
2320 | struct il_lq_sta *lq_sta; | 2320 | struct il_lq_sta *lq_sta; |
2321 | struct il_station_priv *sta_priv = | 2321 | struct il_station_priv *sta_priv = |
2322 | (struct il_station_priv *) sta->drv_priv; | 2322 | (struct il_station_priv *) sta->drv_priv; |
2323 | struct il_priv *priv; | 2323 | struct il_priv *il; |
2324 | 2324 | ||
2325 | priv = (struct il_priv *)priv_rate; | 2325 | il = (struct il_priv *)il_rate; |
2326 | IL_DEBUG_RATE(priv, "create station rate scale window\n"); | 2326 | IL_DEBUG_RATE(il, "create station rate scale window\n"); |
2327 | 2327 | ||
2328 | lq_sta = &sta_priv->lq_sta; | 2328 | lq_sta = &sta_priv->lq_sta; |
2329 | 2329 | ||
@@ -2334,13 +2334,13 @@ static void *il4965_rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta, | |||
2334 | * Called after adding a new station to initialize rate scaling | 2334 | * Called after adding a new station to initialize rate scaling |
2335 | */ | 2335 | */ |
2336 | void | 2336 | void |
2337 | il4965_rs_rate_init(struct il_priv *priv, | 2337 | il4965_rs_rate_init(struct il_priv *il, |
2338 | struct ieee80211_sta *sta, | 2338 | struct ieee80211_sta *sta, |
2339 | u8 sta_id) | 2339 | u8 sta_id) |
2340 | { | 2340 | { |
2341 | int i, j; | 2341 | int i, j; |
2342 | struct ieee80211_hw *hw = priv->hw; | 2342 | struct ieee80211_hw *hw = il->hw; |
2343 | struct ieee80211_conf *conf = &priv->hw->conf; | 2343 | struct ieee80211_conf *conf = &il->hw->conf; |
2344 | struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; | 2344 | struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; |
2345 | struct il_station_priv *sta_priv; | 2345 | struct il_station_priv *sta_priv; |
2346 | struct il_lq_sta *lq_sta; | 2346 | struct il_lq_sta *lq_sta; |
@@ -2365,7 +2365,7 @@ il4965_rs_rate_init(struct il_priv *priv, | |||
2365 | il4965_rs_rate_scale_clear_window( | 2365 | il4965_rs_rate_scale_clear_window( |
2366 | &lq_sta->lq_info[j].win[i]); | 2366 | &lq_sta->lq_info[j].win[i]); |
2367 | 2367 | ||
2368 | IL_DEBUG_RATE(priv, "LQ:" | 2368 | IL_DEBUG_RATE(il, "LQ:" |
2369 | "*** rate scale station global init for station %d ***\n", | 2369 | "*** rate scale station global init for station %d ***\n", |
2370 | sta_id); | 2370 | sta_id); |
2371 | /* TODO: what is a good starting rate for STA? About middle? Maybe not | 2371 | /* TODO: what is a good starting rate for STA? About middle? Maybe not |
@@ -2377,8 +2377,8 @@ il4965_rs_rate_init(struct il_priv *priv, | |||
2377 | lq_sta->max_rate_idx = -1; | 2377 | lq_sta->max_rate_idx = -1; |
2378 | lq_sta->missed_rate_counter = IL_MISSED_RATE_MAX; | 2378 | lq_sta->missed_rate_counter = IL_MISSED_RATE_MAX; |
2379 | lq_sta->is_green = il4965_rs_use_green(sta); | 2379 | lq_sta->is_green = il4965_rs_use_green(sta); |
2380 | lq_sta->active_legacy_rate = priv->active_rate & ~(0x1000); | 2380 | lq_sta->active_legacy_rate = il->active_rate & ~(0x1000); |
2381 | lq_sta->band = priv->band; | 2381 | lq_sta->band = il->band; |
2382 | /* | 2382 | /* |
2383 | * active_siso_rate mask includes 9 MBits (bit 5), and CCK (bits 0-3), | 2383 | * active_siso_rate mask includes 9 MBits (bit 5), and CCK (bits 0-3), |
2384 | * supp_rates[] does not; shift to convert format, force 9 MBits off. | 2384 | * supp_rates[] does not; shift to convert format, force 9 MBits off. |
@@ -2396,20 +2396,20 @@ il4965_rs_rate_init(struct il_priv *priv, | |||
2396 | 2396 | ||
2397 | /* These values will be overridden later */ | 2397 | /* These values will be overridden later */ |
2398 | lq_sta->lq.general_params.single_stream_ant_msk = | 2398 | lq_sta->lq.general_params.single_stream_ant_msk = |
2399 | il4965_first_antenna(priv->hw_params.valid_tx_ant); | 2399 | il4965_first_antenna(il->hw_params.valid_tx_ant); |
2400 | lq_sta->lq.general_params.dual_stream_ant_msk = | 2400 | lq_sta->lq.general_params.dual_stream_ant_msk = |
2401 | priv->hw_params.valid_tx_ant & | 2401 | il->hw_params.valid_tx_ant & |
2402 | ~il4965_first_antenna(priv->hw_params.valid_tx_ant); | 2402 | ~il4965_first_antenna(il->hw_params.valid_tx_ant); |
2403 | if (!lq_sta->lq.general_params.dual_stream_ant_msk) { | 2403 | if (!lq_sta->lq.general_params.dual_stream_ant_msk) { |
2404 | lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB; | 2404 | lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB; |
2405 | } else if (il4965_num_of_ant(priv->hw_params.valid_tx_ant) == 2) { | 2405 | } else if (il4965_num_of_ant(il->hw_params.valid_tx_ant) == 2) { |
2406 | lq_sta->lq.general_params.dual_stream_ant_msk = | 2406 | lq_sta->lq.general_params.dual_stream_ant_msk = |
2407 | priv->hw_params.valid_tx_ant; | 2407 | il->hw_params.valid_tx_ant; |
2408 | } | 2408 | } |
2409 | 2409 | ||
2410 | /* as default allow aggregation for all tids */ | 2410 | /* as default allow aggregation for all tids */ |
2411 | lq_sta->tx_agg_tid_en = IL_AGG_ALL_TID; | 2411 | lq_sta->tx_agg_tid_en = IL_AGG_ALL_TID; |
2412 | lq_sta->drv = priv; | 2412 | lq_sta->drv = il; |
2413 | 2413 | ||
2414 | /* Set last_txrate_idx to lowest rate */ | 2414 | /* Set last_txrate_idx to lowest rate */ |
2415 | lq_sta->last_txrate_idx = rate_lowest_index(sband, sta); | 2415 | lq_sta->last_txrate_idx = rate_lowest_index(sband, sta); |
@@ -2421,10 +2421,10 @@ il4965_rs_rate_init(struct il_priv *priv, | |||
2421 | lq_sta->dbg_fixed_rate = 0; | 2421 | lq_sta->dbg_fixed_rate = 0; |
2422 | #endif | 2422 | #endif |
2423 | 2423 | ||
2424 | il4965_rs_initialize_lq(priv, conf, sta, lq_sta); | 2424 | il4965_rs_initialize_lq(il, conf, sta, lq_sta); |
2425 | } | 2425 | } |
2426 | 2426 | ||
2427 | static void il4965_rs_fill_link_cmd(struct il_priv *priv, | 2427 | static void il4965_rs_fill_link_cmd(struct il_priv *il, |
2428 | struct il_lq_sta *lq_sta, u32 new_rate) | 2428 | struct il_lq_sta *lq_sta, u32 new_rate) |
2429 | { | 2429 | { |
2430 | struct il_scale_tbl_info tbl_type; | 2430 | struct il_scale_tbl_info tbl_type; |
@@ -2467,8 +2467,8 @@ static void il4965_rs_fill_link_cmd(struct il_priv *priv, | |||
2467 | 2467 | ||
2468 | index++; | 2468 | index++; |
2469 | repeat_rate--; | 2469 | repeat_rate--; |
2470 | if (priv) | 2470 | if (il) |
2471 | valid_tx_ant = priv->hw_params.valid_tx_ant; | 2471 | valid_tx_ant = il->hw_params.valid_tx_ant; |
2472 | 2472 | ||
2473 | /* Fill rest of rate table */ | 2473 | /* Fill rest of rate table */ |
2474 | while (index < LINK_QUAL_MAX_RETRY_NUM) { | 2474 | while (index < LINK_QUAL_MAX_RETRY_NUM) { |
@@ -2479,7 +2479,7 @@ static void il4965_rs_fill_link_cmd(struct il_priv *priv, | |||
2479 | if (is_legacy(tbl_type.lq_type)) { | 2479 | if (is_legacy(tbl_type.lq_type)) { |
2480 | if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) | 2480 | if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) |
2481 | ant_toggle_cnt++; | 2481 | ant_toggle_cnt++; |
2482 | else if (priv && | 2482 | else if (il && |
2483 | il4965_rs_toggle_antenna(valid_tx_ant, | 2483 | il4965_rs_toggle_antenna(valid_tx_ant, |
2484 | &new_rate, &tbl_type)) | 2484 | &new_rate, &tbl_type)) |
2485 | ant_toggle_cnt = 1; | 2485 | ant_toggle_cnt = 1; |
@@ -2514,7 +2514,7 @@ static void il4965_rs_fill_link_cmd(struct il_priv *priv, | |||
2514 | if (is_legacy(tbl_type.lq_type)) { | 2514 | if (is_legacy(tbl_type.lq_type)) { |
2515 | if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) | 2515 | if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) |
2516 | ant_toggle_cnt++; | 2516 | ant_toggle_cnt++; |
2517 | else if (priv && | 2517 | else if (il && |
2518 | il4965_rs_toggle_antenna(valid_tx_ant, | 2518 | il4965_rs_toggle_antenna(valid_tx_ant, |
2519 | &new_rate, &tbl_type)) | 2519 | &new_rate, &tbl_type)) |
2520 | ant_toggle_cnt = 1; | 2520 | ant_toggle_cnt = 1; |
@@ -2551,18 +2551,18 @@ static void | |||
2551 | return hw->priv; | 2551 | return hw->priv; |
2552 | } | 2552 | } |
2553 | /* rate scale requires free function to be implemented */ | 2553 | /* rate scale requires free function to be implemented */ |
2554 | static void il4965_rs_free(void *priv_rate) | 2554 | static void il4965_rs_free(void *il_rate) |
2555 | { | 2555 | { |
2556 | return; | 2556 | return; |
2557 | } | 2557 | } |
2558 | 2558 | ||
2559 | static void il4965_rs_free_sta(void *priv_r, struct ieee80211_sta *sta, | 2559 | static void il4965_rs_free_sta(void *il_r, struct ieee80211_sta *sta, |
2560 | void *priv_sta) | 2560 | void *il_sta) |
2561 | { | 2561 | { |
2562 | struct il_priv *priv __maybe_unused = priv_r; | 2562 | struct il_priv *il __maybe_unused = il_r; |
2563 | 2563 | ||
2564 | IL_DEBUG_RATE(priv, "enter\n"); | 2564 | IL_DEBUG_RATE(il, "enter\n"); |
2565 | IL_DEBUG_RATE(priv, "leave\n"); | 2565 | IL_DEBUG_RATE(il, "leave\n"); |
2566 | } | 2566 | } |
2567 | 2567 | ||
2568 | 2568 | ||
@@ -2575,28 +2575,28 @@ static int il4965_open_file_generic(struct inode *inode, struct file *file) | |||
2575 | static void il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta, | 2575 | static void il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta, |
2576 | u32 *rate_n_flags, int index) | 2576 | u32 *rate_n_flags, int index) |
2577 | { | 2577 | { |
2578 | struct il_priv *priv; | 2578 | struct il_priv *il; |
2579 | u8 valid_tx_ant; | 2579 | u8 valid_tx_ant; |
2580 | u8 ant_sel_tx; | 2580 | u8 ant_sel_tx; |
2581 | 2581 | ||
2582 | priv = lq_sta->drv; | 2582 | il = lq_sta->drv; |
2583 | valid_tx_ant = priv->hw_params.valid_tx_ant; | 2583 | valid_tx_ant = il->hw_params.valid_tx_ant; |
2584 | if (lq_sta->dbg_fixed_rate) { | 2584 | if (lq_sta->dbg_fixed_rate) { |
2585 | ant_sel_tx = | 2585 | ant_sel_tx = |
2586 | ((lq_sta->dbg_fixed_rate & RATE_MCS_ANT_ABC_MSK) | 2586 | ((lq_sta->dbg_fixed_rate & RATE_MCS_ANT_ABC_MSK) |
2587 | >> RATE_MCS_ANT_POS); | 2587 | >> RATE_MCS_ANT_POS); |
2588 | if ((valid_tx_ant & ant_sel_tx) == ant_sel_tx) { | 2588 | if ((valid_tx_ant & ant_sel_tx) == ant_sel_tx) { |
2589 | *rate_n_flags = lq_sta->dbg_fixed_rate; | 2589 | *rate_n_flags = lq_sta->dbg_fixed_rate; |
2590 | IL_DEBUG_RATE(priv, "Fixed rate ON\n"); | 2590 | IL_DEBUG_RATE(il, "Fixed rate ON\n"); |
2591 | } else { | 2591 | } else { |
2592 | lq_sta->dbg_fixed_rate = 0; | 2592 | lq_sta->dbg_fixed_rate = 0; |
2593 | IL_ERR(priv, | 2593 | IL_ERR(il, |
2594 | "Invalid antenna selection 0x%X, Valid is 0x%X\n", | 2594 | "Invalid antenna selection 0x%X, Valid is 0x%X\n", |
2595 | ant_sel_tx, valid_tx_ant); | 2595 | ant_sel_tx, valid_tx_ant); |
2596 | IL_DEBUG_RATE(priv, "Fixed rate OFF\n"); | 2596 | IL_DEBUG_RATE(il, "Fixed rate OFF\n"); |
2597 | } | 2597 | } |
2598 | } else { | 2598 | } else { |
2599 | IL_DEBUG_RATE(priv, "Fixed rate OFF\n"); | 2599 | IL_DEBUG_RATE(il, "Fixed rate OFF\n"); |
2600 | } | 2600 | } |
2601 | } | 2601 | } |
2602 | 2602 | ||
@@ -2604,7 +2604,7 @@ static ssize_t il4965_rs_sta_dbgfs_scale_table_write(struct file *file, | |||
2604 | const char __user *user_buf, size_t count, loff_t *ppos) | 2604 | const char __user *user_buf, size_t count, loff_t *ppos) |
2605 | { | 2605 | { |
2606 | struct il_lq_sta *lq_sta = file->private_data; | 2606 | struct il_lq_sta *lq_sta = file->private_data; |
2607 | struct il_priv *priv; | 2607 | struct il_priv *il; |
2608 | char buf[64]; | 2608 | char buf[64]; |
2609 | size_t buf_size; | 2609 | size_t buf_size; |
2610 | u32 parsed_rate; | 2610 | u32 parsed_rate; |
@@ -2612,7 +2612,7 @@ static ssize_t il4965_rs_sta_dbgfs_scale_table_write(struct file *file, | |||
2612 | container_of(lq_sta, struct il_station_priv, lq_sta); | 2612 | container_of(lq_sta, struct il_station_priv, lq_sta); |
2613 | struct il_rxon_context *ctx = sta_priv->common.ctx; | 2613 | struct il_rxon_context *ctx = sta_priv->common.ctx; |
2614 | 2614 | ||
2615 | priv = lq_sta->drv; | 2615 | il = lq_sta->drv; |
2616 | memset(buf, 0, sizeof(buf)); | 2616 | memset(buf, 0, sizeof(buf)); |
2617 | buf_size = min(count, sizeof(buf) - 1); | 2617 | buf_size = min(count, sizeof(buf) - 1); |
2618 | if (copy_from_user(buf, user_buf, buf_size)) | 2618 | 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, | |||
2627 | lq_sta->active_siso_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ | 2627 | lq_sta->active_siso_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ |
2628 | lq_sta->active_mimo2_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ | 2628 | lq_sta->active_mimo2_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ |
2629 | 2629 | ||
2630 | IL_DEBUG_RATE(priv, "sta_id %d rate 0x%X\n", | 2630 | IL_DEBUG_RATE(il, "sta_id %d rate 0x%X\n", |
2631 | lq_sta->lq.sta_id, lq_sta->dbg_fixed_rate); | 2631 | lq_sta->lq.sta_id, lq_sta->dbg_fixed_rate); |
2632 | 2632 | ||
2633 | if (lq_sta->dbg_fixed_rate) { | 2633 | if (lq_sta->dbg_fixed_rate) { |
@@ -2649,10 +2649,10 @@ static ssize_t il4965_rs_sta_dbgfs_scale_table_read(struct file *file, | |||
2649 | ssize_t ret; | 2649 | ssize_t ret; |
2650 | 2650 | ||
2651 | struct il_lq_sta *lq_sta = file->private_data; | 2651 | struct il_lq_sta *lq_sta = file->private_data; |
2652 | struct il_priv *priv; | 2652 | struct il_priv *il; |
2653 | struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); | 2653 | struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); |
2654 | 2654 | ||
2655 | priv = lq_sta->drv; | 2655 | il = lq_sta->drv; |
2656 | buff = kmalloc(1024, GFP_KERNEL); | 2656 | buff = kmalloc(1024, GFP_KERNEL); |
2657 | if (!buff) | 2657 | if (!buff) |
2658 | return -ENOMEM; | 2658 | return -ENOMEM; |
@@ -2664,9 +2664,9 @@ static ssize_t il4965_rs_sta_dbgfs_scale_table_read(struct file *file, | |||
2664 | desc += sprintf(buff+desc, "fixed rate 0x%X\n", | 2664 | desc += sprintf(buff+desc, "fixed rate 0x%X\n", |
2665 | lq_sta->dbg_fixed_rate); | 2665 | lq_sta->dbg_fixed_rate); |
2666 | desc += sprintf(buff+desc, "valid_tx_ant %s%s%s\n", | 2666 | desc += sprintf(buff+desc, "valid_tx_ant %s%s%s\n", |
2667 | (priv->hw_params.valid_tx_ant & ANT_A) ? "ANT_A," : "", | 2667 | (il->hw_params.valid_tx_ant & ANT_A) ? "ANT_A," : "", |
2668 | (priv->hw_params.valid_tx_ant & ANT_B) ? "ANT_B," : "", | 2668 | (il->hw_params.valid_tx_ant & ANT_B) ? "ANT_B," : "", |
2669 | (priv->hw_params.valid_tx_ant & ANT_C) ? "ANT_C" : ""); | 2669 | (il->hw_params.valid_tx_ant & ANT_C) ? "ANT_C" : ""); |
2670 | desc += sprintf(buff+desc, "lq type %s\n", | 2670 | desc += sprintf(buff+desc, "lq type %s\n", |
2671 | (is_legacy(tbl->lq_type)) ? "legacy" : "HT"); | 2671 | (is_legacy(tbl->lq_type)) ? "legacy" : "HT"); |
2672 | if (is_Ht(tbl->lq_type)) { | 2672 | if (is_Ht(tbl->lq_type)) { |
@@ -2781,10 +2781,10 @@ static ssize_t il4965_rs_sta_dbgfs_rate_scale_data_read(struct file *file, | |||
2781 | ssize_t ret; | 2781 | ssize_t ret; |
2782 | 2782 | ||
2783 | struct il_lq_sta *lq_sta = file->private_data; | 2783 | struct il_lq_sta *lq_sta = file->private_data; |
2784 | struct il_priv *priv; | 2784 | struct il_priv *il; |
2785 | struct il_scale_tbl_info *tbl = &lq_sta->lq_info[lq_sta->active_tbl]; | 2785 | struct il_scale_tbl_info *tbl = &lq_sta->lq_info[lq_sta->active_tbl]; |
2786 | 2786 | ||
2787 | priv = lq_sta->drv; | 2787 | il = lq_sta->drv; |
2788 | 2788 | ||
2789 | if (is_Ht(tbl->lq_type)) | 2789 | if (is_Ht(tbl->lq_type)) |
2790 | desc += sprintf(buff+desc, | 2790 | desc += sprintf(buff+desc, |
@@ -2805,10 +2805,10 @@ static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { | |||
2805 | .llseek = default_llseek, | 2805 | .llseek = default_llseek, |
2806 | }; | 2806 | }; |
2807 | 2807 | ||
2808 | static void il4965_rs_add_debugfs(void *priv, void *priv_sta, | 2808 | static void il4965_rs_add_debugfs(void *il, void *il_sta, |
2809 | struct dentry *dir) | 2809 | struct dentry *dir) |
2810 | { | 2810 | { |
2811 | struct il_lq_sta *lq_sta = priv_sta; | 2811 | struct il_lq_sta *lq_sta = il_sta; |
2812 | lq_sta->rs_sta_dbgfs_scale_table_file = | 2812 | lq_sta->rs_sta_dbgfs_scale_table_file = |
2813 | debugfs_create_file("rate_scale_table", S_IRUSR | S_IWUSR, dir, | 2813 | debugfs_create_file("rate_scale_table", S_IRUSR | S_IWUSR, dir, |
2814 | lq_sta, &rs_sta_dbgfs_scale_table_ops); | 2814 | lq_sta, &rs_sta_dbgfs_scale_table_ops); |
@@ -2824,9 +2824,9 @@ static void il4965_rs_add_debugfs(void *priv, void *priv_sta, | |||
2824 | 2824 | ||
2825 | } | 2825 | } |
2826 | 2826 | ||
2827 | static void il4965_rs_remove_debugfs(void *priv, void *priv_sta) | 2827 | static void il4965_rs_remove_debugfs(void *il, void *il_sta) |
2828 | { | 2828 | { |
2829 | struct il_lq_sta *lq_sta = priv_sta; | 2829 | struct il_lq_sta *lq_sta = il_sta; |
2830 | debugfs_remove(lq_sta->rs_sta_dbgfs_scale_table_file); | 2830 | debugfs_remove(lq_sta->rs_sta_dbgfs_scale_table_file); |
2831 | debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); | 2831 | debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); |
2832 | debugfs_remove(lq_sta->rs_sta_dbgfs_rate_scale_data_file); | 2832 | debugfs_remove(lq_sta->rs_sta_dbgfs_rate_scale_data_file); |
@@ -2840,8 +2840,8 @@ static void il4965_rs_remove_debugfs(void *priv, void *priv_sta) | |||
2840 | * station is added we ignore it. | 2840 | * station is added we ignore it. |
2841 | */ | 2841 | */ |
2842 | static void | 2842 | static void |
2843 | il4965_rs_rate_init_stub(void *priv_r, struct ieee80211_supported_band *sband, | 2843 | il4965_rs_rate_init_stub(void *il_r, struct ieee80211_supported_band *sband, |
2844 | struct ieee80211_sta *sta, void *priv_sta) | 2844 | struct ieee80211_sta *sta, void *il_sta) |
2845 | { | 2845 | { |
2846 | } | 2846 | } |
2847 | static struct rate_control_ops rs_4965_ops = { | 2847 | 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 47cbe565a53..c987c80a37c 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-rx.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-rx.c | |||
@@ -41,7 +41,7 @@ | |||
41 | #include "iwl-4965-hw.h" | 41 | #include "iwl-4965-hw.h" |
42 | #include "iwl-4965.h" | 42 | #include "iwl-4965.h" |
43 | 43 | ||
44 | void il4965_rx_missed_beacon_notif(struct il_priv *priv, | 44 | void il4965_rx_missed_beacon_notif(struct il_priv *il, |
45 | struct il_rx_mem_buffer *rxb) | 45 | struct il_rx_mem_buffer *rxb) |
46 | 46 | ||
47 | { | 47 | { |
@@ -50,22 +50,22 @@ void il4965_rx_missed_beacon_notif(struct il_priv *priv, | |||
50 | 50 | ||
51 | missed_beacon = &pkt->u.missed_beacon; | 51 | missed_beacon = &pkt->u.missed_beacon; |
52 | if (le32_to_cpu(missed_beacon->consecutive_missed_beacons) > | 52 | if (le32_to_cpu(missed_beacon->consecutive_missed_beacons) > |
53 | priv->missed_beacon_threshold) { | 53 | il->missed_beacon_threshold) { |
54 | IL_DEBUG_CALIB(priv, | 54 | IL_DEBUG_CALIB(il, |
55 | "missed bcn cnsq %d totl %d rcd %d expctd %d\n", | 55 | "missed bcn cnsq %d totl %d rcd %d expctd %d\n", |
56 | le32_to_cpu(missed_beacon->consecutive_missed_beacons), | 56 | le32_to_cpu(missed_beacon->consecutive_missed_beacons), |
57 | le32_to_cpu(missed_beacon->total_missed_becons), | 57 | le32_to_cpu(missed_beacon->total_missed_becons), |
58 | le32_to_cpu(missed_beacon->num_recvd_beacons), | 58 | le32_to_cpu(missed_beacon->num_recvd_beacons), |
59 | le32_to_cpu(missed_beacon->num_expected_beacons)); | 59 | le32_to_cpu(missed_beacon->num_expected_beacons)); |
60 | if (!test_bit(STATUS_SCANNING, &priv->status)) | 60 | if (!test_bit(STATUS_SCANNING, &il->status)) |
61 | il4965_init_sensitivity(priv); | 61 | il4965_init_sensitivity(il); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | /* Calculate noise level, based on measurements during network silence just | 65 | /* Calculate noise level, based on measurements during network silence just |
66 | * before arriving beacon. This measurement can be done only if we know | 66 | * before arriving beacon. This measurement can be done only if we know |
67 | * exactly when to expect beacons, therefore only when we're associated. */ | 67 | * exactly when to expect beacons, therefore only when we're associated. */ |
68 | static void il4965_rx_calc_noise(struct il_priv *priv) | 68 | static void il4965_rx_calc_noise(struct il_priv *il) |
69 | { | 69 | { |
70 | struct statistics_rx_non_phy *rx_info; | 70 | struct statistics_rx_non_phy *rx_info; |
71 | int num_active_rx = 0; | 71 | int num_active_rx = 0; |
@@ -73,7 +73,7 @@ static void il4965_rx_calc_noise(struct il_priv *priv) | |||
73 | int bcn_silence_a, bcn_silence_b, bcn_silence_c; | 73 | int bcn_silence_a, bcn_silence_b, bcn_silence_c; |
74 | int last_rx_noise; | 74 | int last_rx_noise; |
75 | 75 | ||
76 | rx_info = &(priv->_4965.statistics.rx.general); | 76 | rx_info = &(il->_4965.statistics.rx.general); |
77 | bcn_silence_a = | 77 | bcn_silence_a = |
78 | le32_to_cpu(rx_info->beacon_silence_rssi_a) & IN_BAND_FILTER; | 78 | le32_to_cpu(rx_info->beacon_silence_rssi_a) & IN_BAND_FILTER; |
79 | bcn_silence_b = | 79 | bcn_silence_b = |
@@ -100,7 +100,7 @@ static void il4965_rx_calc_noise(struct il_priv *priv) | |||
100 | else | 100 | else |
101 | last_rx_noise = IL_NOISE_MEAS_NOT_AVAILABLE; | 101 | last_rx_noise = IL_NOISE_MEAS_NOT_AVAILABLE; |
102 | 102 | ||
103 | IL_DEBUG_CALIB(priv, "inband silence a %u, b %u, c %u, dBm %d\n", | 103 | IL_DEBUG_CALIB(il, "inband silence a %u, b %u, c %u, dBm %d\n", |
104 | bcn_silence_a, bcn_silence_b, bcn_silence_c, | 104 | bcn_silence_a, bcn_silence_b, bcn_silence_c, |
105 | last_rx_noise); | 105 | last_rx_noise); |
106 | } | 106 | } |
@@ -111,7 +111,7 @@ static void il4965_rx_calc_noise(struct il_priv *priv) | |||
111 | * FIXME: This function is for debugging, do not deal with | 111 | * FIXME: This function is for debugging, do not deal with |
112 | * the case of counters roll-over. | 112 | * the case of counters roll-over. |
113 | */ | 113 | */ |
114 | static void il4965_accumulative_statistics(struct il_priv *priv, | 114 | static void il4965_accumulative_statistics(struct il_priv *il, |
115 | __le32 *stats) | 115 | __le32 *stats) |
116 | { | 116 | { |
117 | int i, size; | 117 | int i, size; |
@@ -121,15 +121,15 @@ static void il4965_accumulative_statistics(struct il_priv *priv, | |||
121 | struct statistics_general_common *general, *accum_general; | 121 | struct statistics_general_common *general, *accum_general; |
122 | struct statistics_tx *tx, *accum_tx; | 122 | struct statistics_tx *tx, *accum_tx; |
123 | 123 | ||
124 | prev_stats = (__le32 *)&priv->_4965.statistics; | 124 | prev_stats = (__le32 *)&il->_4965.statistics; |
125 | accum_stats = (u32 *)&priv->_4965.accum_statistics; | 125 | accum_stats = (u32 *)&il->_4965.accum_statistics; |
126 | size = sizeof(struct il_notif_statistics); | 126 | size = sizeof(struct il_notif_statistics); |
127 | general = &priv->_4965.statistics.general.common; | 127 | general = &il->_4965.statistics.general.common; |
128 | accum_general = &priv->_4965.accum_statistics.general.common; | 128 | accum_general = &il->_4965.accum_statistics.general.common; |
129 | tx = &priv->_4965.statistics.tx; | 129 | tx = &il->_4965.statistics.tx; |
130 | accum_tx = &priv->_4965.accum_statistics.tx; | 130 | accum_tx = &il->_4965.accum_statistics.tx; |
131 | delta = (u32 *)&priv->_4965.delta_statistics; | 131 | delta = (u32 *)&il->_4965.delta_statistics; |
132 | max_delta = (u32 *)&priv->_4965.max_delta; | 132 | max_delta = (u32 *)&il->_4965.max_delta; |
133 | 133 | ||
134 | for (i = sizeof(__le32); i < size; | 134 | for (i = sizeof(__le32); i < size; |
135 | i += sizeof(__le32), stats++, prev_stats++, delta++, | 135 | i += sizeof(__le32), stats++, prev_stats++, delta++, |
@@ -151,65 +151,65 @@ static void il4965_accumulative_statistics(struct il_priv *priv, | |||
151 | 151 | ||
152 | #define REG_RECALIB_PERIOD (60) | 152 | #define REG_RECALIB_PERIOD (60) |
153 | 153 | ||
154 | void il4965_rx_statistics(struct il_priv *priv, | 154 | void il4965_rx_statistics(struct il_priv *il, |
155 | struct il_rx_mem_buffer *rxb) | 155 | struct il_rx_mem_buffer *rxb) |
156 | { | 156 | { |
157 | int change; | 157 | int change; |
158 | struct il_rx_packet *pkt = rxb_addr(rxb); | 158 | struct il_rx_packet *pkt = rxb_addr(rxb); |
159 | 159 | ||
160 | IL_DEBUG_RX(priv, | 160 | IL_DEBUG_RX(il, |
161 | "Statistics notification received (%d vs %d).\n", | 161 | "Statistics notification received (%d vs %d).\n", |
162 | (int)sizeof(struct il_notif_statistics), | 162 | (int)sizeof(struct il_notif_statistics), |
163 | le32_to_cpu(pkt->len_n_flags) & | 163 | le32_to_cpu(pkt->len_n_flags) & |
164 | FH_RSCSR_FRAME_SIZE_MSK); | 164 | FH_RSCSR_FRAME_SIZE_MSK); |
165 | 165 | ||
166 | change = ((priv->_4965.statistics.general.common.temperature != | 166 | change = ((il->_4965.statistics.general.common.temperature != |
167 | pkt->u.stats.general.common.temperature) || | 167 | pkt->u.stats.general.common.temperature) || |
168 | ((priv->_4965.statistics.flag & | 168 | ((il->_4965.statistics.flag & |
169 | STATISTICS_REPLY_FLG_HT40_MODE_MSK) != | 169 | STATISTICS_REPLY_FLG_HT40_MODE_MSK) != |
170 | (pkt->u.stats.flag & | 170 | (pkt->u.stats.flag & |
171 | STATISTICS_REPLY_FLG_HT40_MODE_MSK))); | 171 | STATISTICS_REPLY_FLG_HT40_MODE_MSK))); |
172 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS | 172 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS |
173 | il4965_accumulative_statistics(priv, (__le32 *)&pkt->u.stats); | 173 | il4965_accumulative_statistics(il, (__le32 *)&pkt->u.stats); |
174 | #endif | 174 | #endif |
175 | 175 | ||
176 | /* TODO: reading some of statistics is unneeded */ | 176 | /* TODO: reading some of statistics is unneeded */ |
177 | memcpy(&priv->_4965.statistics, &pkt->u.stats, | 177 | memcpy(&il->_4965.statistics, &pkt->u.stats, |
178 | sizeof(priv->_4965.statistics)); | 178 | sizeof(il->_4965.statistics)); |
179 | 179 | ||
180 | set_bit(STATUS_STATISTICS, &priv->status); | 180 | set_bit(STATUS_STATISTICS, &il->status); |
181 | 181 | ||
182 | /* Reschedule the statistics timer to occur in | 182 | /* Reschedule the statistics timer to occur in |
183 | * REG_RECALIB_PERIOD seconds to ensure we get a | 183 | * REG_RECALIB_PERIOD seconds to ensure we get a |
184 | * thermal update even if the uCode doesn't give | 184 | * thermal update even if the uCode doesn't give |
185 | * us one */ | 185 | * us one */ |
186 | mod_timer(&priv->statistics_periodic, jiffies + | 186 | mod_timer(&il->statistics_periodic, jiffies + |
187 | msecs_to_jiffies(REG_RECALIB_PERIOD * 1000)); | 187 | msecs_to_jiffies(REG_RECALIB_PERIOD * 1000)); |
188 | 188 | ||
189 | if (unlikely(!test_bit(STATUS_SCANNING, &priv->status)) && | 189 | if (unlikely(!test_bit(STATUS_SCANNING, &il->status)) && |
190 | (pkt->hdr.cmd == STATISTICS_NOTIFICATION)) { | 190 | (pkt->hdr.cmd == STATISTICS_NOTIFICATION)) { |
191 | il4965_rx_calc_noise(priv); | 191 | il4965_rx_calc_noise(il); |
192 | queue_work(priv->workqueue, &priv->run_time_calib_work); | 192 | queue_work(il->workqueue, &il->run_time_calib_work); |
193 | } | 193 | } |
194 | if (priv->cfg->ops->lib->temp_ops.temperature && change) | 194 | if (il->cfg->ops->lib->temp_ops.temperature && change) |
195 | priv->cfg->ops->lib->temp_ops.temperature(priv); | 195 | il->cfg->ops->lib->temp_ops.temperature(il); |
196 | } | 196 | } |
197 | 197 | ||
198 | void il4965_reply_statistics(struct il_priv *priv, | 198 | void il4965_reply_statistics(struct il_priv *il, |
199 | struct il_rx_mem_buffer *rxb) | 199 | struct il_rx_mem_buffer *rxb) |
200 | { | 200 | { |
201 | struct il_rx_packet *pkt = rxb_addr(rxb); | 201 | struct il_rx_packet *pkt = rxb_addr(rxb); |
202 | 202 | ||
203 | if (le32_to_cpu(pkt->u.stats.flag) & UCODE_STATISTICS_CLEAR_MSK) { | 203 | if (le32_to_cpu(pkt->u.stats.flag) & UCODE_STATISTICS_CLEAR_MSK) { |
204 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS | 204 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS |
205 | memset(&priv->_4965.accum_statistics, 0, | 205 | memset(&il->_4965.accum_statistics, 0, |
206 | sizeof(struct il_notif_statistics)); | 206 | sizeof(struct il_notif_statistics)); |
207 | memset(&priv->_4965.delta_statistics, 0, | 207 | memset(&il->_4965.delta_statistics, 0, |
208 | sizeof(struct il_notif_statistics)); | 208 | sizeof(struct il_notif_statistics)); |
209 | memset(&priv->_4965.max_delta, 0, | 209 | memset(&il->_4965.max_delta, 0, |
210 | sizeof(struct il_notif_statistics)); | 210 | sizeof(struct il_notif_statistics)); |
211 | #endif | 211 | #endif |
212 | IL_DEBUG_RX(priv, "Statistics have been cleared\n"); | 212 | IL_DEBUG_RX(il, "Statistics have been cleared\n"); |
213 | } | 213 | } |
214 | il4965_rx_statistics(priv, rxb); | 214 | il4965_rx_statistics(il, rxb); |
215 | } | 215 | } |
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-sta.c b/drivers/net/wireless/iwlegacy/iwl-4965-sta.c index 3ac9aef439a..20290d24fd6 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-sta.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-sta.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include "iwl-4965.h" | 35 | #include "iwl-4965.h" |
36 | 36 | ||
37 | static struct il_link_quality_cmd * | 37 | static struct il_link_quality_cmd * |
38 | il4965_sta_alloc_lq(struct il_priv *priv, u8 sta_id) | 38 | il4965_sta_alloc_lq(struct il_priv *il, u8 sta_id) |
39 | { | 39 | { |
40 | int i, r; | 40 | int i, r; |
41 | struct il_link_quality_cmd *link_cmd; | 41 | struct il_link_quality_cmd *link_cmd; |
@@ -44,12 +44,12 @@ il4965_sta_alloc_lq(struct il_priv *priv, u8 sta_id) | |||
44 | 44 | ||
45 | link_cmd = kzalloc(sizeof(struct il_link_quality_cmd), GFP_KERNEL); | 45 | link_cmd = kzalloc(sizeof(struct il_link_quality_cmd), GFP_KERNEL); |
46 | if (!link_cmd) { | 46 | if (!link_cmd) { |
47 | IL_ERR(priv, "Unable to allocate memory for LQ cmd.\n"); | 47 | IL_ERR(il, "Unable to allocate memory for LQ cmd.\n"); |
48 | return NULL; | 48 | return NULL; |
49 | } | 49 | } |
50 | /* Set up the rate scaling to start at selected rate, fall back | 50 | /* Set up the rate scaling to start at selected rate, fall back |
51 | * all the way down to 1M in IEEE order, and then spin on 1M */ | 51 | * all the way down to 1M in IEEE order, and then spin on 1M */ |
52 | if (priv->band == IEEE80211_BAND_5GHZ) | 52 | if (il->band == IEEE80211_BAND_5GHZ) |
53 | r = IL_RATE_6M_INDEX; | 53 | r = IL_RATE_6M_INDEX; |
54 | else | 54 | else |
55 | r = IL_RATE_1M_INDEX; | 55 | r = IL_RATE_1M_INDEX; |
@@ -57,7 +57,7 @@ il4965_sta_alloc_lq(struct il_priv *priv, u8 sta_id) | |||
57 | if (r >= IL_FIRST_CCK_RATE && r <= IL_LAST_CCK_RATE) | 57 | if (r >= IL_FIRST_CCK_RATE && r <= IL_LAST_CCK_RATE) |
58 | rate_flags |= RATE_MCS_CCK_MSK; | 58 | rate_flags |= RATE_MCS_CCK_MSK; |
59 | 59 | ||
60 | rate_flags |= il4965_first_antenna(priv->hw_params.valid_tx_ant) << | 60 | rate_flags |= il4965_first_antenna(il->hw_params.valid_tx_ant) << |
61 | RATE_MCS_ANT_POS; | 61 | RATE_MCS_ANT_POS; |
62 | rate_n_flags = il4965_hw_set_rate_n_flags(iwlegacy_rates[r].plcp, | 62 | rate_n_flags = il4965_hw_set_rate_n_flags(iwlegacy_rates[r].plcp, |
63 | rate_flags); | 63 | rate_flags); |
@@ -65,16 +65,16 @@ il4965_sta_alloc_lq(struct il_priv *priv, u8 sta_id) | |||
65 | link_cmd->rs_table[i].rate_n_flags = rate_n_flags; | 65 | link_cmd->rs_table[i].rate_n_flags = rate_n_flags; |
66 | 66 | ||
67 | link_cmd->general_params.single_stream_ant_msk = | 67 | link_cmd->general_params.single_stream_ant_msk = |
68 | il4965_first_antenna(priv->hw_params.valid_tx_ant); | 68 | il4965_first_antenna(il->hw_params.valid_tx_ant); |
69 | 69 | ||
70 | link_cmd->general_params.dual_stream_ant_msk = | 70 | link_cmd->general_params.dual_stream_ant_msk = |
71 | priv->hw_params.valid_tx_ant & | 71 | il->hw_params.valid_tx_ant & |
72 | ~il4965_first_antenna(priv->hw_params.valid_tx_ant); | 72 | ~il4965_first_antenna(il->hw_params.valid_tx_ant); |
73 | if (!link_cmd->general_params.dual_stream_ant_msk) { | 73 | if (!link_cmd->general_params.dual_stream_ant_msk) { |
74 | link_cmd->general_params.dual_stream_ant_msk = ANT_AB; | 74 | link_cmd->general_params.dual_stream_ant_msk = ANT_AB; |
75 | } else if (il4965_num_of_ant(priv->hw_params.valid_tx_ant) == 2) { | 75 | } else if (il4965_num_of_ant(il->hw_params.valid_tx_ant) == 2) { |
76 | link_cmd->general_params.dual_stream_ant_msk = | 76 | link_cmd->general_params.dual_stream_ant_msk = |
77 | priv->hw_params.valid_tx_ant; | 77 | il->hw_params.valid_tx_ant; |
78 | } | 78 | } |
79 | 79 | ||
80 | link_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF; | 80 | 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) | |||
92 | * Function sleeps. | 92 | * Function sleeps. |
93 | */ | 93 | */ |
94 | int | 94 | int |
95 | il4965_add_bssid_station(struct il_priv *priv, struct il_rxon_context *ctx, | 95 | il4965_add_bssid_station(struct il_priv *il, struct il_rxon_context *ctx, |
96 | const u8 *addr, u8 *sta_id_r) | 96 | const u8 *addr, u8 *sta_id_r) |
97 | { | 97 | { |
98 | int ret; | 98 | int ret; |
@@ -103,40 +103,40 @@ il4965_add_bssid_station(struct il_priv *priv, struct il_rxon_context *ctx, | |||
103 | if (sta_id_r) | 103 | if (sta_id_r) |
104 | *sta_id_r = IL_INVALID_STATION; | 104 | *sta_id_r = IL_INVALID_STATION; |
105 | 105 | ||
106 | ret = il_add_station_common(priv, ctx, addr, 0, NULL, &sta_id); | 106 | ret = il_add_station_common(il, ctx, addr, 0, NULL, &sta_id); |
107 | if (ret) { | 107 | if (ret) { |
108 | IL_ERR(priv, "Unable to add station %pM\n", addr); | 108 | IL_ERR(il, "Unable to add station %pM\n", addr); |
109 | return ret; | 109 | return ret; |
110 | } | 110 | } |
111 | 111 | ||
112 | if (sta_id_r) | 112 | if (sta_id_r) |
113 | *sta_id_r = sta_id; | 113 | *sta_id_r = sta_id; |
114 | 114 | ||
115 | spin_lock_irqsave(&priv->sta_lock, flags); | 115 | spin_lock_irqsave(&il->sta_lock, flags); |
116 | priv->stations[sta_id].used |= IL_STA_LOCAL; | 116 | il->stations[sta_id].used |= IL_STA_LOCAL; |
117 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 117 | spin_unlock_irqrestore(&il->sta_lock, flags); |
118 | 118 | ||
119 | /* Set up default rate scaling table in device's station table */ | 119 | /* Set up default rate scaling table in device's station table */ |
120 | link_cmd = il4965_sta_alloc_lq(priv, sta_id); | 120 | link_cmd = il4965_sta_alloc_lq(il, sta_id); |
121 | if (!link_cmd) { | 121 | if (!link_cmd) { |
122 | IL_ERR(priv, | 122 | IL_ERR(il, |
123 | "Unable to initialize rate scaling for station %pM.\n", | 123 | "Unable to initialize rate scaling for station %pM.\n", |
124 | addr); | 124 | addr); |
125 | return -ENOMEM; | 125 | return -ENOMEM; |
126 | } | 126 | } |
127 | 127 | ||
128 | ret = il_send_lq_cmd(priv, ctx, link_cmd, CMD_SYNC, true); | 128 | ret = il_send_lq_cmd(il, ctx, link_cmd, CMD_SYNC, true); |
129 | if (ret) | 129 | if (ret) |
130 | IL_ERR(priv, "Link quality command failed (%d)\n", ret); | 130 | IL_ERR(il, "Link quality command failed (%d)\n", ret); |
131 | 131 | ||
132 | spin_lock_irqsave(&priv->sta_lock, flags); | 132 | spin_lock_irqsave(&il->sta_lock, flags); |
133 | priv->stations[sta_id].lq = link_cmd; | 133 | il->stations[sta_id].lq = link_cmd; |
134 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 134 | spin_unlock_irqrestore(&il->sta_lock, flags); |
135 | 135 | ||
136 | return 0; | 136 | return 0; |
137 | } | 137 | } |
138 | 138 | ||
139 | static int il4965_static_wepkey_cmd(struct il_priv *priv, | 139 | static int il4965_static_wepkey_cmd(struct il_priv *il, |
140 | struct il_rxon_context *ctx, | 140 | struct il_rxon_context *ctx, |
141 | bool send_if_empty) | 141 | bool send_if_empty) |
142 | { | 142 | { |
@@ -178,74 +178,74 @@ static int il4965_static_wepkey_cmd(struct il_priv *priv, | |||
178 | cmd.len = cmd_size; | 178 | cmd.len = cmd_size; |
179 | 179 | ||
180 | if (not_empty || send_if_empty) | 180 | if (not_empty || send_if_empty) |
181 | return il_send_cmd(priv, &cmd); | 181 | return il_send_cmd(il, &cmd); |
182 | else | 182 | else |
183 | return 0; | 183 | return 0; |
184 | } | 184 | } |
185 | 185 | ||
186 | int il4965_restore_default_wep_keys(struct il_priv *priv, | 186 | int il4965_restore_default_wep_keys(struct il_priv *il, |
187 | struct il_rxon_context *ctx) | 187 | struct il_rxon_context *ctx) |
188 | { | 188 | { |
189 | lockdep_assert_held(&priv->mutex); | 189 | lockdep_assert_held(&il->mutex); |
190 | 190 | ||
191 | return il4965_static_wepkey_cmd(priv, ctx, false); | 191 | return il4965_static_wepkey_cmd(il, ctx, false); |
192 | } | 192 | } |
193 | 193 | ||
194 | int il4965_remove_default_wep_key(struct il_priv *priv, | 194 | int il4965_remove_default_wep_key(struct il_priv *il, |
195 | struct il_rxon_context *ctx, | 195 | struct il_rxon_context *ctx, |
196 | struct ieee80211_key_conf *keyconf) | 196 | struct ieee80211_key_conf *keyconf) |
197 | { | 197 | { |
198 | int ret; | 198 | int ret; |
199 | 199 | ||
200 | lockdep_assert_held(&priv->mutex); | 200 | lockdep_assert_held(&il->mutex); |
201 | 201 | ||
202 | IL_DEBUG_WEP(priv, "Removing default WEP key: idx=%d\n", | 202 | IL_DEBUG_WEP(il, "Removing default WEP key: idx=%d\n", |
203 | keyconf->keyidx); | 203 | keyconf->keyidx); |
204 | 204 | ||
205 | memset(&ctx->wep_keys[keyconf->keyidx], 0, sizeof(ctx->wep_keys[0])); | 205 | memset(&ctx->wep_keys[keyconf->keyidx], 0, sizeof(ctx->wep_keys[0])); |
206 | if (il_is_rfkill(priv)) { | 206 | if (il_is_rfkill(il)) { |
207 | IL_DEBUG_WEP(priv, | 207 | IL_DEBUG_WEP(il, |
208 | "Not sending REPLY_WEPKEY command due to RFKILL.\n"); | 208 | "Not sending REPLY_WEPKEY command due to RFKILL.\n"); |
209 | /* but keys in device are clear anyway so return success */ | 209 | /* but keys in device are clear anyway so return success */ |
210 | return 0; | 210 | return 0; |
211 | } | 211 | } |
212 | ret = il4965_static_wepkey_cmd(priv, ctx, 1); | 212 | ret = il4965_static_wepkey_cmd(il, ctx, 1); |
213 | IL_DEBUG_WEP(priv, "Remove default WEP key: idx=%d ret=%d\n", | 213 | IL_DEBUG_WEP(il, "Remove default WEP key: idx=%d ret=%d\n", |
214 | keyconf->keyidx, ret); | 214 | keyconf->keyidx, ret); |
215 | 215 | ||
216 | return ret; | 216 | return ret; |
217 | } | 217 | } |
218 | 218 | ||
219 | int il4965_set_default_wep_key(struct il_priv *priv, | 219 | int il4965_set_default_wep_key(struct il_priv *il, |
220 | struct il_rxon_context *ctx, | 220 | struct il_rxon_context *ctx, |
221 | struct ieee80211_key_conf *keyconf) | 221 | struct ieee80211_key_conf *keyconf) |
222 | { | 222 | { |
223 | int ret; | 223 | int ret; |
224 | 224 | ||
225 | lockdep_assert_held(&priv->mutex); | 225 | lockdep_assert_held(&il->mutex); |
226 | 226 | ||
227 | if (keyconf->keylen != WEP_KEY_LEN_128 && | 227 | if (keyconf->keylen != WEP_KEY_LEN_128 && |
228 | keyconf->keylen != WEP_KEY_LEN_64) { | 228 | keyconf->keylen != WEP_KEY_LEN_64) { |
229 | IL_DEBUG_WEP(priv, "Bad WEP key length %d\n", keyconf->keylen); | 229 | IL_DEBUG_WEP(il, "Bad WEP key length %d\n", keyconf->keylen); |
230 | return -EINVAL; | 230 | return -EINVAL; |
231 | } | 231 | } |
232 | 232 | ||
233 | keyconf->flags &= ~IEEE80211_KEY_FLAG_GENERATE_IV; | 233 | keyconf->flags &= ~IEEE80211_KEY_FLAG_GENERATE_IV; |
234 | keyconf->hw_key_idx = HW_KEY_DEFAULT; | 234 | keyconf->hw_key_idx = HW_KEY_DEFAULT; |
235 | priv->stations[ctx->ap_sta_id].keyinfo.cipher = keyconf->cipher; | 235 | il->stations[ctx->ap_sta_id].keyinfo.cipher = keyconf->cipher; |
236 | 236 | ||
237 | ctx->wep_keys[keyconf->keyidx].key_size = keyconf->keylen; | 237 | ctx->wep_keys[keyconf->keyidx].key_size = keyconf->keylen; |
238 | memcpy(&ctx->wep_keys[keyconf->keyidx].key, &keyconf->key, | 238 | memcpy(&ctx->wep_keys[keyconf->keyidx].key, &keyconf->key, |
239 | keyconf->keylen); | 239 | keyconf->keylen); |
240 | 240 | ||
241 | ret = il4965_static_wepkey_cmd(priv, ctx, false); | 241 | ret = il4965_static_wepkey_cmd(il, ctx, false); |
242 | IL_DEBUG_WEP(priv, "Set default WEP key: len=%d idx=%d ret=%d\n", | 242 | IL_DEBUG_WEP(il, "Set default WEP key: len=%d idx=%d ret=%d\n", |
243 | keyconf->keylen, keyconf->keyidx, ret); | 243 | keyconf->keylen, keyconf->keyidx, ret); |
244 | 244 | ||
245 | return ret; | 245 | return ret; |
246 | } | 246 | } |
247 | 247 | ||
248 | static int il4965_set_wep_dynamic_key_info(struct il_priv *priv, | 248 | static int il4965_set_wep_dynamic_key_info(struct il_priv *il, |
249 | struct il_rxon_context *ctx, | 249 | struct il_rxon_context *ctx, |
250 | struct ieee80211_key_conf *keyconf, | 250 | struct ieee80211_key_conf *keyconf, |
251 | u8 sta_id) | 251 | u8 sta_id) |
@@ -254,7 +254,7 @@ static int il4965_set_wep_dynamic_key_info(struct il_priv *priv, | |||
254 | __le16 key_flags = 0; | 254 | __le16 key_flags = 0; |
255 | struct il_addsta_cmd sta_cmd; | 255 | struct il_addsta_cmd sta_cmd; |
256 | 256 | ||
257 | lockdep_assert_held(&priv->mutex); | 257 | lockdep_assert_held(&il->mutex); |
258 | 258 | ||
259 | keyconf->flags &= ~IEEE80211_KEY_FLAG_GENERATE_IV; | 259 | keyconf->flags &= ~IEEE80211_KEY_FLAG_GENERATE_IV; |
260 | 260 | ||
@@ -268,40 +268,40 @@ static int il4965_set_wep_dynamic_key_info(struct il_priv *priv, | |||
268 | if (sta_id == ctx->bcast_sta_id) | 268 | if (sta_id == ctx->bcast_sta_id) |
269 | key_flags |= STA_KEY_MULTICAST_MSK; | 269 | key_flags |= STA_KEY_MULTICAST_MSK; |
270 | 270 | ||
271 | spin_lock_irqsave(&priv->sta_lock, flags); | 271 | spin_lock_irqsave(&il->sta_lock, flags); |
272 | 272 | ||
273 | priv->stations[sta_id].keyinfo.cipher = keyconf->cipher; | 273 | il->stations[sta_id].keyinfo.cipher = keyconf->cipher; |
274 | priv->stations[sta_id].keyinfo.keylen = keyconf->keylen; | 274 | il->stations[sta_id].keyinfo.keylen = keyconf->keylen; |
275 | priv->stations[sta_id].keyinfo.keyidx = keyconf->keyidx; | 275 | il->stations[sta_id].keyinfo.keyidx = keyconf->keyidx; |
276 | 276 | ||
277 | memcpy(priv->stations[sta_id].keyinfo.key, | 277 | memcpy(il->stations[sta_id].keyinfo.key, |
278 | keyconf->key, keyconf->keylen); | 278 | keyconf->key, keyconf->keylen); |
279 | 279 | ||
280 | memcpy(&priv->stations[sta_id].sta.key.key[3], | 280 | memcpy(&il->stations[sta_id].sta.key.key[3], |
281 | keyconf->key, keyconf->keylen); | 281 | keyconf->key, keyconf->keylen); |
282 | 282 | ||
283 | if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK) | 283 | if ((il->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK) |
284 | == STA_KEY_FLG_NO_ENC) | 284 | == STA_KEY_FLG_NO_ENC) |
285 | priv->stations[sta_id].sta.key.key_offset = | 285 | il->stations[sta_id].sta.key.key_offset = |
286 | il_get_free_ucode_key_index(priv); | 286 | il_get_free_ucode_key_index(il); |
287 | /* else, we are overriding an existing key => no need to allocated room | 287 | /* else, we are overriding an existing key => no need to allocated room |
288 | * in uCode. */ | 288 | * in uCode. */ |
289 | 289 | ||
290 | WARN(priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET, | 290 | WARN(il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET, |
291 | "no space for a new key"); | 291 | "no space for a new key"); |
292 | 292 | ||
293 | priv->stations[sta_id].sta.key.key_flags = key_flags; | 293 | il->stations[sta_id].sta.key.key_flags = key_flags; |
294 | priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; | 294 | il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; |
295 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | 295 | il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; |
296 | 296 | ||
297 | memcpy(&sta_cmd, &priv->stations[sta_id].sta, | 297 | memcpy(&sta_cmd, &il->stations[sta_id].sta, |
298 | sizeof(struct il_addsta_cmd)); | 298 | sizeof(struct il_addsta_cmd)); |
299 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 299 | spin_unlock_irqrestore(&il->sta_lock, flags); |
300 | 300 | ||
301 | return il_send_add_sta(priv, &sta_cmd, CMD_SYNC); | 301 | return il_send_add_sta(il, &sta_cmd, CMD_SYNC); |
302 | } | 302 | } |
303 | 303 | ||
304 | static int il4965_set_ccmp_dynamic_key_info(struct il_priv *priv, | 304 | static int il4965_set_ccmp_dynamic_key_info(struct il_priv *il, |
305 | struct il_rxon_context *ctx, | 305 | struct il_rxon_context *ctx, |
306 | struct ieee80211_key_conf *keyconf, | 306 | struct ieee80211_key_conf *keyconf, |
307 | u8 sta_id) | 307 | u8 sta_id) |
@@ -310,7 +310,7 @@ static int il4965_set_ccmp_dynamic_key_info(struct il_priv *priv, | |||
310 | __le16 key_flags = 0; | 310 | __le16 key_flags = 0; |
311 | struct il_addsta_cmd sta_cmd; | 311 | struct il_addsta_cmd sta_cmd; |
312 | 312 | ||
313 | lockdep_assert_held(&priv->mutex); | 313 | lockdep_assert_held(&il->mutex); |
314 | 314 | ||
315 | key_flags |= (STA_KEY_FLG_CCMP | STA_KEY_FLG_MAP_KEY_MSK); | 315 | key_flags |= (STA_KEY_FLG_CCMP | STA_KEY_FLG_MAP_KEY_MSK); |
316 | key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); | 316 | 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, | |||
321 | 321 | ||
322 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; | 322 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; |
323 | 323 | ||
324 | spin_lock_irqsave(&priv->sta_lock, flags); | 324 | spin_lock_irqsave(&il->sta_lock, flags); |
325 | priv->stations[sta_id].keyinfo.cipher = keyconf->cipher; | 325 | il->stations[sta_id].keyinfo.cipher = keyconf->cipher; |
326 | priv->stations[sta_id].keyinfo.keylen = keyconf->keylen; | 326 | il->stations[sta_id].keyinfo.keylen = keyconf->keylen; |
327 | 327 | ||
328 | memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, | 328 | memcpy(il->stations[sta_id].keyinfo.key, keyconf->key, |
329 | keyconf->keylen); | 329 | keyconf->keylen); |
330 | 330 | ||
331 | memcpy(priv->stations[sta_id].sta.key.key, keyconf->key, | 331 | memcpy(il->stations[sta_id].sta.key.key, keyconf->key, |
332 | keyconf->keylen); | 332 | keyconf->keylen); |
333 | 333 | ||
334 | if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK) | 334 | if ((il->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK) |
335 | == STA_KEY_FLG_NO_ENC) | 335 | == STA_KEY_FLG_NO_ENC) |
336 | priv->stations[sta_id].sta.key.key_offset = | 336 | il->stations[sta_id].sta.key.key_offset = |
337 | il_get_free_ucode_key_index(priv); | 337 | il_get_free_ucode_key_index(il); |
338 | /* else, we are overriding an existing key => no need to allocated room | 338 | /* else, we are overriding an existing key => no need to allocated room |
339 | * in uCode. */ | 339 | * in uCode. */ |
340 | 340 | ||
341 | WARN(priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET, | 341 | WARN(il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET, |
342 | "no space for a new key"); | 342 | "no space for a new key"); |
343 | 343 | ||
344 | priv->stations[sta_id].sta.key.key_flags = key_flags; | 344 | il->stations[sta_id].sta.key.key_flags = key_flags; |
345 | priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; | 345 | il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; |
346 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | 346 | il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; |
347 | 347 | ||
348 | memcpy(&sta_cmd, &priv->stations[sta_id].sta, | 348 | memcpy(&sta_cmd, &il->stations[sta_id].sta, |
349 | sizeof(struct il_addsta_cmd)); | 349 | sizeof(struct il_addsta_cmd)); |
350 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 350 | spin_unlock_irqrestore(&il->sta_lock, flags); |
351 | 351 | ||
352 | return il_send_add_sta(priv, &sta_cmd, CMD_SYNC); | 352 | return il_send_add_sta(il, &sta_cmd, CMD_SYNC); |
353 | } | 353 | } |
354 | 354 | ||
355 | static int il4965_set_tkip_dynamic_key_info(struct il_priv *priv, | 355 | static int il4965_set_tkip_dynamic_key_info(struct il_priv *il, |
356 | struct il_rxon_context *ctx, | 356 | struct il_rxon_context *ctx, |
357 | struct ieee80211_key_conf *keyconf, | 357 | struct ieee80211_key_conf *keyconf, |
358 | u8 sta_id) | 358 | u8 sta_id) |
@@ -371,35 +371,35 @@ static int il4965_set_tkip_dynamic_key_info(struct il_priv *priv, | |||
371 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; | 371 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; |
372 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; | 372 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; |
373 | 373 | ||
374 | spin_lock_irqsave(&priv->sta_lock, flags); | 374 | spin_lock_irqsave(&il->sta_lock, flags); |
375 | 375 | ||
376 | priv->stations[sta_id].keyinfo.cipher = keyconf->cipher; | 376 | il->stations[sta_id].keyinfo.cipher = keyconf->cipher; |
377 | priv->stations[sta_id].keyinfo.keylen = 16; | 377 | il->stations[sta_id].keyinfo.keylen = 16; |
378 | 378 | ||
379 | if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK) | 379 | if ((il->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK) |
380 | == STA_KEY_FLG_NO_ENC) | 380 | == STA_KEY_FLG_NO_ENC) |
381 | priv->stations[sta_id].sta.key.key_offset = | 381 | il->stations[sta_id].sta.key.key_offset = |
382 | il_get_free_ucode_key_index(priv); | 382 | il_get_free_ucode_key_index(il); |
383 | /* else, we are overriding an existing key => no need to allocated room | 383 | /* else, we are overriding an existing key => no need to allocated room |
384 | * in uCode. */ | 384 | * in uCode. */ |
385 | 385 | ||
386 | WARN(priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET, | 386 | WARN(il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET, |
387 | "no space for a new key"); | 387 | "no space for a new key"); |
388 | 388 | ||
389 | priv->stations[sta_id].sta.key.key_flags = key_flags; | 389 | il->stations[sta_id].sta.key.key_flags = key_flags; |
390 | 390 | ||
391 | 391 | ||
392 | /* This copy is acutally not needed: we get the key with each TX */ | 392 | /* This copy is acutally not needed: we get the key with each TX */ |
393 | memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, 16); | 393 | memcpy(il->stations[sta_id].keyinfo.key, keyconf->key, 16); |
394 | 394 | ||
395 | memcpy(priv->stations[sta_id].sta.key.key, keyconf->key, 16); | 395 | memcpy(il->stations[sta_id].sta.key.key, keyconf->key, 16); |
396 | 396 | ||
397 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 397 | spin_unlock_irqrestore(&il->sta_lock, flags); |
398 | 398 | ||
399 | return ret; | 399 | return ret; |
400 | } | 400 | } |
401 | 401 | ||
402 | void il4965_update_tkip_key(struct il_priv *priv, | 402 | void il4965_update_tkip_key(struct il_priv *il, |
403 | struct il_rxon_context *ctx, | 403 | struct il_rxon_context *ctx, |
404 | struct ieee80211_key_conf *keyconf, | 404 | struct ieee80211_key_conf *keyconf, |
405 | struct ieee80211_sta *sta, u32 iv32, u16 *phase1key) | 405 | struct ieee80211_sta *sta, u32 iv32, u16 *phase1key) |
@@ -408,34 +408,34 @@ void il4965_update_tkip_key(struct il_priv *priv, | |||
408 | unsigned long flags; | 408 | unsigned long flags; |
409 | int i; | 409 | int i; |
410 | 410 | ||
411 | if (il_scan_cancel(priv)) { | 411 | if (il_scan_cancel(il)) { |
412 | /* cancel scan failed, just live w/ bad key and rely | 412 | /* cancel scan failed, just live w/ bad key and rely |
413 | briefly on SW decryption */ | 413 | briefly on SW decryption */ |
414 | return; | 414 | return; |
415 | } | 415 | } |
416 | 416 | ||
417 | sta_id = il_sta_id_or_broadcast(priv, ctx, sta); | 417 | sta_id = il_sta_id_or_broadcast(il, ctx, sta); |
418 | if (sta_id == IL_INVALID_STATION) | 418 | if (sta_id == IL_INVALID_STATION) |
419 | return; | 419 | return; |
420 | 420 | ||
421 | spin_lock_irqsave(&priv->sta_lock, flags); | 421 | spin_lock_irqsave(&il->sta_lock, flags); |
422 | 422 | ||
423 | priv->stations[sta_id].sta.key.tkip_rx_tsc_byte2 = (u8) iv32; | 423 | il->stations[sta_id].sta.key.tkip_rx_tsc_byte2 = (u8) iv32; |
424 | 424 | ||
425 | for (i = 0; i < 5; i++) | 425 | for (i = 0; i < 5; i++) |
426 | priv->stations[sta_id].sta.key.tkip_rx_ttak[i] = | 426 | il->stations[sta_id].sta.key.tkip_rx_ttak[i] = |
427 | cpu_to_le16(phase1key[i]); | 427 | cpu_to_le16(phase1key[i]); |
428 | 428 | ||
429 | priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; | 429 | il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; |
430 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | 430 | il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; |
431 | 431 | ||
432 | il_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); | 432 | il_send_add_sta(il, &il->stations[sta_id].sta, CMD_ASYNC); |
433 | 433 | ||
434 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 434 | spin_unlock_irqrestore(&il->sta_lock, flags); |
435 | 435 | ||
436 | } | 436 | } |
437 | 437 | ||
438 | int il4965_remove_dynamic_key(struct il_priv *priv, | 438 | int il4965_remove_dynamic_key(struct il_priv *il, |
439 | struct il_rxon_context *ctx, | 439 | struct il_rxon_context *ctx, |
440 | struct ieee80211_key_conf *keyconf, | 440 | struct ieee80211_key_conf *keyconf, |
441 | u8 sta_id) | 441 | u8 sta_id) |
@@ -445,15 +445,15 @@ int il4965_remove_dynamic_key(struct il_priv *priv, | |||
445 | u8 keyidx; | 445 | u8 keyidx; |
446 | struct il_addsta_cmd sta_cmd; | 446 | struct il_addsta_cmd sta_cmd; |
447 | 447 | ||
448 | lockdep_assert_held(&priv->mutex); | 448 | lockdep_assert_held(&il->mutex); |
449 | 449 | ||
450 | ctx->key_mapping_keys--; | 450 | ctx->key_mapping_keys--; |
451 | 451 | ||
452 | spin_lock_irqsave(&priv->sta_lock, flags); | 452 | spin_lock_irqsave(&il->sta_lock, flags); |
453 | key_flags = le16_to_cpu(priv->stations[sta_id].sta.key.key_flags); | 453 | key_flags = le16_to_cpu(il->stations[sta_id].sta.key.key_flags); |
454 | keyidx = (key_flags >> STA_KEY_FLG_KEYID_POS) & 0x3; | 454 | keyidx = (key_flags >> STA_KEY_FLG_KEYID_POS) & 0x3; |
455 | 455 | ||
456 | IL_DEBUG_WEP(priv, "Remove dynamic key: idx=%d sta=%d\n", | 456 | IL_DEBUG_WEP(il, "Remove dynamic key: idx=%d sta=%d\n", |
457 | keyconf->keyidx, sta_id); | 457 | keyconf->keyidx, sta_id); |
458 | 458 | ||
459 | if (keyconf->keyidx != keyidx) { | 459 | if (keyconf->keyidx != keyidx) { |
@@ -462,76 +462,76 @@ int il4965_remove_dynamic_key(struct il_priv *priv, | |||
462 | * been replaced by another one with different index. | 462 | * been replaced by another one with different index. |
463 | * Don't do anything and return ok | 463 | * Don't do anything and return ok |
464 | */ | 464 | */ |
465 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 465 | spin_unlock_irqrestore(&il->sta_lock, flags); |
466 | return 0; | 466 | return 0; |
467 | } | 467 | } |
468 | 468 | ||
469 | if (priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET) { | 469 | if (il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET) { |
470 | IL_WARN(priv, "Removing wrong key %d 0x%x\n", | 470 | IL_WARN(il, "Removing wrong key %d 0x%x\n", |
471 | keyconf->keyidx, key_flags); | 471 | keyconf->keyidx, key_flags); |
472 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 472 | spin_unlock_irqrestore(&il->sta_lock, flags); |
473 | return 0; | 473 | return 0; |
474 | } | 474 | } |
475 | 475 | ||
476 | if (!test_and_clear_bit(priv->stations[sta_id].sta.key.key_offset, | 476 | if (!test_and_clear_bit(il->stations[sta_id].sta.key.key_offset, |
477 | &priv->ucode_key_table)) | 477 | &il->ucode_key_table)) |
478 | IL_ERR(priv, "index %d not used in uCode key table.\n", | 478 | IL_ERR(il, "index %d not used in uCode key table.\n", |
479 | priv->stations[sta_id].sta.key.key_offset); | 479 | il->stations[sta_id].sta.key.key_offset); |
480 | memset(&priv->stations[sta_id].keyinfo, 0, | 480 | memset(&il->stations[sta_id].keyinfo, 0, |
481 | sizeof(struct il_hw_key)); | 481 | sizeof(struct il_hw_key)); |
482 | memset(&priv->stations[sta_id].sta.key, 0, | 482 | memset(&il->stations[sta_id].sta.key, 0, |
483 | sizeof(struct il4965_keyinfo)); | 483 | sizeof(struct il4965_keyinfo)); |
484 | priv->stations[sta_id].sta.key.key_flags = | 484 | il->stations[sta_id].sta.key.key_flags = |
485 | STA_KEY_FLG_NO_ENC | STA_KEY_FLG_INVALID; | 485 | STA_KEY_FLG_NO_ENC | STA_KEY_FLG_INVALID; |
486 | priv->stations[sta_id].sta.key.key_offset = WEP_INVALID_OFFSET; | 486 | il->stations[sta_id].sta.key.key_offset = WEP_INVALID_OFFSET; |
487 | priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; | 487 | il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; |
488 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | 488 | il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; |
489 | 489 | ||
490 | if (il_is_rfkill(priv)) { | 490 | if (il_is_rfkill(il)) { |
491 | IL_DEBUG_WEP(priv, | 491 | IL_DEBUG_WEP(il, |
492 | "Not sending REPLY_ADD_STA command because RFKILL enabled.\n"); | 492 | "Not sending REPLY_ADD_STA command because RFKILL enabled.\n"); |
493 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 493 | spin_unlock_irqrestore(&il->sta_lock, flags); |
494 | return 0; | 494 | return 0; |
495 | } | 495 | } |
496 | memcpy(&sta_cmd, &priv->stations[sta_id].sta, | 496 | memcpy(&sta_cmd, &il->stations[sta_id].sta, |
497 | sizeof(struct il_addsta_cmd)); | 497 | sizeof(struct il_addsta_cmd)); |
498 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 498 | spin_unlock_irqrestore(&il->sta_lock, flags); |
499 | 499 | ||
500 | return il_send_add_sta(priv, &sta_cmd, CMD_SYNC); | 500 | return il_send_add_sta(il, &sta_cmd, CMD_SYNC); |
501 | } | 501 | } |
502 | 502 | ||
503 | int il4965_set_dynamic_key(struct il_priv *priv, struct il_rxon_context *ctx, | 503 | int il4965_set_dynamic_key(struct il_priv *il, struct il_rxon_context *ctx, |
504 | struct ieee80211_key_conf *keyconf, u8 sta_id) | 504 | struct ieee80211_key_conf *keyconf, u8 sta_id) |
505 | { | 505 | { |
506 | int ret; | 506 | int ret; |
507 | 507 | ||
508 | lockdep_assert_held(&priv->mutex); | 508 | lockdep_assert_held(&il->mutex); |
509 | 509 | ||
510 | ctx->key_mapping_keys++; | 510 | ctx->key_mapping_keys++; |
511 | keyconf->hw_key_idx = HW_KEY_DYNAMIC; | 511 | keyconf->hw_key_idx = HW_KEY_DYNAMIC; |
512 | 512 | ||
513 | switch (keyconf->cipher) { | 513 | switch (keyconf->cipher) { |
514 | case WLAN_CIPHER_SUITE_CCMP: | 514 | case WLAN_CIPHER_SUITE_CCMP: |
515 | ret = il4965_set_ccmp_dynamic_key_info(priv, ctx, | 515 | ret = il4965_set_ccmp_dynamic_key_info(il, ctx, |
516 | keyconf, sta_id); | 516 | keyconf, sta_id); |
517 | break; | 517 | break; |
518 | case WLAN_CIPHER_SUITE_TKIP: | 518 | case WLAN_CIPHER_SUITE_TKIP: |
519 | ret = il4965_set_tkip_dynamic_key_info(priv, ctx, | 519 | ret = il4965_set_tkip_dynamic_key_info(il, ctx, |
520 | keyconf, sta_id); | 520 | keyconf, sta_id); |
521 | break; | 521 | break; |
522 | case WLAN_CIPHER_SUITE_WEP40: | 522 | case WLAN_CIPHER_SUITE_WEP40: |
523 | case WLAN_CIPHER_SUITE_WEP104: | 523 | case WLAN_CIPHER_SUITE_WEP104: |
524 | ret = il4965_set_wep_dynamic_key_info(priv, ctx, | 524 | ret = il4965_set_wep_dynamic_key_info(il, ctx, |
525 | keyconf, sta_id); | 525 | keyconf, sta_id); |
526 | break; | 526 | break; |
527 | default: | 527 | default: |
528 | IL_ERR(priv, | 528 | IL_ERR(il, |
529 | "Unknown alg: %s cipher = %x\n", __func__, | 529 | "Unknown alg: %s cipher = %x\n", __func__, |
530 | keyconf->cipher); | 530 | keyconf->cipher); |
531 | ret = -EINVAL; | 531 | ret = -EINVAL; |
532 | } | 532 | } |
533 | 533 | ||
534 | IL_DEBUG_WEP(priv, | 534 | IL_DEBUG_WEP(il, |
535 | "Set dynamic key: cipher=%x len=%d idx=%d sta=%d ret=%d\n", | 535 | "Set dynamic key: cipher=%x len=%d idx=%d sta=%d ret=%d\n", |
536 | keyconf->cipher, keyconf->keylen, keyconf->keyidx, | 536 | keyconf->cipher, keyconf->keylen, keyconf->keyidx, |
537 | sta_id, ret); | 537 | sta_id, ret); |
@@ -546,37 +546,37 @@ int il4965_set_dynamic_key(struct il_priv *priv, struct il_rxon_context *ctx, | |||
546 | * and marks it driver active, so that it will be restored to the | 546 | * and marks it driver active, so that it will be restored to the |
547 | * device at the next best time. | 547 | * device at the next best time. |
548 | */ | 548 | */ |
549 | int il4965_alloc_bcast_station(struct il_priv *priv, | 549 | int il4965_alloc_bcast_station(struct il_priv *il, |
550 | struct il_rxon_context *ctx) | 550 | struct il_rxon_context *ctx) |
551 | { | 551 | { |
552 | struct il_link_quality_cmd *link_cmd; | 552 | struct il_link_quality_cmd *link_cmd; |
553 | unsigned long flags; | 553 | unsigned long flags; |
554 | u8 sta_id; | 554 | u8 sta_id; |
555 | 555 | ||
556 | spin_lock_irqsave(&priv->sta_lock, flags); | 556 | spin_lock_irqsave(&il->sta_lock, flags); |
557 | sta_id = il_prep_station(priv, ctx, iwlegacy_bcast_addr, | 557 | sta_id = il_prep_station(il, ctx, iwlegacy_bcast_addr, |
558 | false, NULL); | 558 | false, NULL); |
559 | if (sta_id == IL_INVALID_STATION) { | 559 | if (sta_id == IL_INVALID_STATION) { |
560 | IL_ERR(priv, "Unable to prepare broadcast station\n"); | 560 | IL_ERR(il, "Unable to prepare broadcast station\n"); |
561 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 561 | spin_unlock_irqrestore(&il->sta_lock, flags); |
562 | 562 | ||
563 | return -EINVAL; | 563 | return -EINVAL; |
564 | } | 564 | } |
565 | 565 | ||
566 | priv->stations[sta_id].used |= IL_STA_DRIVER_ACTIVE; | 566 | il->stations[sta_id].used |= IL_STA_DRIVER_ACTIVE; |
567 | priv->stations[sta_id].used |= IL_STA_BCAST; | 567 | il->stations[sta_id].used |= IL_STA_BCAST; |
568 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 568 | spin_unlock_irqrestore(&il->sta_lock, flags); |
569 | 569 | ||
570 | link_cmd = il4965_sta_alloc_lq(priv, sta_id); | 570 | link_cmd = il4965_sta_alloc_lq(il, sta_id); |
571 | if (!link_cmd) { | 571 | if (!link_cmd) { |
572 | IL_ERR(priv, | 572 | IL_ERR(il, |
573 | "Unable to initialize rate scaling for bcast station.\n"); | 573 | "Unable to initialize rate scaling for bcast station.\n"); |
574 | return -ENOMEM; | 574 | return -ENOMEM; |
575 | } | 575 | } |
576 | 576 | ||
577 | spin_lock_irqsave(&priv->sta_lock, flags); | 577 | spin_lock_irqsave(&il->sta_lock, flags); |
578 | priv->stations[sta_id].lq = link_cmd; | 578 | il->stations[sta_id].lq = link_cmd; |
579 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 579 | spin_unlock_irqrestore(&il->sta_lock, flags); |
580 | 580 | ||
581 | return 0; | 581 | return 0; |
582 | } | 582 | } |
@@ -587,39 +587,39 @@ int il4965_alloc_bcast_station(struct il_priv *priv, | |||
587 | * Only used by iwl4965. Placed here to have all bcast station management | 587 | * Only used by iwl4965. Placed here to have all bcast station management |
588 | * code together. | 588 | * code together. |
589 | */ | 589 | */ |
590 | static int il4965_update_bcast_station(struct il_priv *priv, | 590 | static int il4965_update_bcast_station(struct il_priv *il, |
591 | struct il_rxon_context *ctx) | 591 | struct il_rxon_context *ctx) |
592 | { | 592 | { |
593 | unsigned long flags; | 593 | unsigned long flags; |
594 | struct il_link_quality_cmd *link_cmd; | 594 | struct il_link_quality_cmd *link_cmd; |
595 | u8 sta_id = ctx->bcast_sta_id; | 595 | u8 sta_id = ctx->bcast_sta_id; |
596 | 596 | ||
597 | link_cmd = il4965_sta_alloc_lq(priv, sta_id); | 597 | link_cmd = il4965_sta_alloc_lq(il, sta_id); |
598 | if (!link_cmd) { | 598 | if (!link_cmd) { |
599 | IL_ERR(priv, | 599 | IL_ERR(il, |
600 | "Unable to initialize rate scaling for bcast station.\n"); | 600 | "Unable to initialize rate scaling for bcast station.\n"); |
601 | return -ENOMEM; | 601 | return -ENOMEM; |
602 | } | 602 | } |
603 | 603 | ||
604 | spin_lock_irqsave(&priv->sta_lock, flags); | 604 | spin_lock_irqsave(&il->sta_lock, flags); |
605 | if (priv->stations[sta_id].lq) | 605 | if (il->stations[sta_id].lq) |
606 | kfree(priv->stations[sta_id].lq); | 606 | kfree(il->stations[sta_id].lq); |
607 | else | 607 | else |
608 | IL_DEBUG_INFO(priv, | 608 | IL_DEBUG_INFO(il, |
609 | "Bcast station rate scaling has not been initialized yet.\n"); | 609 | "Bcast station rate scaling has not been initialized yet.\n"); |
610 | priv->stations[sta_id].lq = link_cmd; | 610 | il->stations[sta_id].lq = link_cmd; |
611 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 611 | spin_unlock_irqrestore(&il->sta_lock, flags); |
612 | 612 | ||
613 | return 0; | 613 | return 0; |
614 | } | 614 | } |
615 | 615 | ||
616 | int il4965_update_bcast_stations(struct il_priv *priv) | 616 | int il4965_update_bcast_stations(struct il_priv *il) |
617 | { | 617 | { |
618 | struct il_rxon_context *ctx; | 618 | struct il_rxon_context *ctx; |
619 | int ret = 0; | 619 | int ret = 0; |
620 | 620 | ||
621 | for_each_context(priv, ctx) { | 621 | for_each_context(il, ctx) { |
622 | ret = il4965_update_bcast_station(priv, ctx); | 622 | ret = il4965_update_bcast_station(il, ctx); |
623 | if (ret) | 623 | if (ret) |
624 | break; | 624 | break; |
625 | } | 625 | } |
@@ -630,92 +630,92 @@ int il4965_update_bcast_stations(struct il_priv *priv) | |||
630 | /** | 630 | /** |
631 | * il4965_sta_tx_modify_enable_tid - Enable Tx for this TID in station table | 631 | * il4965_sta_tx_modify_enable_tid - Enable Tx for this TID in station table |
632 | */ | 632 | */ |
633 | int il4965_sta_tx_modify_enable_tid(struct il_priv *priv, int sta_id, int tid) | 633 | int il4965_sta_tx_modify_enable_tid(struct il_priv *il, int sta_id, int tid) |
634 | { | 634 | { |
635 | unsigned long flags; | 635 | unsigned long flags; |
636 | struct il_addsta_cmd sta_cmd; | 636 | struct il_addsta_cmd sta_cmd; |
637 | 637 | ||
638 | lockdep_assert_held(&priv->mutex); | 638 | lockdep_assert_held(&il->mutex); |
639 | 639 | ||
640 | /* Remove "disable" flag, to enable Tx for this TID */ | 640 | /* Remove "disable" flag, to enable Tx for this TID */ |
641 | spin_lock_irqsave(&priv->sta_lock, flags); | 641 | spin_lock_irqsave(&il->sta_lock, flags); |
642 | priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_TID_DISABLE_TX; | 642 | il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_TID_DISABLE_TX; |
643 | priv->stations[sta_id].sta.tid_disable_tx &= cpu_to_le16(~(1 << tid)); | 643 | il->stations[sta_id].sta.tid_disable_tx &= cpu_to_le16(~(1 << tid)); |
644 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | 644 | il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; |
645 | memcpy(&sta_cmd, &priv->stations[sta_id].sta, | 645 | memcpy(&sta_cmd, &il->stations[sta_id].sta, |
646 | sizeof(struct il_addsta_cmd)); | 646 | sizeof(struct il_addsta_cmd)); |
647 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 647 | spin_unlock_irqrestore(&il->sta_lock, flags); |
648 | 648 | ||
649 | return il_send_add_sta(priv, &sta_cmd, CMD_SYNC); | 649 | return il_send_add_sta(il, &sta_cmd, CMD_SYNC); |
650 | } | 650 | } |
651 | 651 | ||
652 | int il4965_sta_rx_agg_start(struct il_priv *priv, struct ieee80211_sta *sta, | 652 | int il4965_sta_rx_agg_start(struct il_priv *il, struct ieee80211_sta *sta, |
653 | int tid, u16 ssn) | 653 | int tid, u16 ssn) |
654 | { | 654 | { |
655 | unsigned long flags; | 655 | unsigned long flags; |
656 | int sta_id; | 656 | int sta_id; |
657 | struct il_addsta_cmd sta_cmd; | 657 | struct il_addsta_cmd sta_cmd; |
658 | 658 | ||
659 | lockdep_assert_held(&priv->mutex); | 659 | lockdep_assert_held(&il->mutex); |
660 | 660 | ||
661 | sta_id = il_sta_id(sta); | 661 | sta_id = il_sta_id(sta); |
662 | if (sta_id == IL_INVALID_STATION) | 662 | if (sta_id == IL_INVALID_STATION) |
663 | return -ENXIO; | 663 | return -ENXIO; |
664 | 664 | ||
665 | spin_lock_irqsave(&priv->sta_lock, flags); | 665 | spin_lock_irqsave(&il->sta_lock, flags); |
666 | priv->stations[sta_id].sta.station_flags_msk = 0; | 666 | il->stations[sta_id].sta.station_flags_msk = 0; |
667 | priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_ADDBA_TID_MSK; | 667 | il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_ADDBA_TID_MSK; |
668 | priv->stations[sta_id].sta.add_immediate_ba_tid = (u8)tid; | 668 | il->stations[sta_id].sta.add_immediate_ba_tid = (u8)tid; |
669 | priv->stations[sta_id].sta.add_immediate_ba_ssn = cpu_to_le16(ssn); | 669 | il->stations[sta_id].sta.add_immediate_ba_ssn = cpu_to_le16(ssn); |
670 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | 670 | il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; |
671 | memcpy(&sta_cmd, &priv->stations[sta_id].sta, | 671 | memcpy(&sta_cmd, &il->stations[sta_id].sta, |
672 | sizeof(struct il_addsta_cmd)); | 672 | sizeof(struct il_addsta_cmd)); |
673 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 673 | spin_unlock_irqrestore(&il->sta_lock, flags); |
674 | 674 | ||
675 | return il_send_add_sta(priv, &sta_cmd, CMD_SYNC); | 675 | return il_send_add_sta(il, &sta_cmd, CMD_SYNC); |
676 | } | 676 | } |
677 | 677 | ||
678 | int il4965_sta_rx_agg_stop(struct il_priv *priv, struct ieee80211_sta *sta, | 678 | int il4965_sta_rx_agg_stop(struct il_priv *il, struct ieee80211_sta *sta, |
679 | int tid) | 679 | int tid) |
680 | { | 680 | { |
681 | unsigned long flags; | 681 | unsigned long flags; |
682 | int sta_id; | 682 | int sta_id; |
683 | struct il_addsta_cmd sta_cmd; | 683 | struct il_addsta_cmd sta_cmd; |
684 | 684 | ||
685 | lockdep_assert_held(&priv->mutex); | 685 | lockdep_assert_held(&il->mutex); |
686 | 686 | ||
687 | sta_id = il_sta_id(sta); | 687 | sta_id = il_sta_id(sta); |
688 | if (sta_id == IL_INVALID_STATION) { | 688 | if (sta_id == IL_INVALID_STATION) { |
689 | IL_ERR(priv, "Invalid station for AGG tid %d\n", tid); | 689 | IL_ERR(il, "Invalid station for AGG tid %d\n", tid); |
690 | return -ENXIO; | 690 | return -ENXIO; |
691 | } | 691 | } |
692 | 692 | ||
693 | spin_lock_irqsave(&priv->sta_lock, flags); | 693 | spin_lock_irqsave(&il->sta_lock, flags); |
694 | priv->stations[sta_id].sta.station_flags_msk = 0; | 694 | il->stations[sta_id].sta.station_flags_msk = 0; |
695 | priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_DELBA_TID_MSK; | 695 | il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_DELBA_TID_MSK; |
696 | priv->stations[sta_id].sta.remove_immediate_ba_tid = (u8)tid; | 696 | il->stations[sta_id].sta.remove_immediate_ba_tid = (u8)tid; |
697 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | 697 | il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; |
698 | memcpy(&sta_cmd, &priv->stations[sta_id].sta, | 698 | memcpy(&sta_cmd, &il->stations[sta_id].sta, |
699 | sizeof(struct il_addsta_cmd)); | 699 | sizeof(struct il_addsta_cmd)); |
700 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 700 | spin_unlock_irqrestore(&il->sta_lock, flags); |
701 | 701 | ||
702 | return il_send_add_sta(priv, &sta_cmd, CMD_SYNC); | 702 | return il_send_add_sta(il, &sta_cmd, CMD_SYNC); |
703 | } | 703 | } |
704 | 704 | ||
705 | void | 705 | void |
706 | il4965_sta_modify_sleep_tx_count(struct il_priv *priv, int sta_id, int cnt) | 706 | il4965_sta_modify_sleep_tx_count(struct il_priv *il, int sta_id, int cnt) |
707 | { | 707 | { |
708 | unsigned long flags; | 708 | unsigned long flags; |
709 | 709 | ||
710 | spin_lock_irqsave(&priv->sta_lock, flags); | 710 | spin_lock_irqsave(&il->sta_lock, flags); |
711 | priv->stations[sta_id].sta.station_flags |= STA_FLG_PWR_SAVE_MSK; | 711 | il->stations[sta_id].sta.station_flags |= STA_FLG_PWR_SAVE_MSK; |
712 | priv->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK; | 712 | il->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK; |
713 | priv->stations[sta_id].sta.sta.modify_mask = | 713 | il->stations[sta_id].sta.sta.modify_mask = |
714 | STA_MODIFY_SLEEP_TX_COUNT_MSK; | 714 | STA_MODIFY_SLEEP_TX_COUNT_MSK; |
715 | priv->stations[sta_id].sta.sleep_tx_count = cpu_to_le16(cnt); | 715 | il->stations[sta_id].sta.sleep_tx_count = cpu_to_le16(cnt); |
716 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | 716 | il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; |
717 | il_send_add_sta(priv, | 717 | il_send_add_sta(il, |
718 | &priv->stations[sta_id].sta, CMD_ASYNC); | 718 | &il->stations[sta_id].sta, CMD_ASYNC); |
719 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 719 | spin_unlock_irqrestore(&il->sta_lock, flags); |
720 | 720 | ||
721 | } | 721 | } |
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c index 3fdb9d9201d..59d737496b5 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) | |||
99 | /* | 99 | /* |
100 | * handle build REPLY_TX command notification. | 100 | * handle build REPLY_TX command notification. |
101 | */ | 101 | */ |
102 | static void il4965_tx_cmd_build_basic(struct il_priv *priv, | 102 | static void il4965_tx_cmd_build_basic(struct il_priv *il, |
103 | struct sk_buff *skb, | 103 | struct sk_buff *skb, |
104 | struct il_tx_cmd *tx_cmd, | 104 | struct il_tx_cmd *tx_cmd, |
105 | struct ieee80211_tx_info *info, | 105 | struct ieee80211_tx_info *info, |
@@ -137,7 +137,7 @@ static void il4965_tx_cmd_build_basic(struct il_priv *priv, | |||
137 | tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; | 137 | tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; |
138 | } | 138 | } |
139 | 139 | ||
140 | il_tx_cmd_protection(priv, info, fc, &tx_flags); | 140 | il_tx_cmd_protection(il, info, fc, &tx_flags); |
141 | 141 | ||
142 | tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK); | 142 | tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK); |
143 | if (ieee80211_is_mgmt(fc)) { | 143 | if (ieee80211_is_mgmt(fc)) { |
@@ -156,7 +156,7 @@ static void il4965_tx_cmd_build_basic(struct il_priv *priv, | |||
156 | 156 | ||
157 | #define RTS_DFAULT_RETRY_LIMIT 60 | 157 | #define RTS_DFAULT_RETRY_LIMIT 60 |
158 | 158 | ||
159 | static void il4965_tx_cmd_build_rate(struct il_priv *priv, | 159 | static void il4965_tx_cmd_build_rate(struct il_priv *il, |
160 | struct il_tx_cmd *tx_cmd, | 160 | struct il_tx_cmd *tx_cmd, |
161 | struct ieee80211_tx_info *info, | 161 | struct ieee80211_tx_info *info, |
162 | __le16 fc) | 162 | __le16 fc) |
@@ -197,7 +197,7 @@ static void il4965_tx_cmd_build_rate(struct il_priv *priv, | |||
197 | rate_idx = info->control.rates[0].idx; | 197 | rate_idx = info->control.rates[0].idx; |
198 | if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS || | 198 | if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS || |
199 | (rate_idx < 0) || (rate_idx > IL_RATE_COUNT_LEGACY)) | 199 | (rate_idx < 0) || (rate_idx > IL_RATE_COUNT_LEGACY)) |
200 | rate_idx = rate_lowest_index(&priv->bands[info->band], | 200 | rate_idx = rate_lowest_index(&il->bands[info->band], |
201 | info->control.sta); | 201 | info->control.sta); |
202 | /* For 5 GHZ band, remap mac80211 rate indices into driver indices */ | 202 | /* For 5 GHZ band, remap mac80211 rate indices into driver indices */ |
203 | if (info->band == IEEE80211_BAND_5GHZ) | 203 | if (info->band == IEEE80211_BAND_5GHZ) |
@@ -212,16 +212,16 @@ static void il4965_tx_cmd_build_rate(struct il_priv *priv, | |||
212 | rate_flags |= RATE_MCS_CCK_MSK; | 212 | rate_flags |= RATE_MCS_CCK_MSK; |
213 | 213 | ||
214 | /* Set up antennas */ | 214 | /* Set up antennas */ |
215 | priv->mgmt_tx_ant = il4965_toggle_tx_ant(priv, priv->mgmt_tx_ant, | 215 | il->mgmt_tx_ant = il4965_toggle_tx_ant(il, il->mgmt_tx_ant, |
216 | priv->hw_params.valid_tx_ant); | 216 | il->hw_params.valid_tx_ant); |
217 | 217 | ||
218 | rate_flags |= il4965_ant_idx_to_flags(priv->mgmt_tx_ant); | 218 | rate_flags |= il4965_ant_idx_to_flags(il->mgmt_tx_ant); |
219 | 219 | ||
220 | /* Set the rate in the TX cmd */ | 220 | /* Set the rate in the TX cmd */ |
221 | tx_cmd->rate_n_flags = il4965_hw_set_rate_n_flags(rate_plcp, rate_flags); | 221 | tx_cmd->rate_n_flags = il4965_hw_set_rate_n_flags(rate_plcp, rate_flags); |
222 | } | 222 | } |
223 | 223 | ||
224 | static void il4965_tx_cmd_build_hwcrypto(struct il_priv *priv, | 224 | static void il4965_tx_cmd_build_hwcrypto(struct il_priv *il, |
225 | struct ieee80211_tx_info *info, | 225 | struct ieee80211_tx_info *info, |
226 | struct il_tx_cmd *tx_cmd, | 226 | struct il_tx_cmd *tx_cmd, |
227 | struct sk_buff *skb_frag, | 227 | struct sk_buff *skb_frag, |
@@ -235,13 +235,13 @@ static void il4965_tx_cmd_build_hwcrypto(struct il_priv *priv, | |||
235 | memcpy(tx_cmd->key, keyconf->key, keyconf->keylen); | 235 | memcpy(tx_cmd->key, keyconf->key, keyconf->keylen); |
236 | if (info->flags & IEEE80211_TX_CTL_AMPDU) | 236 | if (info->flags & IEEE80211_TX_CTL_AMPDU) |
237 | tx_cmd->tx_flags |= TX_CMD_FLG_AGG_CCMP_MSK; | 237 | tx_cmd->tx_flags |= TX_CMD_FLG_AGG_CCMP_MSK; |
238 | IL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n"); | 238 | IL_DEBUG_TX(il, "tx_cmd with AES hwcrypto\n"); |
239 | break; | 239 | break; |
240 | 240 | ||
241 | case WLAN_CIPHER_SUITE_TKIP: | 241 | case WLAN_CIPHER_SUITE_TKIP: |
242 | tx_cmd->sec_ctl = TX_CMD_SEC_TKIP; | 242 | tx_cmd->sec_ctl = TX_CMD_SEC_TKIP; |
243 | ieee80211_get_tkip_p2k(keyconf, skb_frag, tx_cmd->key); | 243 | ieee80211_get_tkip_p2k(keyconf, skb_frag, tx_cmd->key); |
244 | IL_DEBUG_TX(priv, "tx_cmd with tkip hwcrypto\n"); | 244 | IL_DEBUG_TX(il, "tx_cmd with tkip hwcrypto\n"); |
245 | break; | 245 | break; |
246 | 246 | ||
247 | case WLAN_CIPHER_SUITE_WEP104: | 247 | case WLAN_CIPHER_SUITE_WEP104: |
@@ -253,12 +253,12 @@ static void il4965_tx_cmd_build_hwcrypto(struct il_priv *priv, | |||
253 | 253 | ||
254 | memcpy(&tx_cmd->key[3], keyconf->key, keyconf->keylen); | 254 | memcpy(&tx_cmd->key[3], keyconf->key, keyconf->keylen); |
255 | 255 | ||
256 | IL_DEBUG_TX(priv, "Configuring packet for WEP encryption " | 256 | IL_DEBUG_TX(il, "Configuring packet for WEP encryption " |
257 | "with key %d\n", keyconf->keyidx); | 257 | "with key %d\n", keyconf->keyidx); |
258 | break; | 258 | break; |
259 | 259 | ||
260 | default: | 260 | default: |
261 | IL_ERR(priv, "Unknown encode cipher %x\n", keyconf->cipher); | 261 | IL_ERR(il, "Unknown encode cipher %x\n", keyconf->cipher); |
262 | break; | 262 | break; |
263 | } | 263 | } |
264 | } | 264 | } |
@@ -266,7 +266,7 @@ static void il4965_tx_cmd_build_hwcrypto(struct il_priv *priv, | |||
266 | /* | 266 | /* |
267 | * start REPLY_TX command process | 267 | * start REPLY_TX command process |
268 | */ | 268 | */ |
269 | int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) | 269 | int il4965_tx_skb(struct il_priv *il, struct sk_buff *skb) |
270 | { | 270 | { |
271 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 271 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
272 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 272 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
@@ -277,7 +277,7 @@ int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) | |||
277 | struct il_device_cmd *out_cmd; | 277 | struct il_device_cmd *out_cmd; |
278 | struct il_cmd_meta *out_meta; | 278 | struct il_cmd_meta *out_meta; |
279 | struct il_tx_cmd *tx_cmd; | 279 | struct il_tx_cmd *tx_cmd; |
280 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 280 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
281 | int txq_id; | 281 | int txq_id; |
282 | dma_addr_t phys_addr; | 282 | dma_addr_t phys_addr; |
283 | dma_addr_t txcmd_phys; | 283 | dma_addr_t txcmd_phys; |
@@ -296,9 +296,9 @@ int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) | |||
296 | if (info->control.vif) | 296 | if (info->control.vif) |
297 | ctx = il_rxon_ctx_from_vif(info->control.vif); | 297 | ctx = il_rxon_ctx_from_vif(info->control.vif); |
298 | 298 | ||
299 | spin_lock_irqsave(&priv->lock, flags); | 299 | spin_lock_irqsave(&il->lock, flags); |
300 | if (il_is_rfkill(priv)) { | 300 | if (il_is_rfkill(il)) { |
301 | IL_DEBUG_DROP(priv, "Dropping - RF KILL\n"); | 301 | IL_DEBUG_DROP(il, "Dropping - RF KILL\n"); |
302 | goto drop_unlock; | 302 | goto drop_unlock; |
303 | } | 303 | } |
304 | 304 | ||
@@ -306,11 +306,11 @@ int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) | |||
306 | 306 | ||
307 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 307 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
308 | if (ieee80211_is_auth(fc)) | 308 | if (ieee80211_is_auth(fc)) |
309 | IL_DEBUG_TX(priv, "Sending AUTH frame\n"); | 309 | IL_DEBUG_TX(il, "Sending AUTH frame\n"); |
310 | else if (ieee80211_is_assoc_req(fc)) | 310 | else if (ieee80211_is_assoc_req(fc)) |
311 | IL_DEBUG_TX(priv, "Sending ASSOC frame\n"); | 311 | IL_DEBUG_TX(il, "Sending ASSOC frame\n"); |
312 | else if (ieee80211_is_reassoc_req(fc)) | 312 | else if (ieee80211_is_reassoc_req(fc)) |
313 | IL_DEBUG_TX(priv, "Sending REASSOC frame\n"); | 313 | IL_DEBUG_TX(il, "Sending REASSOC frame\n"); |
314 | #endif | 314 | #endif |
315 | 315 | ||
316 | hdr_len = ieee80211_hdrlen(fc); | 316 | hdr_len = ieee80211_hdrlen(fc); |
@@ -320,16 +320,16 @@ int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) | |||
320 | sta_id = ctx->bcast_sta_id; | 320 | sta_id = ctx->bcast_sta_id; |
321 | else { | 321 | else { |
322 | /* Find index into station table for destination station */ | 322 | /* Find index into station table for destination station */ |
323 | sta_id = il_sta_id_or_broadcast(priv, ctx, info->control.sta); | 323 | sta_id = il_sta_id_or_broadcast(il, ctx, info->control.sta); |
324 | 324 | ||
325 | if (sta_id == IL_INVALID_STATION) { | 325 | if (sta_id == IL_INVALID_STATION) { |
326 | IL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", | 326 | IL_DEBUG_DROP(il, "Dropping - INVALID STATION: %pM\n", |
327 | hdr->addr1); | 327 | hdr->addr1); |
328 | goto drop_unlock; | 328 | goto drop_unlock; |
329 | } | 329 | } |
330 | } | 330 | } |
331 | 331 | ||
332 | IL_DEBUG_TX(priv, "station Id %d\n", sta_id); | 332 | IL_DEBUG_TX(il, "station Id %d\n", sta_id); |
333 | 333 | ||
334 | if (sta) | 334 | if (sta) |
335 | sta_priv = (void *)sta->drv_priv; | 335 | sta_priv = (void *)sta->drv_priv; |
@@ -345,7 +345,7 @@ int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) | |||
345 | * For now set the counter to just 1 since we do not | 345 | * For now set the counter to just 1 since we do not |
346 | * support uAPSD yet. | 346 | * support uAPSD yet. |
347 | */ | 347 | */ |
348 | il4965_sta_modify_sleep_tx_count(priv, sta_id, 1); | 348 | il4965_sta_modify_sleep_tx_count(il, sta_id, 1); |
349 | } | 349 | } |
350 | 350 | ||
351 | /* | 351 | /* |
@@ -363,17 +363,17 @@ int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) | |||
363 | } else | 363 | } else |
364 | txq_id = ctx->ac_to_queue[skb_get_queue_mapping(skb)]; | 364 | txq_id = ctx->ac_to_queue[skb_get_queue_mapping(skb)]; |
365 | 365 | ||
366 | /* irqs already disabled/saved above when locking priv->lock */ | 366 | /* irqs already disabled/saved above when locking il->lock */ |
367 | spin_lock(&priv->sta_lock); | 367 | spin_lock(&il->sta_lock); |
368 | 368 | ||
369 | if (ieee80211_is_data_qos(fc)) { | 369 | if (ieee80211_is_data_qos(fc)) { |
370 | qc = ieee80211_get_qos_ctl(hdr); | 370 | qc = ieee80211_get_qos_ctl(hdr); |
371 | tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; | 371 | tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; |
372 | if (WARN_ON_ONCE(tid >= MAX_TID_COUNT)) { | 372 | if (WARN_ON_ONCE(tid >= MAX_TID_COUNT)) { |
373 | spin_unlock(&priv->sta_lock); | 373 | spin_unlock(&il->sta_lock); |
374 | goto drop_unlock; | 374 | goto drop_unlock; |
375 | } | 375 | } |
376 | seq_number = priv->stations[sta_id].tid[tid].seq_number; | 376 | seq_number = il->stations[sta_id].tid[tid].seq_number; |
377 | seq_number &= IEEE80211_SCTL_SEQ; | 377 | seq_number &= IEEE80211_SCTL_SEQ; |
378 | hdr->seq_ctrl = hdr->seq_ctrl & | 378 | hdr->seq_ctrl = hdr->seq_ctrl & |
379 | cpu_to_le16(IEEE80211_SCTL_FRAG); | 379 | cpu_to_le16(IEEE80211_SCTL_FRAG); |
@@ -381,27 +381,27 @@ int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) | |||
381 | seq_number += 0x10; | 381 | seq_number += 0x10; |
382 | /* aggregation is on for this <sta,tid> */ | 382 | /* aggregation is on for this <sta,tid> */ |
383 | if (info->flags & IEEE80211_TX_CTL_AMPDU && | 383 | if (info->flags & IEEE80211_TX_CTL_AMPDU && |
384 | priv->stations[sta_id].tid[tid].agg.state == IL_AGG_ON) { | 384 | il->stations[sta_id].tid[tid].agg.state == IL_AGG_ON) { |
385 | txq_id = priv->stations[sta_id].tid[tid].agg.txq_id; | 385 | txq_id = il->stations[sta_id].tid[tid].agg.txq_id; |
386 | is_agg = true; | 386 | is_agg = true; |
387 | } | 387 | } |
388 | } | 388 | } |
389 | 389 | ||
390 | txq = &priv->txq[txq_id]; | 390 | txq = &il->txq[txq_id]; |
391 | q = &txq->q; | 391 | q = &txq->q; |
392 | 392 | ||
393 | if (unlikely(il_queue_space(q) < q->high_mark)) { | 393 | if (unlikely(il_queue_space(q) < q->high_mark)) { |
394 | spin_unlock(&priv->sta_lock); | 394 | spin_unlock(&il->sta_lock); |
395 | goto drop_unlock; | 395 | goto drop_unlock; |
396 | } | 396 | } |
397 | 397 | ||
398 | if (ieee80211_is_data_qos(fc)) { | 398 | if (ieee80211_is_data_qos(fc)) { |
399 | priv->stations[sta_id].tid[tid].tfds_in_queue++; | 399 | il->stations[sta_id].tid[tid].tfds_in_queue++; |
400 | if (!ieee80211_has_morefrags(fc)) | 400 | if (!ieee80211_has_morefrags(fc)) |
401 | priv->stations[sta_id].tid[tid].seq_number = seq_number; | 401 | il->stations[sta_id].tid[tid].seq_number = seq_number; |
402 | } | 402 | } |
403 | 403 | ||
404 | spin_unlock(&priv->sta_lock); | 404 | spin_unlock(&il->sta_lock); |
405 | 405 | ||
406 | /* Set up driver data for this TFD */ | 406 | /* Set up driver data for this TFD */ |
407 | memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct il_tx_info)); | 407 | 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) | |||
434 | tx_cmd->len = cpu_to_le16(len); | 434 | tx_cmd->len = cpu_to_le16(len); |
435 | 435 | ||
436 | if (info->control.hw_key) | 436 | if (info->control.hw_key) |
437 | il4965_tx_cmd_build_hwcrypto(priv, info, tx_cmd, skb, sta_id); | 437 | il4965_tx_cmd_build_hwcrypto(il, info, tx_cmd, skb, sta_id); |
438 | 438 | ||
439 | /* TODO need this for burst mode later on */ | 439 | /* TODO need this for burst mode later on */ |
440 | il4965_tx_cmd_build_basic(priv, skb, tx_cmd, info, hdr, sta_id); | 440 | il4965_tx_cmd_build_basic(il, skb, tx_cmd, info, hdr, sta_id); |
441 | il_dbg_log_tx_data_frame(priv, len, hdr); | 441 | il_dbg_log_tx_data_frame(il, len, hdr); |
442 | 442 | ||
443 | il4965_tx_cmd_build_rate(priv, tx_cmd, info, fc); | 443 | il4965_tx_cmd_build_rate(il, tx_cmd, info, fc); |
444 | 444 | ||
445 | il_update_stats(priv, true, fc, len); | 445 | il_update_stats(il, true, fc, len); |
446 | /* | 446 | /* |
447 | * Use the first empty entry in this queue's command buffer array | 447 | * Use the first empty entry in this queue's command buffer array |
448 | * to contain the Tx command and MAC header concatenated together | 448 | * to contain the Tx command and MAC header concatenated together |
@@ -462,14 +462,14 @@ int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) | |||
462 | 462 | ||
463 | /* Physical address of this Tx command's header (not MAC header!), | 463 | /* Physical address of this Tx command's header (not MAC header!), |
464 | * within command buffer array. */ | 464 | * within command buffer array. */ |
465 | txcmd_phys = pci_map_single(priv->pci_dev, | 465 | txcmd_phys = pci_map_single(il->pci_dev, |
466 | &out_cmd->hdr, firstlen, | 466 | &out_cmd->hdr, firstlen, |
467 | PCI_DMA_BIDIRECTIONAL); | 467 | PCI_DMA_BIDIRECTIONAL); |
468 | dma_unmap_addr_set(out_meta, mapping, txcmd_phys); | 468 | dma_unmap_addr_set(out_meta, mapping, txcmd_phys); |
469 | dma_unmap_len_set(out_meta, len, firstlen); | 469 | dma_unmap_len_set(out_meta, len, firstlen); |
470 | /* Add buffer containing Tx command and MAC(!) header to TFD's | 470 | /* Add buffer containing Tx command and MAC(!) header to TFD's |
471 | * first entry */ | 471 | * first entry */ |
472 | priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq, | 472 | il->cfg->ops->lib->txq_attach_buf_to_tfd(il, txq, |
473 | txcmd_phys, firstlen, 1, 0); | 473 | txcmd_phys, firstlen, 1, 0); |
474 | 474 | ||
475 | if (!ieee80211_has_morefrags(hdr->frame_control)) { | 475 | if (!ieee80211_has_morefrags(hdr->frame_control)) { |
@@ -483,9 +483,9 @@ int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) | |||
483 | * if any (802.11 null frames have no payload). */ | 483 | * if any (802.11 null frames have no payload). */ |
484 | secondlen = skb->len - hdr_len; | 484 | secondlen = skb->len - hdr_len; |
485 | if (secondlen > 0) { | 485 | if (secondlen > 0) { |
486 | phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len, | 486 | phys_addr = pci_map_single(il->pci_dev, skb->data + hdr_len, |
487 | secondlen, PCI_DMA_TODEVICE); | 487 | secondlen, PCI_DMA_TODEVICE); |
488 | priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq, | 488 | il->cfg->ops->lib->txq_attach_buf_to_tfd(il, txq, |
489 | phys_addr, secondlen, | 489 | phys_addr, secondlen, |
490 | 0, 0); | 490 | 0, 0); |
491 | } | 491 | } |
@@ -494,29 +494,29 @@ int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) | |||
494 | offsetof(struct il_tx_cmd, scratch); | 494 | offsetof(struct il_tx_cmd, scratch); |
495 | 495 | ||
496 | /* take back ownership of DMA buffer to enable update */ | 496 | /* take back ownership of DMA buffer to enable update */ |
497 | pci_dma_sync_single_for_cpu(priv->pci_dev, txcmd_phys, | 497 | pci_dma_sync_single_for_cpu(il->pci_dev, txcmd_phys, |
498 | firstlen, PCI_DMA_BIDIRECTIONAL); | 498 | firstlen, PCI_DMA_BIDIRECTIONAL); |
499 | tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys); | 499 | tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys); |
500 | tx_cmd->dram_msb_ptr = il_get_dma_hi_addr(scratch_phys); | 500 | tx_cmd->dram_msb_ptr = il_get_dma_hi_addr(scratch_phys); |
501 | 501 | ||
502 | IL_DEBUG_TX(priv, "sequence nr = 0X%x\n", | 502 | IL_DEBUG_TX(il, "sequence nr = 0X%x\n", |
503 | le16_to_cpu(out_cmd->hdr.sequence)); | 503 | le16_to_cpu(out_cmd->hdr.sequence)); |
504 | IL_DEBUG_TX(priv, "tx_flags = 0X%x\n", le32_to_cpu(tx_cmd->tx_flags)); | 504 | IL_DEBUG_TX(il, "tx_flags = 0X%x\n", le32_to_cpu(tx_cmd->tx_flags)); |
505 | il_print_hex_dump(priv, IL_DL_TX, (u8 *)tx_cmd, sizeof(*tx_cmd)); | 505 | il_print_hex_dump(il, IL_DL_TX, (u8 *)tx_cmd, sizeof(*tx_cmd)); |
506 | il_print_hex_dump(priv, IL_DL_TX, (u8 *)tx_cmd->hdr, hdr_len); | 506 | il_print_hex_dump(il, IL_DL_TX, (u8 *)tx_cmd->hdr, hdr_len); |
507 | 507 | ||
508 | /* Set up entry for this TFD in Tx byte-count array */ | 508 | /* Set up entry for this TFD in Tx byte-count array */ |
509 | if (info->flags & IEEE80211_TX_CTL_AMPDU) | 509 | if (info->flags & IEEE80211_TX_CTL_AMPDU) |
510 | priv->cfg->ops->lib->txq_update_byte_cnt_tbl(priv, txq, | 510 | il->cfg->ops->lib->txq_update_byte_cnt_tbl(il, txq, |
511 | le16_to_cpu(tx_cmd->len)); | 511 | le16_to_cpu(tx_cmd->len)); |
512 | 512 | ||
513 | pci_dma_sync_single_for_device(priv->pci_dev, txcmd_phys, | 513 | pci_dma_sync_single_for_device(il->pci_dev, txcmd_phys, |
514 | firstlen, PCI_DMA_BIDIRECTIONAL); | 514 | firstlen, PCI_DMA_BIDIRECTIONAL); |
515 | 515 | ||
516 | /* Tell device the write index *just past* this latest filled TFD */ | 516 | /* Tell device the write index *just past* this latest filled TFD */ |
517 | q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd); | 517 | q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd); |
518 | il_txq_update_write_ptr(priv, txq); | 518 | il_txq_update_write_ptr(il, txq); |
519 | spin_unlock_irqrestore(&priv->lock, flags); | 519 | spin_unlock_irqrestore(&il->lock, flags); |
520 | 520 | ||
521 | /* | 521 | /* |
522 | * At this point the frame is "transmitted" successfully | 522 | * At this point the frame is "transmitted" successfully |
@@ -536,28 +536,28 @@ int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb) | |||
536 | atomic_inc(&sta_priv->pending_frames); | 536 | atomic_inc(&sta_priv->pending_frames); |
537 | 537 | ||
538 | if ((il_queue_space(q) < q->high_mark) && | 538 | if ((il_queue_space(q) < q->high_mark) && |
539 | priv->mac80211_registered) { | 539 | il->mac80211_registered) { |
540 | if (wait_write_ptr) { | 540 | if (wait_write_ptr) { |
541 | spin_lock_irqsave(&priv->lock, flags); | 541 | spin_lock_irqsave(&il->lock, flags); |
542 | txq->need_update = 1; | 542 | txq->need_update = 1; |
543 | il_txq_update_write_ptr(priv, txq); | 543 | il_txq_update_write_ptr(il, txq); |
544 | spin_unlock_irqrestore(&priv->lock, flags); | 544 | spin_unlock_irqrestore(&il->lock, flags); |
545 | } else { | 545 | } else { |
546 | il_stop_queue(priv, txq); | 546 | il_stop_queue(il, txq); |
547 | } | 547 | } |
548 | } | 548 | } |
549 | 549 | ||
550 | return 0; | 550 | return 0; |
551 | 551 | ||
552 | drop_unlock: | 552 | drop_unlock: |
553 | spin_unlock_irqrestore(&priv->lock, flags); | 553 | spin_unlock_irqrestore(&il->lock, flags); |
554 | return -1; | 554 | return -1; |
555 | } | 555 | } |
556 | 556 | ||
557 | static inline int il4965_alloc_dma_ptr(struct il_priv *priv, | 557 | static inline int il4965_alloc_dma_ptr(struct il_priv *il, |
558 | struct il_dma_ptr *ptr, size_t size) | 558 | struct il_dma_ptr *ptr, size_t size) |
559 | { | 559 | { |
560 | ptr->addr = dma_alloc_coherent(&priv->pci_dev->dev, size, &ptr->dma, | 560 | ptr->addr = dma_alloc_coherent(&il->pci_dev->dev, size, &ptr->dma, |
561 | GFP_KERNEL); | 561 | GFP_KERNEL); |
562 | if (!ptr->addr) | 562 | if (!ptr->addr) |
563 | return -ENOMEM; | 563 | return -ENOMEM; |
@@ -565,13 +565,13 @@ static inline int il4965_alloc_dma_ptr(struct il_priv *priv, | |||
565 | return 0; | 565 | return 0; |
566 | } | 566 | } |
567 | 567 | ||
568 | static inline void il4965_free_dma_ptr(struct il_priv *priv, | 568 | static inline void il4965_free_dma_ptr(struct il_priv *il, |
569 | struct il_dma_ptr *ptr) | 569 | struct il_dma_ptr *ptr) |
570 | { | 570 | { |
571 | if (unlikely(!ptr->addr)) | 571 | if (unlikely(!ptr->addr)) |
572 | return; | 572 | return; |
573 | 573 | ||
574 | dma_free_coherent(&priv->pci_dev->dev, ptr->size, ptr->addr, ptr->dma); | 574 | dma_free_coherent(&il->pci_dev->dev, ptr->size, ptr->addr, ptr->dma); |
575 | memset(ptr, 0, sizeof(*ptr)); | 575 | memset(ptr, 0, sizeof(*ptr)); |
576 | } | 576 | } |
577 | 577 | ||
@@ -580,79 +580,79 @@ static inline void il4965_free_dma_ptr(struct il_priv *priv, | |||
580 | * | 580 | * |
581 | * Destroy all TX DMA queues and structures | 581 | * Destroy all TX DMA queues and structures |
582 | */ | 582 | */ |
583 | void il4965_hw_txq_ctx_free(struct il_priv *priv) | 583 | void il4965_hw_txq_ctx_free(struct il_priv *il) |
584 | { | 584 | { |
585 | int txq_id; | 585 | int txq_id; |
586 | 586 | ||
587 | /* Tx queues */ | 587 | /* Tx queues */ |
588 | if (priv->txq) { | 588 | if (il->txq) { |
589 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) | 589 | for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) |
590 | if (txq_id == priv->cmd_queue) | 590 | if (txq_id == il->cmd_queue) |
591 | il_cmd_queue_free(priv); | 591 | il_cmd_queue_free(il); |
592 | else | 592 | else |
593 | il_tx_queue_free(priv, txq_id); | 593 | il_tx_queue_free(il, txq_id); |
594 | } | 594 | } |
595 | il4965_free_dma_ptr(priv, &priv->kw); | 595 | il4965_free_dma_ptr(il, &il->kw); |
596 | 596 | ||
597 | il4965_free_dma_ptr(priv, &priv->scd_bc_tbls); | 597 | il4965_free_dma_ptr(il, &il->scd_bc_tbls); |
598 | 598 | ||
599 | /* free tx queue structure */ | 599 | /* free tx queue structure */ |
600 | il_txq_mem(priv); | 600 | il_txq_mem(il); |
601 | } | 601 | } |
602 | 602 | ||
603 | /** | 603 | /** |
604 | * il4965_txq_ctx_alloc - allocate TX queue context | 604 | * il4965_txq_ctx_alloc - allocate TX queue context |
605 | * Allocate all Tx DMA structures and initialize them | 605 | * Allocate all Tx DMA structures and initialize them |
606 | * | 606 | * |
607 | * @param priv | 607 | * @param il |
608 | * @return error code | 608 | * @return error code |
609 | */ | 609 | */ |
610 | int il4965_txq_ctx_alloc(struct il_priv *priv) | 610 | int il4965_txq_ctx_alloc(struct il_priv *il) |
611 | { | 611 | { |
612 | int ret; | 612 | int ret; |
613 | int txq_id, slots_num; | 613 | int txq_id, slots_num; |
614 | unsigned long flags; | 614 | unsigned long flags; |
615 | 615 | ||
616 | /* Free all tx/cmd queues and keep-warm buffer */ | 616 | /* Free all tx/cmd queues and keep-warm buffer */ |
617 | il4965_hw_txq_ctx_free(priv); | 617 | il4965_hw_txq_ctx_free(il); |
618 | 618 | ||
619 | ret = il4965_alloc_dma_ptr(priv, &priv->scd_bc_tbls, | 619 | ret = il4965_alloc_dma_ptr(il, &il->scd_bc_tbls, |
620 | priv->hw_params.scd_bc_tbls_size); | 620 | il->hw_params.scd_bc_tbls_size); |
621 | if (ret) { | 621 | if (ret) { |
622 | IL_ERR(priv, "Scheduler BC Table allocation failed\n"); | 622 | IL_ERR(il, "Scheduler BC Table allocation failed\n"); |
623 | goto error_bc_tbls; | 623 | goto error_bc_tbls; |
624 | } | 624 | } |
625 | /* Alloc keep-warm buffer */ | 625 | /* Alloc keep-warm buffer */ |
626 | ret = il4965_alloc_dma_ptr(priv, &priv->kw, IL_KW_SIZE); | 626 | ret = il4965_alloc_dma_ptr(il, &il->kw, IL_KW_SIZE); |
627 | if (ret) { | 627 | if (ret) { |
628 | IL_ERR(priv, "Keep Warm allocation failed\n"); | 628 | IL_ERR(il, "Keep Warm allocation failed\n"); |
629 | goto error_kw; | 629 | goto error_kw; |
630 | } | 630 | } |
631 | 631 | ||
632 | /* allocate tx queue structure */ | 632 | /* allocate tx queue structure */ |
633 | ret = il_alloc_txq_mem(priv); | 633 | ret = il_alloc_txq_mem(il); |
634 | if (ret) | 634 | if (ret) |
635 | goto error; | 635 | goto error; |
636 | 636 | ||
637 | spin_lock_irqsave(&priv->lock, flags); | 637 | spin_lock_irqsave(&il->lock, flags); |
638 | 638 | ||
639 | /* Turn off all Tx DMA fifos */ | 639 | /* Turn off all Tx DMA fifos */ |
640 | il4965_txq_set_sched(priv, 0); | 640 | il4965_txq_set_sched(il, 0); |
641 | 641 | ||
642 | /* Tell NIC where to find the "keep warm" buffer */ | 642 | /* Tell NIC where to find the "keep warm" buffer */ |
643 | il_write_direct32(priv, FH_KW_MEM_ADDR_REG, priv->kw.dma >> 4); | 643 | il_write_direct32(il, FH_KW_MEM_ADDR_REG, il->kw.dma >> 4); |
644 | 644 | ||
645 | spin_unlock_irqrestore(&priv->lock, flags); | 645 | spin_unlock_irqrestore(&il->lock, flags); |
646 | 646 | ||
647 | /* Alloc and init all Tx queues, including the command queue (#4/#9) */ | 647 | /* Alloc and init all Tx queues, including the command queue (#4/#9) */ |
648 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { | 648 | for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) { |
649 | slots_num = (txq_id == priv->cmd_queue) ? | 649 | slots_num = (txq_id == il->cmd_queue) ? |
650 | TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; | 650 | TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; |
651 | ret = il_tx_queue_init(priv, | 651 | ret = il_tx_queue_init(il, |
652 | &priv->txq[txq_id], slots_num, | 652 | &il->txq[txq_id], slots_num, |
653 | txq_id); | 653 | txq_id); |
654 | if (ret) { | 654 | if (ret) { |
655 | IL_ERR(priv, "Tx %d queue init failed\n", txq_id); | 655 | IL_ERR(il, "Tx %d queue init failed\n", txq_id); |
656 | goto error; | 656 | goto error; |
657 | } | 657 | } |
658 | } | 658 | } |
@@ -660,34 +660,34 @@ int il4965_txq_ctx_alloc(struct il_priv *priv) | |||
660 | return ret; | 660 | return ret; |
661 | 661 | ||
662 | error: | 662 | error: |
663 | il4965_hw_txq_ctx_free(priv); | 663 | il4965_hw_txq_ctx_free(il); |
664 | il4965_free_dma_ptr(priv, &priv->kw); | 664 | il4965_free_dma_ptr(il, &il->kw); |
665 | error_kw: | 665 | error_kw: |
666 | il4965_free_dma_ptr(priv, &priv->scd_bc_tbls); | 666 | il4965_free_dma_ptr(il, &il->scd_bc_tbls); |
667 | error_bc_tbls: | 667 | error_bc_tbls: |
668 | return ret; | 668 | return ret; |
669 | } | 669 | } |
670 | 670 | ||
671 | void il4965_txq_ctx_reset(struct il_priv *priv) | 671 | void il4965_txq_ctx_reset(struct il_priv *il) |
672 | { | 672 | { |
673 | int txq_id, slots_num; | 673 | int txq_id, slots_num; |
674 | unsigned long flags; | 674 | unsigned long flags; |
675 | 675 | ||
676 | spin_lock_irqsave(&priv->lock, flags); | 676 | spin_lock_irqsave(&il->lock, flags); |
677 | 677 | ||
678 | /* Turn off all Tx DMA fifos */ | 678 | /* Turn off all Tx DMA fifos */ |
679 | il4965_txq_set_sched(priv, 0); | 679 | il4965_txq_set_sched(il, 0); |
680 | 680 | ||
681 | /* Tell NIC where to find the "keep warm" buffer */ | 681 | /* Tell NIC where to find the "keep warm" buffer */ |
682 | il_write_direct32(priv, FH_KW_MEM_ADDR_REG, priv->kw.dma >> 4); | 682 | il_write_direct32(il, FH_KW_MEM_ADDR_REG, il->kw.dma >> 4); |
683 | 683 | ||
684 | spin_unlock_irqrestore(&priv->lock, flags); | 684 | spin_unlock_irqrestore(&il->lock, flags); |
685 | 685 | ||
686 | /* Alloc and init all Tx queues, including the command queue (#4) */ | 686 | /* Alloc and init all Tx queues, including the command queue (#4) */ |
687 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) { | 687 | for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) { |
688 | slots_num = txq_id == priv->cmd_queue ? | 688 | slots_num = txq_id == il->cmd_queue ? |
689 | TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; | 689 | TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; |
690 | il_tx_queue_reset(priv, &priv->txq[txq_id], | 690 | il_tx_queue_reset(il, &il->txq[txq_id], |
691 | slots_num, txq_id); | 691 | slots_num, txq_id); |
692 | } | 692 | } |
693 | } | 693 | } |
@@ -695,39 +695,39 @@ void il4965_txq_ctx_reset(struct il_priv *priv) | |||
695 | /** | 695 | /** |
696 | * il4965_txq_ctx_stop - Stop all Tx DMA channels | 696 | * il4965_txq_ctx_stop - Stop all Tx DMA channels |
697 | */ | 697 | */ |
698 | void il4965_txq_ctx_stop(struct il_priv *priv) | 698 | void il4965_txq_ctx_stop(struct il_priv *il) |
699 | { | 699 | { |
700 | int ch, txq_id; | 700 | int ch, txq_id; |
701 | unsigned long flags; | 701 | unsigned long flags; |
702 | 702 | ||
703 | /* Turn off all Tx DMA fifos */ | 703 | /* Turn off all Tx DMA fifos */ |
704 | spin_lock_irqsave(&priv->lock, flags); | 704 | spin_lock_irqsave(&il->lock, flags); |
705 | 705 | ||
706 | il4965_txq_set_sched(priv, 0); | 706 | il4965_txq_set_sched(il, 0); |
707 | 707 | ||
708 | /* Stop each Tx DMA channel, and wait for it to be idle */ | 708 | /* Stop each Tx DMA channel, and wait for it to be idle */ |
709 | for (ch = 0; ch < priv->hw_params.dma_chnl_num; ch++) { | 709 | for (ch = 0; ch < il->hw_params.dma_chnl_num; ch++) { |
710 | il_write_direct32(priv, | 710 | il_write_direct32(il, |
711 | FH_TCSR_CHNL_TX_CONFIG_REG(ch), 0x0); | 711 | FH_TCSR_CHNL_TX_CONFIG_REG(ch), 0x0); |
712 | if (il_poll_direct_bit(priv, FH_TSSR_TX_STATUS_REG, | 712 | if (il_poll_direct_bit(il, FH_TSSR_TX_STATUS_REG, |
713 | FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(ch), | 713 | FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(ch), |
714 | 1000)) | 714 | 1000)) |
715 | IL_ERR(priv, "Failing on timeout while stopping" | 715 | IL_ERR(il, "Failing on timeout while stopping" |
716 | " DMA channel %d [0x%08x]", ch, | 716 | " DMA channel %d [0x%08x]", ch, |
717 | il_read_direct32(priv, | 717 | il_read_direct32(il, |
718 | FH_TSSR_TX_STATUS_REG)); | 718 | FH_TSSR_TX_STATUS_REG)); |
719 | } | 719 | } |
720 | spin_unlock_irqrestore(&priv->lock, flags); | 720 | spin_unlock_irqrestore(&il->lock, flags); |
721 | 721 | ||
722 | if (!priv->txq) | 722 | if (!il->txq) |
723 | return; | 723 | return; |
724 | 724 | ||
725 | /* Unmap DMA from host system and free skb's */ | 725 | /* Unmap DMA from host system and free skb's */ |
726 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) | 726 | for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) |
727 | if (txq_id == priv->cmd_queue) | 727 | if (txq_id == il->cmd_queue) |
728 | il_cmd_queue_unmap(priv); | 728 | il_cmd_queue_unmap(il); |
729 | else | 729 | else |
730 | il_tx_queue_unmap(priv, txq_id); | 730 | il_tx_queue_unmap(il, txq_id); |
731 | } | 731 | } |
732 | 732 | ||
733 | /* | 733 | /* |
@@ -736,12 +736,12 @@ void il4965_txq_ctx_stop(struct il_priv *priv) | |||
736 | * Should never return anything < 7, because they should already | 736 | * Should never return anything < 7, because they should already |
737 | * be in use as EDCA AC (0-3), Command (4), reserved (5, 6) | 737 | * be in use as EDCA AC (0-3), Command (4), reserved (5, 6) |
738 | */ | 738 | */ |
739 | static int il4965_txq_ctx_activate_free(struct il_priv *priv) | 739 | static int il4965_txq_ctx_activate_free(struct il_priv *il) |
740 | { | 740 | { |
741 | int txq_id; | 741 | int txq_id; |
742 | 742 | ||
743 | for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) | 743 | for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) |
744 | if (!test_and_set_bit(txq_id, &priv->txq_ctx_active_msk)) | 744 | if (!test_and_set_bit(txq_id, &il->txq_ctx_active_msk)) |
745 | return txq_id; | 745 | return txq_id; |
746 | return -1; | 746 | return -1; |
747 | } | 747 | } |
@@ -749,12 +749,12 @@ static int il4965_txq_ctx_activate_free(struct il_priv *priv) | |||
749 | /** | 749 | /** |
750 | * il4965_tx_queue_stop_scheduler - Stop queue, but keep configuration | 750 | * il4965_tx_queue_stop_scheduler - Stop queue, but keep configuration |
751 | */ | 751 | */ |
752 | static void il4965_tx_queue_stop_scheduler(struct il_priv *priv, | 752 | static void il4965_tx_queue_stop_scheduler(struct il_priv *il, |
753 | u16 txq_id) | 753 | u16 txq_id) |
754 | { | 754 | { |
755 | /* Simply stop the queue, but don't change any configuration; | 755 | /* Simply stop the queue, but don't change any configuration; |
756 | * the SCD_ACT_EN bit is the write-enable mask for the ACTIVE bit. */ | 756 | * the SCD_ACT_EN bit is the write-enable mask for the ACTIVE bit. */ |
757 | il_write_prph(priv, | 757 | il_write_prph(il, |
758 | IWL49_SCD_QUEUE_STATUS_BITS(txq_id), | 758 | IWL49_SCD_QUEUE_STATUS_BITS(txq_id), |
759 | (0 << IWL49_SCD_QUEUE_STTS_REG_POS_ACTIVE)| | 759 | (0 << IWL49_SCD_QUEUE_STTS_REG_POS_ACTIVE)| |
760 | (1 << IWL49_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN)); | 760 | (1 << IWL49_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN)); |
@@ -763,7 +763,7 @@ static void il4965_tx_queue_stop_scheduler(struct il_priv *priv, | |||
763 | /** | 763 | /** |
764 | * il4965_tx_queue_set_q2ratid - Map unique receiver/tid combination to a queue | 764 | * il4965_tx_queue_set_q2ratid - Map unique receiver/tid combination to a queue |
765 | */ | 765 | */ |
766 | static int il4965_tx_queue_set_q2ratid(struct il_priv *priv, u16 ra_tid, | 766 | static int il4965_tx_queue_set_q2ratid(struct il_priv *il, u16 ra_tid, |
767 | u16 txq_id) | 767 | u16 txq_id) |
768 | { | 768 | { |
769 | u32 tbl_dw_addr; | 769 | u32 tbl_dw_addr; |
@@ -772,17 +772,17 @@ static int il4965_tx_queue_set_q2ratid(struct il_priv *priv, u16 ra_tid, | |||
772 | 772 | ||
773 | scd_q2ratid = ra_tid & IL_SCD_QUEUE_RA_TID_MAP_RATID_MSK; | 773 | scd_q2ratid = ra_tid & IL_SCD_QUEUE_RA_TID_MAP_RATID_MSK; |
774 | 774 | ||
775 | tbl_dw_addr = priv->scd_base_addr + | 775 | tbl_dw_addr = il->scd_base_addr + |
776 | IWL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(txq_id); | 776 | IWL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(txq_id); |
777 | 777 | ||
778 | tbl_dw = il_read_targ_mem(priv, tbl_dw_addr); | 778 | tbl_dw = il_read_targ_mem(il, tbl_dw_addr); |
779 | 779 | ||
780 | if (txq_id & 0x1) | 780 | if (txq_id & 0x1) |
781 | tbl_dw = (scd_q2ratid << 16) | (tbl_dw & 0x0000FFFF); | 781 | tbl_dw = (scd_q2ratid << 16) | (tbl_dw & 0x0000FFFF); |
782 | else | 782 | else |
783 | tbl_dw = scd_q2ratid | (tbl_dw & 0xFFFF0000); | 783 | tbl_dw = scd_q2ratid | (tbl_dw & 0xFFFF0000); |
784 | 784 | ||
785 | il_write_targ_mem(priv, tbl_dw_addr, tbl_dw); | 785 | il_write_targ_mem(il, tbl_dw_addr, tbl_dw); |
786 | 786 | ||
787 | return 0; | 787 | return 0; |
788 | } | 788 | } |
@@ -793,7 +793,7 @@ static int il4965_tx_queue_set_q2ratid(struct il_priv *priv, u16 ra_tid, | |||
793 | * NOTE: txq_id must be greater than IWL49_FIRST_AMPDU_QUEUE, | 793 | * NOTE: txq_id must be greater than IWL49_FIRST_AMPDU_QUEUE, |
794 | * i.e. it must be one of the higher queues used for aggregation | 794 | * i.e. it must be one of the higher queues used for aggregation |
795 | */ | 795 | */ |
796 | static int il4965_txq_agg_enable(struct il_priv *priv, int txq_id, | 796 | static int il4965_txq_agg_enable(struct il_priv *il, int txq_id, |
797 | int tx_fifo, int sta_id, int tid, u16 ssn_idx) | 797 | int tx_fifo, int sta_id, int tid, u16 ssn_idx) |
798 | { | 798 | { |
799 | unsigned long flags; | 799 | unsigned long flags; |
@@ -802,62 +802,62 @@ static int il4965_txq_agg_enable(struct il_priv *priv, int txq_id, | |||
802 | 802 | ||
803 | if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) || | 803 | if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) || |
804 | (IWL49_FIRST_AMPDU_QUEUE + | 804 | (IWL49_FIRST_AMPDU_QUEUE + |
805 | priv->cfg->base_params->num_of_ampdu_queues <= txq_id)) { | 805 | il->cfg->base_params->num_of_ampdu_queues <= txq_id)) { |
806 | IL_WARN(priv, | 806 | IL_WARN(il, |
807 | "queue number out of range: %d, must be %d to %d\n", | 807 | "queue number out of range: %d, must be %d to %d\n", |
808 | txq_id, IWL49_FIRST_AMPDU_QUEUE, | 808 | txq_id, IWL49_FIRST_AMPDU_QUEUE, |
809 | IWL49_FIRST_AMPDU_QUEUE + | 809 | IWL49_FIRST_AMPDU_QUEUE + |
810 | priv->cfg->base_params->num_of_ampdu_queues - 1); | 810 | il->cfg->base_params->num_of_ampdu_queues - 1); |
811 | return -EINVAL; | 811 | return -EINVAL; |
812 | } | 812 | } |
813 | 813 | ||
814 | ra_tid = BUILD_RAxTID(sta_id, tid); | 814 | ra_tid = BUILD_RAxTID(sta_id, tid); |
815 | 815 | ||
816 | /* Modify device's station table to Tx this TID */ | 816 | /* Modify device's station table to Tx this TID */ |
817 | ret = il4965_sta_tx_modify_enable_tid(priv, sta_id, tid); | 817 | ret = il4965_sta_tx_modify_enable_tid(il, sta_id, tid); |
818 | if (ret) | 818 | if (ret) |
819 | return ret; | 819 | return ret; |
820 | 820 | ||
821 | spin_lock_irqsave(&priv->lock, flags); | 821 | spin_lock_irqsave(&il->lock, flags); |
822 | 822 | ||
823 | /* Stop this Tx queue before configuring it */ | 823 | /* Stop this Tx queue before configuring it */ |
824 | il4965_tx_queue_stop_scheduler(priv, txq_id); | 824 | il4965_tx_queue_stop_scheduler(il, txq_id); |
825 | 825 | ||
826 | /* Map receiver-address / traffic-ID to this queue */ | 826 | /* Map receiver-address / traffic-ID to this queue */ |
827 | il4965_tx_queue_set_q2ratid(priv, ra_tid, txq_id); | 827 | il4965_tx_queue_set_q2ratid(il, ra_tid, txq_id); |
828 | 828 | ||
829 | /* Set this queue as a chain-building queue */ | 829 | /* Set this queue as a chain-building queue */ |
830 | il_set_bits_prph(priv, IWL49_SCD_QUEUECHAIN_SEL, (1 << txq_id)); | 830 | il_set_bits_prph(il, IWL49_SCD_QUEUECHAIN_SEL, (1 << txq_id)); |
831 | 831 | ||
832 | /* Place first TFD at index corresponding to start sequence number. | 832 | /* Place first TFD at index corresponding to start sequence number. |
833 | * Assumes that ssn_idx is valid (!= 0xFFF) */ | 833 | * Assumes that ssn_idx is valid (!= 0xFFF) */ |
834 | priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); | 834 | il->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); |
835 | priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); | 835 | il->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); |
836 | il4965_set_wr_ptrs(priv, txq_id, ssn_idx); | 836 | il4965_set_wr_ptrs(il, txq_id, ssn_idx); |
837 | 837 | ||
838 | /* Set up Tx window size and frame limit for this queue */ | 838 | /* Set up Tx window size and frame limit for this queue */ |
839 | il_write_targ_mem(priv, | 839 | il_write_targ_mem(il, |
840 | priv->scd_base_addr + IWL49_SCD_CONTEXT_QUEUE_OFFSET(txq_id), | 840 | il->scd_base_addr + IWL49_SCD_CONTEXT_QUEUE_OFFSET(txq_id), |
841 | (SCD_WIN_SIZE << IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & | 841 | (SCD_WIN_SIZE << IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & |
842 | IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK); | 842 | IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK); |
843 | 843 | ||
844 | il_write_targ_mem(priv, priv->scd_base_addr + | 844 | il_write_targ_mem(il, il->scd_base_addr + |
845 | IWL49_SCD_CONTEXT_QUEUE_OFFSET(txq_id) + sizeof(u32), | 845 | IWL49_SCD_CONTEXT_QUEUE_OFFSET(txq_id) + sizeof(u32), |
846 | (SCD_FRAME_LIMIT << IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) | 846 | (SCD_FRAME_LIMIT << IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) |
847 | & IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); | 847 | & IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); |
848 | 848 | ||
849 | il_set_bits_prph(priv, IWL49_SCD_INTERRUPT_MASK, (1 << txq_id)); | 849 | il_set_bits_prph(il, IWL49_SCD_INTERRUPT_MASK, (1 << txq_id)); |
850 | 850 | ||
851 | /* Set up Status area in SRAM, map to Tx DMA/FIFO, activate the queue */ | 851 | /* Set up Status area in SRAM, map to Tx DMA/FIFO, activate the queue */ |
852 | il4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 1); | 852 | il4965_tx_queue_set_status(il, &il->txq[txq_id], tx_fifo, 1); |
853 | 853 | ||
854 | spin_unlock_irqrestore(&priv->lock, flags); | 854 | spin_unlock_irqrestore(&il->lock, flags); |
855 | 855 | ||
856 | return 0; | 856 | return 0; |
857 | } | 857 | } |
858 | 858 | ||
859 | 859 | ||
860 | int il4965_tx_agg_start(struct il_priv *priv, struct ieee80211_vif *vif, | 860 | int il4965_tx_agg_start(struct il_priv *il, struct ieee80211_vif *vif, |
861 | struct ieee80211_sta *sta, u16 tid, u16 *ssn) | 861 | struct ieee80211_sta *sta, u16 tid, u16 *ssn) |
862 | { | 862 | { |
863 | int sta_id; | 863 | int sta_id; |
@@ -871,94 +871,94 @@ int il4965_tx_agg_start(struct il_priv *priv, struct ieee80211_vif *vif, | |||
871 | if (unlikely(tx_fifo < 0)) | 871 | if (unlikely(tx_fifo < 0)) |
872 | return tx_fifo; | 872 | return tx_fifo; |
873 | 873 | ||
874 | IL_WARN(priv, "%s on ra = %pM tid = %d\n", | 874 | IL_WARN(il, "%s on ra = %pM tid = %d\n", |
875 | __func__, sta->addr, tid); | 875 | __func__, sta->addr, tid); |
876 | 876 | ||
877 | sta_id = il_sta_id(sta); | 877 | sta_id = il_sta_id(sta); |
878 | if (sta_id == IL_INVALID_STATION) { | 878 | if (sta_id == IL_INVALID_STATION) { |
879 | IL_ERR(priv, "Start AGG on invalid station\n"); | 879 | IL_ERR(il, "Start AGG on invalid station\n"); |
880 | return -ENXIO; | 880 | return -ENXIO; |
881 | } | 881 | } |
882 | if (unlikely(tid >= MAX_TID_COUNT)) | 882 | if (unlikely(tid >= MAX_TID_COUNT)) |
883 | return -EINVAL; | 883 | return -EINVAL; |
884 | 884 | ||
885 | if (priv->stations[sta_id].tid[tid].agg.state != IL_AGG_OFF) { | 885 | if (il->stations[sta_id].tid[tid].agg.state != IL_AGG_OFF) { |
886 | IL_ERR(priv, "Start AGG when state is not IL_AGG_OFF !\n"); | 886 | IL_ERR(il, "Start AGG when state is not IL_AGG_OFF !\n"); |
887 | return -ENXIO; | 887 | return -ENXIO; |
888 | } | 888 | } |
889 | 889 | ||
890 | txq_id = il4965_txq_ctx_activate_free(priv); | 890 | txq_id = il4965_txq_ctx_activate_free(il); |
891 | if (txq_id == -1) { | 891 | if (txq_id == -1) { |
892 | IL_ERR(priv, "No free aggregation queue available\n"); | 892 | IL_ERR(il, "No free aggregation queue available\n"); |
893 | return -ENXIO; | 893 | return -ENXIO; |
894 | } | 894 | } |
895 | 895 | ||
896 | spin_lock_irqsave(&priv->sta_lock, flags); | 896 | spin_lock_irqsave(&il->sta_lock, flags); |
897 | tid_data = &priv->stations[sta_id].tid[tid]; | 897 | tid_data = &il->stations[sta_id].tid[tid]; |
898 | *ssn = SEQ_TO_SN(tid_data->seq_number); | 898 | *ssn = SEQ_TO_SN(tid_data->seq_number); |
899 | tid_data->agg.txq_id = txq_id; | 899 | tid_data->agg.txq_id = txq_id; |
900 | il_set_swq_id(&priv->txq[txq_id], | 900 | il_set_swq_id(&il->txq[txq_id], |
901 | il4965_get_ac_from_tid(tid), txq_id); | 901 | il4965_get_ac_from_tid(tid), txq_id); |
902 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 902 | spin_unlock_irqrestore(&il->sta_lock, flags); |
903 | 903 | ||
904 | ret = il4965_txq_agg_enable(priv, txq_id, tx_fifo, | 904 | ret = il4965_txq_agg_enable(il, txq_id, tx_fifo, |
905 | sta_id, tid, *ssn); | 905 | sta_id, tid, *ssn); |
906 | if (ret) | 906 | if (ret) |
907 | return ret; | 907 | return ret; |
908 | 908 | ||
909 | spin_lock_irqsave(&priv->sta_lock, flags); | 909 | spin_lock_irqsave(&il->sta_lock, flags); |
910 | tid_data = &priv->stations[sta_id].tid[tid]; | 910 | tid_data = &il->stations[sta_id].tid[tid]; |
911 | if (tid_data->tfds_in_queue == 0) { | 911 | if (tid_data->tfds_in_queue == 0) { |
912 | IL_DEBUG_HT(priv, "HW queue is empty\n"); | 912 | IL_DEBUG_HT(il, "HW queue is empty\n"); |
913 | tid_data->agg.state = IL_AGG_ON; | 913 | tid_data->agg.state = IL_AGG_ON; |
914 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); | 914 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
915 | } else { | 915 | } else { |
916 | IL_DEBUG_HT(priv, | 916 | IL_DEBUG_HT(il, |
917 | "HW queue is NOT empty: %d packets in HW queue\n", | 917 | "HW queue is NOT empty: %d packets in HW queue\n", |
918 | tid_data->tfds_in_queue); | 918 | tid_data->tfds_in_queue); |
919 | tid_data->agg.state = IL_EMPTYING_HW_QUEUE_ADDBA; | 919 | tid_data->agg.state = IL_EMPTYING_HW_QUEUE_ADDBA; |
920 | } | 920 | } |
921 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 921 | spin_unlock_irqrestore(&il->sta_lock, flags); |
922 | return ret; | 922 | return ret; |
923 | } | 923 | } |
924 | 924 | ||
925 | /** | 925 | /** |
926 | * txq_id must be greater than IWL49_FIRST_AMPDU_QUEUE | 926 | * txq_id must be greater than IWL49_FIRST_AMPDU_QUEUE |
927 | * priv->lock must be held by the caller | 927 | * il->lock must be held by the caller |
928 | */ | 928 | */ |
929 | static int il4965_txq_agg_disable(struct il_priv *priv, u16 txq_id, | 929 | static int il4965_txq_agg_disable(struct il_priv *il, u16 txq_id, |
930 | u16 ssn_idx, u8 tx_fifo) | 930 | u16 ssn_idx, u8 tx_fifo) |
931 | { | 931 | { |
932 | if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) || | 932 | if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) || |
933 | (IWL49_FIRST_AMPDU_QUEUE + | 933 | (IWL49_FIRST_AMPDU_QUEUE + |
934 | priv->cfg->base_params->num_of_ampdu_queues <= txq_id)) { | 934 | il->cfg->base_params->num_of_ampdu_queues <= txq_id)) { |
935 | IL_WARN(priv, | 935 | IL_WARN(il, |
936 | "queue number out of range: %d, must be %d to %d\n", | 936 | "queue number out of range: %d, must be %d to %d\n", |
937 | txq_id, IWL49_FIRST_AMPDU_QUEUE, | 937 | txq_id, IWL49_FIRST_AMPDU_QUEUE, |
938 | IWL49_FIRST_AMPDU_QUEUE + | 938 | IWL49_FIRST_AMPDU_QUEUE + |
939 | priv->cfg->base_params->num_of_ampdu_queues - 1); | 939 | il->cfg->base_params->num_of_ampdu_queues - 1); |
940 | return -EINVAL; | 940 | return -EINVAL; |
941 | } | 941 | } |
942 | 942 | ||
943 | il4965_tx_queue_stop_scheduler(priv, txq_id); | 943 | il4965_tx_queue_stop_scheduler(il, txq_id); |
944 | 944 | ||
945 | il_clear_bits_prph(priv, | 945 | il_clear_bits_prph(il, |
946 | IWL49_SCD_QUEUECHAIN_SEL, (1 << txq_id)); | 946 | IWL49_SCD_QUEUECHAIN_SEL, (1 << txq_id)); |
947 | 947 | ||
948 | priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); | 948 | il->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); |
949 | priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); | 949 | il->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); |
950 | /* supposes that ssn_idx is valid (!= 0xFFF) */ | 950 | /* supposes that ssn_idx is valid (!= 0xFFF) */ |
951 | il4965_set_wr_ptrs(priv, txq_id, ssn_idx); | 951 | il4965_set_wr_ptrs(il, txq_id, ssn_idx); |
952 | 952 | ||
953 | il_clear_bits_prph(priv, | 953 | il_clear_bits_prph(il, |
954 | IWL49_SCD_INTERRUPT_MASK, (1 << txq_id)); | 954 | IWL49_SCD_INTERRUPT_MASK, (1 << txq_id)); |
955 | il_txq_ctx_deactivate(priv, txq_id); | 955 | il_txq_ctx_deactivate(il, txq_id); |
956 | il4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 0); | 956 | il4965_tx_queue_set_status(il, &il->txq[txq_id], tx_fifo, 0); |
957 | 957 | ||
958 | return 0; | 958 | return 0; |
959 | } | 959 | } |
960 | 960 | ||
961 | int il4965_tx_agg_stop(struct il_priv *priv, struct ieee80211_vif *vif, | 961 | int il4965_tx_agg_stop(struct il_priv *il, struct ieee80211_vif *vif, |
962 | struct ieee80211_sta *sta, u16 tid) | 962 | struct ieee80211_sta *sta, u16 tid) |
963 | { | 963 | { |
964 | int tx_fifo_id, txq_id, sta_id, ssn; | 964 | int tx_fifo_id, txq_id, sta_id, ssn; |
@@ -973,17 +973,17 @@ int il4965_tx_agg_stop(struct il_priv *priv, struct ieee80211_vif *vif, | |||
973 | sta_id = il_sta_id(sta); | 973 | sta_id = il_sta_id(sta); |
974 | 974 | ||
975 | if (sta_id == IL_INVALID_STATION) { | 975 | if (sta_id == IL_INVALID_STATION) { |
976 | IL_ERR(priv, "Invalid station for AGG tid %d\n", tid); | 976 | IL_ERR(il, "Invalid station for AGG tid %d\n", tid); |
977 | return -ENXIO; | 977 | return -ENXIO; |
978 | } | 978 | } |
979 | 979 | ||
980 | spin_lock_irqsave(&priv->sta_lock, flags); | 980 | spin_lock_irqsave(&il->sta_lock, flags); |
981 | 981 | ||
982 | tid_data = &priv->stations[sta_id].tid[tid]; | 982 | tid_data = &il->stations[sta_id].tid[tid]; |
983 | ssn = (tid_data->seq_number & IEEE80211_SCTL_SEQ) >> 4; | 983 | ssn = (tid_data->seq_number & IEEE80211_SCTL_SEQ) >> 4; |
984 | txq_id = tid_data->agg.txq_id; | 984 | txq_id = tid_data->agg.txq_id; |
985 | 985 | ||
986 | switch (priv->stations[sta_id].tid[tid].agg.state) { | 986 | switch (il->stations[sta_id].tid[tid].agg.state) { |
987 | case IL_EMPTYING_HW_QUEUE_ADDBA: | 987 | case IL_EMPTYING_HW_QUEUE_ADDBA: |
988 | /* | 988 | /* |
989 | * This can happen if the peer stops aggregation | 989 | * This can happen if the peer stops aggregation |
@@ -991,33 +991,33 @@ int il4965_tx_agg_stop(struct il_priv *priv, struct ieee80211_vif *vif, | |||
991 | * queue we selected previously, i.e. before the | 991 | * queue we selected previously, i.e. before the |
992 | * session was really started completely. | 992 | * session was really started completely. |
993 | */ | 993 | */ |
994 | IL_DEBUG_HT(priv, "AGG stop before setup done\n"); | 994 | IL_DEBUG_HT(il, "AGG stop before setup done\n"); |
995 | goto turn_off; | 995 | goto turn_off; |
996 | case IL_AGG_ON: | 996 | case IL_AGG_ON: |
997 | break; | 997 | break; |
998 | default: | 998 | default: |
999 | IL_WARN(priv, "Stopping AGG while state not ON or starting\n"); | 999 | IL_WARN(il, "Stopping AGG while state not ON or starting\n"); |
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | write_ptr = priv->txq[txq_id].q.write_ptr; | 1002 | write_ptr = il->txq[txq_id].q.write_ptr; |
1003 | read_ptr = priv->txq[txq_id].q.read_ptr; | 1003 | read_ptr = il->txq[txq_id].q.read_ptr; |
1004 | 1004 | ||
1005 | /* The queue is not empty */ | 1005 | /* The queue is not empty */ |
1006 | if (write_ptr != read_ptr) { | 1006 | if (write_ptr != read_ptr) { |
1007 | IL_DEBUG_HT(priv, "Stopping a non empty AGG HW QUEUE\n"); | 1007 | IL_DEBUG_HT(il, "Stopping a non empty AGG HW QUEUE\n"); |
1008 | priv->stations[sta_id].tid[tid].agg.state = | 1008 | il->stations[sta_id].tid[tid].agg.state = |
1009 | IL_EMPTYING_HW_QUEUE_DELBA; | 1009 | IL_EMPTYING_HW_QUEUE_DELBA; |
1010 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 1010 | spin_unlock_irqrestore(&il->sta_lock, flags); |
1011 | return 0; | 1011 | return 0; |
1012 | } | 1012 | } |
1013 | 1013 | ||
1014 | IL_DEBUG_HT(priv, "HW queue is empty\n"); | 1014 | IL_DEBUG_HT(il, "HW queue is empty\n"); |
1015 | turn_off: | 1015 | turn_off: |
1016 | priv->stations[sta_id].tid[tid].agg.state = IL_AGG_OFF; | 1016 | il->stations[sta_id].tid[tid].agg.state = IL_AGG_OFF; |
1017 | 1017 | ||
1018 | /* do not restore/save irqs */ | 1018 | /* do not restore/save irqs */ |
1019 | spin_unlock(&priv->sta_lock); | 1019 | spin_unlock(&il->sta_lock); |
1020 | spin_lock(&priv->lock); | 1020 | spin_lock(&il->lock); |
1021 | 1021 | ||
1022 | /* | 1022 | /* |
1023 | * the only reason this call can fail is queue number out of range, | 1023 | * 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, | |||
1026 | * to deactivate the uCode queue, just return "success" to allow | 1026 | * to deactivate the uCode queue, just return "success" to allow |
1027 | * mac80211 to clean up it own data. | 1027 | * mac80211 to clean up it own data. |
1028 | */ | 1028 | */ |
1029 | il4965_txq_agg_disable(priv, txq_id, ssn, tx_fifo_id); | 1029 | il4965_txq_agg_disable(il, txq_id, ssn, tx_fifo_id); |
1030 | spin_unlock_irqrestore(&priv->lock, flags); | 1030 | spin_unlock_irqrestore(&il->lock, flags); |
1031 | 1031 | ||
1032 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); | 1032 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
1033 | 1033 | ||
1034 | return 0; | 1034 | return 0; |
1035 | } | 1035 | } |
1036 | 1036 | ||
1037 | int il4965_txq_check_empty(struct il_priv *priv, | 1037 | int il4965_txq_check_empty(struct il_priv *il, |
1038 | int sta_id, u8 tid, int txq_id) | 1038 | int sta_id, u8 tid, int txq_id) |
1039 | { | 1039 | { |
1040 | struct il_queue *q = &priv->txq[txq_id].q; | 1040 | struct il_queue *q = &il->txq[txq_id].q; |
1041 | u8 *addr = priv->stations[sta_id].sta.sta.addr; | 1041 | u8 *addr = il->stations[sta_id].sta.sta.addr; |
1042 | struct il_tid_data *tid_data = &priv->stations[sta_id].tid[tid]; | 1042 | struct il_tid_data *tid_data = &il->stations[sta_id].tid[tid]; |
1043 | struct il_rxon_context *ctx; | 1043 | struct il_rxon_context *ctx; |
1044 | 1044 | ||
1045 | ctx = &priv->contexts[priv->stations[sta_id].ctxid]; | 1045 | ctx = &il->contexts[il->stations[sta_id].ctxid]; |
1046 | 1046 | ||
1047 | lockdep_assert_held(&priv->sta_lock); | 1047 | lockdep_assert_held(&il->sta_lock); |
1048 | 1048 | ||
1049 | switch (priv->stations[sta_id].tid[tid].agg.state) { | 1049 | switch (il->stations[sta_id].tid[tid].agg.state) { |
1050 | case IL_EMPTYING_HW_QUEUE_DELBA: | 1050 | case IL_EMPTYING_HW_QUEUE_DELBA: |
1051 | /* We are reclaiming the last packet of the */ | 1051 | /* We are reclaiming the last packet of the */ |
1052 | /* aggregated HW queue */ | 1052 | /* aggregated HW queue */ |
@@ -1054,9 +1054,9 @@ int il4965_txq_check_empty(struct il_priv *priv, | |||
1054 | (q->read_ptr == q->write_ptr)) { | 1054 | (q->read_ptr == q->write_ptr)) { |
1055 | u16 ssn = SEQ_TO_SN(tid_data->seq_number); | 1055 | u16 ssn = SEQ_TO_SN(tid_data->seq_number); |
1056 | int tx_fifo = il4965_get_fifo_from_tid(ctx, tid); | 1056 | int tx_fifo = il4965_get_fifo_from_tid(ctx, tid); |
1057 | IL_DEBUG_HT(priv, | 1057 | IL_DEBUG_HT(il, |
1058 | "HW queue empty: continue DELBA flow\n"); | 1058 | "HW queue empty: continue DELBA flow\n"); |
1059 | il4965_txq_agg_disable(priv, txq_id, ssn, tx_fifo); | 1059 | il4965_txq_agg_disable(il, txq_id, ssn, tx_fifo); |
1060 | tid_data->agg.state = IL_AGG_OFF; | 1060 | tid_data->agg.state = IL_AGG_OFF; |
1061 | ieee80211_stop_tx_ba_cb_irqsafe(ctx->vif, addr, tid); | 1061 | ieee80211_stop_tx_ba_cb_irqsafe(ctx->vif, addr, tid); |
1062 | } | 1062 | } |
@@ -1064,7 +1064,7 @@ int il4965_txq_check_empty(struct il_priv *priv, | |||
1064 | case IL_EMPTYING_HW_QUEUE_ADDBA: | 1064 | case IL_EMPTYING_HW_QUEUE_ADDBA: |
1065 | /* We are reclaiming the last packet of the queue */ | 1065 | /* We are reclaiming the last packet of the queue */ |
1066 | if (tid_data->tfds_in_queue == 0) { | 1066 | if (tid_data->tfds_in_queue == 0) { |
1067 | IL_DEBUG_HT(priv, | 1067 | IL_DEBUG_HT(il, |
1068 | "HW queue empty: continue ADDBA flow\n"); | 1068 | "HW queue empty: continue ADDBA flow\n"); |
1069 | tid_data->agg.state = IL_AGG_ON; | 1069 | tid_data->agg.state = IL_AGG_ON; |
1070 | ieee80211_start_tx_ba_cb_irqsafe(ctx->vif, addr, tid); | 1070 | ieee80211_start_tx_ba_cb_irqsafe(ctx->vif, addr, tid); |
@@ -1075,7 +1075,7 @@ int il4965_txq_check_empty(struct il_priv *priv, | |||
1075 | return 0; | 1075 | return 0; |
1076 | } | 1076 | } |
1077 | 1077 | ||
1078 | static void il4965_non_agg_tx_status(struct il_priv *priv, | 1078 | static void il4965_non_agg_tx_status(struct il_priv *il, |
1079 | struct il_rxon_context *ctx, | 1079 | struct il_rxon_context *ctx, |
1080 | const u8 *addr1) | 1080 | const u8 *addr1) |
1081 | { | 1081 | { |
@@ -1089,33 +1089,33 @@ static void il4965_non_agg_tx_status(struct il_priv *priv, | |||
1089 | /* avoid atomic ops if this isn't a client */ | 1089 | /* avoid atomic ops if this isn't a client */ |
1090 | if (sta_priv->client && | 1090 | if (sta_priv->client && |
1091 | atomic_dec_return(&sta_priv->pending_frames) == 0) | 1091 | atomic_dec_return(&sta_priv->pending_frames) == 0) |
1092 | ieee80211_sta_block_awake(priv->hw, sta, false); | 1092 | ieee80211_sta_block_awake(il->hw, sta, false); |
1093 | } | 1093 | } |
1094 | rcu_read_unlock(); | 1094 | rcu_read_unlock(); |
1095 | } | 1095 | } |
1096 | 1096 | ||
1097 | static void | 1097 | static void |
1098 | il4965_tx_status(struct il_priv *priv, struct il_tx_info *tx_info, | 1098 | il4965_tx_status(struct il_priv *il, struct il_tx_info *tx_info, |
1099 | bool is_agg) | 1099 | bool is_agg) |
1100 | { | 1100 | { |
1101 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx_info->skb->data; | 1101 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx_info->skb->data; |
1102 | 1102 | ||
1103 | if (!is_agg) | 1103 | if (!is_agg) |
1104 | il4965_non_agg_tx_status(priv, tx_info->ctx, hdr->addr1); | 1104 | il4965_non_agg_tx_status(il, tx_info->ctx, hdr->addr1); |
1105 | 1105 | ||
1106 | ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb); | 1106 | ieee80211_tx_status_irqsafe(il->hw, tx_info->skb); |
1107 | } | 1107 | } |
1108 | 1108 | ||
1109 | int il4965_tx_queue_reclaim(struct il_priv *priv, int txq_id, int index) | 1109 | int il4965_tx_queue_reclaim(struct il_priv *il, int txq_id, int index) |
1110 | { | 1110 | { |
1111 | struct il_tx_queue *txq = &priv->txq[txq_id]; | 1111 | struct il_tx_queue *txq = &il->txq[txq_id]; |
1112 | struct il_queue *q = &txq->q; | 1112 | struct il_queue *q = &txq->q; |
1113 | struct il_tx_info *tx_info; | 1113 | struct il_tx_info *tx_info; |
1114 | int nfreed = 0; | 1114 | int nfreed = 0; |
1115 | struct ieee80211_hdr *hdr; | 1115 | struct ieee80211_hdr *hdr; |
1116 | 1116 | ||
1117 | if ((index >= q->n_bd) || (il_queue_used(q, index) == 0)) { | 1117 | if ((index >= q->n_bd) || (il_queue_used(q, index) == 0)) { |
1118 | IL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, " | 1118 | IL_ERR(il, "Read index for DMA queue txq id (%d), index %d, " |
1119 | "is out of range [0-%d] %d %d.\n", txq_id, | 1119 | "is out of range [0-%d] %d %d.\n", txq_id, |
1120 | index, q->n_bd, q->write_ptr, q->read_ptr); | 1120 | index, q->n_bd, q->write_ptr, q->read_ptr); |
1121 | return 0; | 1121 | return 0; |
@@ -1134,11 +1134,11 @@ int il4965_tx_queue_reclaim(struct il_priv *priv, int txq_id, int index) | |||
1134 | if (ieee80211_is_data_qos(hdr->frame_control)) | 1134 | if (ieee80211_is_data_qos(hdr->frame_control)) |
1135 | nfreed++; | 1135 | nfreed++; |
1136 | 1136 | ||
1137 | il4965_tx_status(priv, tx_info, | 1137 | il4965_tx_status(il, tx_info, |
1138 | txq_id >= IWL4965_FIRST_AMPDU_QUEUE); | 1138 | txq_id >= IWL4965_FIRST_AMPDU_QUEUE); |
1139 | tx_info->skb = NULL; | 1139 | tx_info->skb = NULL; |
1140 | 1140 | ||
1141 | priv->cfg->ops->lib->txq_free_tfd(priv, txq); | 1141 | il->cfg->ops->lib->txq_free_tfd(il, txq); |
1142 | } | 1142 | } |
1143 | return nfreed; | 1143 | return nfreed; |
1144 | } | 1144 | } |
@@ -1149,7 +1149,7 @@ int il4965_tx_queue_reclaim(struct il_priv *priv, int txq_id, int index) | |||
1149 | * Go through block-ack's bitmap of ACK'd frames, update driver's record of | 1149 | * Go through block-ack's bitmap of ACK'd frames, update driver's record of |
1150 | * ACK vs. not. This gets sent to mac80211, then to rate scaling algo. | 1150 | * ACK vs. not. This gets sent to mac80211, then to rate scaling algo. |
1151 | */ | 1151 | */ |
1152 | static int il4965_tx_status_reply_compressed_ba(struct il_priv *priv, | 1152 | static int il4965_tx_status_reply_compressed_ba(struct il_priv *il, |
1153 | struct il_ht_agg *agg, | 1153 | struct il_ht_agg *agg, |
1154 | struct il_compressed_ba_resp *ba_resp) | 1154 | struct il_compressed_ba_resp *ba_resp) |
1155 | 1155 | ||
@@ -1163,13 +1163,13 @@ static int il4965_tx_status_reply_compressed_ba(struct il_priv *priv, | |||
1163 | 1163 | ||
1164 | if (unlikely(!agg->wait_for_ba)) { | 1164 | if (unlikely(!agg->wait_for_ba)) { |
1165 | if (unlikely(ba_resp->bitmap)) | 1165 | if (unlikely(ba_resp->bitmap)) |
1166 | IL_ERR(priv, "Received BA when not expected\n"); | 1166 | IL_ERR(il, "Received BA when not expected\n"); |
1167 | return -EINVAL; | 1167 | return -EINVAL; |
1168 | } | 1168 | } |
1169 | 1169 | ||
1170 | /* Mark that the expected block-ack response arrived */ | 1170 | /* Mark that the expected block-ack response arrived */ |
1171 | agg->wait_for_ba = 0; | 1171 | agg->wait_for_ba = 0; |
1172 | IL_DEBUG_TX_REPLY(priv, "BA %d %d\n", agg->start_idx, | 1172 | IL_DEBUG_TX_REPLY(il, "BA %d %d\n", agg->start_idx, |
1173 | ba_resp->seq_ctl); | 1173 | ba_resp->seq_ctl); |
1174 | 1174 | ||
1175 | /* Calculate shift to align block-ack bits with our Tx window bits */ | 1175 | /* Calculate shift to align block-ack bits with our Tx window bits */ |
@@ -1178,7 +1178,7 @@ static int il4965_tx_status_reply_compressed_ba(struct il_priv *priv, | |||
1178 | sh += 0x100; | 1178 | sh += 0x100; |
1179 | 1179 | ||
1180 | if (agg->frame_count > (64 - sh)) { | 1180 | if (agg->frame_count > (64 - sh)) { |
1181 | IL_DEBUG_TX_REPLY(priv, "more frames than bitmap size"); | 1181 | IL_DEBUG_TX_REPLY(il, "more frames than bitmap size"); |
1182 | return -1; | 1182 | return -1; |
1183 | } | 1183 | } |
1184 | 1184 | ||
@@ -1195,7 +1195,7 @@ static int il4965_tx_status_reply_compressed_ba(struct il_priv *priv, | |||
1195 | while (sent_bitmap) { | 1195 | while (sent_bitmap) { |
1196 | ack = sent_bitmap & 1ULL; | 1196 | ack = sent_bitmap & 1ULL; |
1197 | successes += ack; | 1197 | successes += ack; |
1198 | IL_DEBUG_TX_REPLY(priv, "%s ON i=%d idx=%d raw=%d\n", | 1198 | IL_DEBUG_TX_REPLY(il, "%s ON i=%d idx=%d raw=%d\n", |
1199 | ack ? "ACK" : "NACK", i, | 1199 | ack ? "ACK" : "NACK", i, |
1200 | (agg->start_idx + i) & 0xff, | 1200 | (agg->start_idx + i) & 0xff, |
1201 | agg->start_idx + i); | 1201 | agg->start_idx + i); |
@@ -1203,16 +1203,16 @@ static int il4965_tx_status_reply_compressed_ba(struct il_priv *priv, | |||
1203 | ++i; | 1203 | ++i; |
1204 | } | 1204 | } |
1205 | 1205 | ||
1206 | IL_DEBUG_TX_REPLY(priv, "Bitmap %llx\n", | 1206 | IL_DEBUG_TX_REPLY(il, "Bitmap %llx\n", |
1207 | (unsigned long long)bitmap); | 1207 | (unsigned long long)bitmap); |
1208 | 1208 | ||
1209 | info = IEEE80211_SKB_CB(priv->txq[scd_flow].txb[agg->start_idx].skb); | 1209 | info = IEEE80211_SKB_CB(il->txq[scd_flow].txb[agg->start_idx].skb); |
1210 | memset(&info->status, 0, sizeof(info->status)); | 1210 | memset(&info->status, 0, sizeof(info->status)); |
1211 | info->flags |= IEEE80211_TX_STAT_ACK; | 1211 | info->flags |= IEEE80211_TX_STAT_ACK; |
1212 | info->flags |= IEEE80211_TX_STAT_AMPDU; | 1212 | info->flags |= IEEE80211_TX_STAT_AMPDU; |
1213 | info->status.ampdu_ack_len = successes; | 1213 | info->status.ampdu_ack_len = successes; |
1214 | info->status.ampdu_len = agg->frame_count; | 1214 | info->status.ampdu_len = agg->frame_count; |
1215 | il4965_hwrate_to_tx_control(priv, agg->rate_n_flags, info); | 1215 | il4965_hwrate_to_tx_control(il, agg->rate_n_flags, info); |
1216 | 1216 | ||
1217 | return 0; | 1217 | return 0; |
1218 | } | 1218 | } |
@@ -1220,7 +1220,7 @@ static int il4965_tx_status_reply_compressed_ba(struct il_priv *priv, | |||
1220 | /** | 1220 | /** |
1221 | * translate ucode response to mac80211 tx status control values | 1221 | * translate ucode response to mac80211 tx status control values |
1222 | */ | 1222 | */ |
1223 | void il4965_hwrate_to_tx_control(struct il_priv *priv, u32 rate_n_flags, | 1223 | void il4965_hwrate_to_tx_control(struct il_priv *il, u32 rate_n_flags, |
1224 | struct ieee80211_tx_info *info) | 1224 | struct ieee80211_tx_info *info) |
1225 | { | 1225 | { |
1226 | struct ieee80211_tx_rate *r = &info->control.rates[0]; | 1226 | struct ieee80211_tx_rate *r = &info->control.rates[0]; |
@@ -1246,7 +1246,7 @@ void il4965_hwrate_to_tx_control(struct il_priv *priv, u32 rate_n_flags, | |||
1246 | * Handles block-acknowledge notification from device, which reports success | 1246 | * Handles block-acknowledge notification from device, which reports success |
1247 | * of frames sent via aggregation. | 1247 | * of frames sent via aggregation. |
1248 | */ | 1248 | */ |
1249 | void il4965_rx_reply_compressed_ba(struct il_priv *priv, | 1249 | void il4965_rx_reply_compressed_ba(struct il_priv *il, |
1250 | struct il_rx_mem_buffer *rxb) | 1250 | struct il_rx_mem_buffer *rxb) |
1251 | { | 1251 | { |
1252 | struct il_rx_packet *pkt = rxb_addr(rxb); | 1252 | struct il_rx_packet *pkt = rxb_addr(rxb); |
@@ -1265,16 +1265,16 @@ void il4965_rx_reply_compressed_ba(struct il_priv *priv, | |||
1265 | * (in Tx queue's circular buffer) of first TFD/frame in window */ | 1265 | * (in Tx queue's circular buffer) of first TFD/frame in window */ |
1266 | u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn); | 1266 | u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn); |
1267 | 1267 | ||
1268 | if (scd_flow >= priv->hw_params.max_txq_num) { | 1268 | if (scd_flow >= il->hw_params.max_txq_num) { |
1269 | IL_ERR(priv, | 1269 | IL_ERR(il, |
1270 | "BUG_ON scd_flow is bigger than number of queues\n"); | 1270 | "BUG_ON scd_flow is bigger than number of queues\n"); |
1271 | return; | 1271 | return; |
1272 | } | 1272 | } |
1273 | 1273 | ||
1274 | txq = &priv->txq[scd_flow]; | 1274 | txq = &il->txq[scd_flow]; |
1275 | sta_id = ba_resp->sta_id; | 1275 | sta_id = ba_resp->sta_id; |
1276 | tid = ba_resp->tid; | 1276 | tid = ba_resp->tid; |
1277 | agg = &priv->stations[sta_id].tid[tid].agg; | 1277 | agg = &il->stations[sta_id].tid[tid].agg; |
1278 | if (unlikely(agg->txq_id != scd_flow)) { | 1278 | if (unlikely(agg->txq_id != scd_flow)) { |
1279 | /* | 1279 | /* |
1280 | * FIXME: this is a uCode bug which need to be addressed, | 1280 | * 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, | |||
1282 | * since it is possible happen very often and in order | 1282 | * since it is possible happen very often and in order |
1283 | * not to fill the syslog, don't enable the logging by default | 1283 | * not to fill the syslog, don't enable the logging by default |
1284 | */ | 1284 | */ |
1285 | IL_DEBUG_TX_REPLY(priv, | 1285 | IL_DEBUG_TX_REPLY(il, |
1286 | "BA scd_flow %d does not match txq_id %d\n", | 1286 | "BA scd_flow %d does not match txq_id %d\n", |
1287 | scd_flow, agg->txq_id); | 1287 | scd_flow, agg->txq_id); |
1288 | return; | 1288 | return; |
@@ -1291,14 +1291,14 @@ void il4965_rx_reply_compressed_ba(struct il_priv *priv, | |||
1291 | /* Find index just before block-ack window */ | 1291 | /* Find index just before block-ack window */ |
1292 | index = il_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd); | 1292 | index = il_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd); |
1293 | 1293 | ||
1294 | spin_lock_irqsave(&priv->sta_lock, flags); | 1294 | spin_lock_irqsave(&il->sta_lock, flags); |
1295 | 1295 | ||
1296 | IL_DEBUG_TX_REPLY(priv, "REPLY_COMPRESSED_BA [%d] Received from %pM, " | 1296 | IL_DEBUG_TX_REPLY(il, "REPLY_COMPRESSED_BA [%d] Received from %pM, " |
1297 | "sta_id = %d\n", | 1297 | "sta_id = %d\n", |
1298 | agg->wait_for_ba, | 1298 | agg->wait_for_ba, |
1299 | (u8 *) &ba_resp->sta_addr_lo32, | 1299 | (u8 *) &ba_resp->sta_addr_lo32, |
1300 | ba_resp->sta_id); | 1300 | ba_resp->sta_id); |
1301 | IL_DEBUG_TX_REPLY(priv, "TID = %d, SeqCtl = %d, bitmap = 0x%llx," | 1301 | IL_DEBUG_TX_REPLY(il, "TID = %d, SeqCtl = %d, bitmap = 0x%llx," |
1302 | "scd_flow = " | 1302 | "scd_flow = " |
1303 | "%d, scd_ssn = %d\n", | 1303 | "%d, scd_ssn = %d\n", |
1304 | ba_resp->tid, | 1304 | ba_resp->tid, |
@@ -1306,30 +1306,30 @@ void il4965_rx_reply_compressed_ba(struct il_priv *priv, | |||
1306 | (unsigned long long)le64_to_cpu(ba_resp->bitmap), | 1306 | (unsigned long long)le64_to_cpu(ba_resp->bitmap), |
1307 | ba_resp->scd_flow, | 1307 | ba_resp->scd_flow, |
1308 | ba_resp->scd_ssn); | 1308 | ba_resp->scd_ssn); |
1309 | IL_DEBUG_TX_REPLY(priv, "DAT start_idx = %d, bitmap = 0x%llx\n", | 1309 | IL_DEBUG_TX_REPLY(il, "DAT start_idx = %d, bitmap = 0x%llx\n", |
1310 | agg->start_idx, | 1310 | agg->start_idx, |
1311 | (unsigned long long)agg->bitmap); | 1311 | (unsigned long long)agg->bitmap); |
1312 | 1312 | ||
1313 | /* Update driver's record of ACK vs. not for each frame in window */ | 1313 | /* Update driver's record of ACK vs. not for each frame in window */ |
1314 | il4965_tx_status_reply_compressed_ba(priv, agg, ba_resp); | 1314 | il4965_tx_status_reply_compressed_ba(il, agg, ba_resp); |
1315 | 1315 | ||
1316 | /* Release all TFDs before the SSN, i.e. all TFDs in front of | 1316 | /* Release all TFDs before the SSN, i.e. all TFDs in front of |
1317 | * block-ack window (we assume that they've been successfully | 1317 | * block-ack window (we assume that they've been successfully |
1318 | * transmitted ... if not, it's too late anyway). */ | 1318 | * transmitted ... if not, it's too late anyway). */ |
1319 | if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) { | 1319 | if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) { |
1320 | /* calculate mac80211 ampdu sw queue to wake */ | 1320 | /* calculate mac80211 ampdu sw queue to wake */ |
1321 | int freed = il4965_tx_queue_reclaim(priv, scd_flow, index); | 1321 | int freed = il4965_tx_queue_reclaim(il, scd_flow, index); |
1322 | il4965_free_tfds_in_queue(priv, sta_id, tid, freed); | 1322 | il4965_free_tfds_in_queue(il, sta_id, tid, freed); |
1323 | 1323 | ||
1324 | if ((il_queue_space(&txq->q) > txq->q.low_mark) && | 1324 | if ((il_queue_space(&txq->q) > txq->q.low_mark) && |
1325 | priv->mac80211_registered && | 1325 | il->mac80211_registered && |
1326 | (agg->state != IL_EMPTYING_HW_QUEUE_DELBA)) | 1326 | (agg->state != IL_EMPTYING_HW_QUEUE_DELBA)) |
1327 | il_wake_queue(priv, txq); | 1327 | il_wake_queue(il, txq); |
1328 | 1328 | ||
1329 | il4965_txq_check_empty(priv, sta_id, tid, scd_flow); | 1329 | il4965_txq_check_empty(il, sta_id, tid, scd_flow); |
1330 | } | 1330 | } |
1331 | 1331 | ||
1332 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 1332 | spin_unlock_irqrestore(&il->sta_lock, flags); |
1333 | } | 1333 | } |
1334 | 1334 | ||
1335 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 1335 | #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 3c9df1bb5af..d4dc597452e 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-ucode.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-ucode.c | |||
@@ -48,22 +48,22 @@ | |||
48 | * it's a pretty good bet that everything between them is good, too. | 48 | * it's a pretty good bet that everything between them is good, too. |
49 | */ | 49 | */ |
50 | static int | 50 | static int |
51 | il4965_verify_inst_sparse(struct il_priv *priv, __le32 *image, u32 len) | 51 | il4965_verify_inst_sparse(struct il_priv *il, __le32 *image, u32 len) |
52 | { | 52 | { |
53 | u32 val; | 53 | u32 val; |
54 | int ret = 0; | 54 | int ret = 0; |
55 | u32 errcnt = 0; | 55 | u32 errcnt = 0; |
56 | u32 i; | 56 | u32 i; |
57 | 57 | ||
58 | IL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len); | 58 | IL_DEBUG_INFO(il, "ucode inst image size is %u\n", len); |
59 | 59 | ||
60 | for (i = 0; i < len; i += 100, image += 100/sizeof(u32)) { | 60 | for (i = 0; i < len; i += 100, image += 100/sizeof(u32)) { |
61 | /* read data comes through single port, auto-incr addr */ | 61 | /* read data comes through single port, auto-incr addr */ |
62 | /* NOTE: Use the debugless read so we don't flood kernel log | 62 | /* NOTE: Use the debugless read so we don't flood kernel log |
63 | * if IL_DL_IO is set */ | 63 | * if IL_DL_IO is set */ |
64 | il_write_direct32(priv, HBUS_TARG_MEM_RADDR, | 64 | il_write_direct32(il, HBUS_TARG_MEM_RADDR, |
65 | i + IWL4965_RTC_INST_LOWER_BOUND); | 65 | i + IWL4965_RTC_INST_LOWER_BOUND); |
66 | val = _il_read_direct32(priv, HBUS_TARG_MEM_RDAT); | 66 | val = _il_read_direct32(il, HBUS_TARG_MEM_RDAT); |
67 | if (val != le32_to_cpu(*image)) { | 67 | if (val != le32_to_cpu(*image)) { |
68 | ret = -EIO; | 68 | ret = -EIO; |
69 | errcnt++; | 69 | errcnt++; |
@@ -79,7 +79,7 @@ il4965_verify_inst_sparse(struct il_priv *priv, __le32 *image, u32 len) | |||
79 | * il4965_verify_inst_full - verify runtime uCode image in card vs. host, | 79 | * il4965_verify_inst_full - verify runtime uCode image in card vs. host, |
80 | * looking at all data. | 80 | * looking at all data. |
81 | */ | 81 | */ |
82 | static int il4965_verify_inst_full(struct il_priv *priv, __le32 *image, | 82 | static int il4965_verify_inst_full(struct il_priv *il, __le32 *image, |
83 | u32 len) | 83 | u32 len) |
84 | { | 84 | { |
85 | u32 val; | 85 | u32 val; |
@@ -87,9 +87,9 @@ static int il4965_verify_inst_full(struct il_priv *priv, __le32 *image, | |||
87 | int ret = 0; | 87 | int ret = 0; |
88 | u32 errcnt; | 88 | u32 errcnt; |
89 | 89 | ||
90 | IL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len); | 90 | IL_DEBUG_INFO(il, "ucode inst image size is %u\n", len); |
91 | 91 | ||
92 | il_write_direct32(priv, HBUS_TARG_MEM_RADDR, | 92 | il_write_direct32(il, HBUS_TARG_MEM_RADDR, |
93 | IWL4965_RTC_INST_LOWER_BOUND); | 93 | IWL4965_RTC_INST_LOWER_BOUND); |
94 | 94 | ||
95 | errcnt = 0; | 95 | errcnt = 0; |
@@ -97,9 +97,9 @@ static int il4965_verify_inst_full(struct il_priv *priv, __le32 *image, | |||
97 | /* read data comes through single port, auto-incr addr */ | 97 | /* read data comes through single port, auto-incr addr */ |
98 | /* NOTE: Use the debugless read so we don't flood kernel log | 98 | /* NOTE: Use the debugless read so we don't flood kernel log |
99 | * if IL_DL_IO is set */ | 99 | * if IL_DL_IO is set */ |
100 | val = _il_read_direct32(priv, HBUS_TARG_MEM_RDAT); | 100 | val = _il_read_direct32(il, HBUS_TARG_MEM_RDAT); |
101 | if (val != le32_to_cpu(*image)) { | 101 | if (val != le32_to_cpu(*image)) { |
102 | IL_ERR(priv, "uCode INST section is invalid at " | 102 | IL_ERR(il, "uCode INST section is invalid at " |
103 | "offset 0x%x, is 0x%x, s/b 0x%x\n", | 103 | "offset 0x%x, is 0x%x, s/b 0x%x\n", |
104 | save_len - len, val, le32_to_cpu(*image)); | 104 | save_len - len, val, le32_to_cpu(*image)); |
105 | ret = -EIO; | 105 | ret = -EIO; |
@@ -110,7 +110,7 @@ static int il4965_verify_inst_full(struct il_priv *priv, __le32 *image, | |||
110 | } | 110 | } |
111 | 111 | ||
112 | if (!errcnt) | 112 | if (!errcnt) |
113 | IL_DEBUG_INFO(priv, | 113 | IL_DEBUG_INFO(il, |
114 | "ucode image in INSTRUCTION memory is good\n"); | 114 | "ucode image in INSTRUCTION memory is good\n"); |
115 | 115 | ||
116 | return ret; | 116 | return ret; |
@@ -120,47 +120,47 @@ static int il4965_verify_inst_full(struct il_priv *priv, __le32 *image, | |||
120 | * il4965_verify_ucode - determine which instruction image is in SRAM, | 120 | * il4965_verify_ucode - determine which instruction image is in SRAM, |
121 | * and verify its contents | 121 | * and verify its contents |
122 | */ | 122 | */ |
123 | int il4965_verify_ucode(struct il_priv *priv) | 123 | int il4965_verify_ucode(struct il_priv *il) |
124 | { | 124 | { |
125 | __le32 *image; | 125 | __le32 *image; |
126 | u32 len; | 126 | u32 len; |
127 | int ret; | 127 | int ret; |
128 | 128 | ||
129 | /* Try bootstrap */ | 129 | /* Try bootstrap */ |
130 | image = (__le32 *)priv->ucode_boot.v_addr; | 130 | image = (__le32 *)il->ucode_boot.v_addr; |
131 | len = priv->ucode_boot.len; | 131 | len = il->ucode_boot.len; |
132 | ret = il4965_verify_inst_sparse(priv, image, len); | 132 | ret = il4965_verify_inst_sparse(il, image, len); |
133 | if (!ret) { | 133 | if (!ret) { |
134 | IL_DEBUG_INFO(priv, "Bootstrap uCode is good in inst SRAM\n"); | 134 | IL_DEBUG_INFO(il, "Bootstrap uCode is good in inst SRAM\n"); |
135 | return 0; | 135 | return 0; |
136 | } | 136 | } |
137 | 137 | ||
138 | /* Try initialize */ | 138 | /* Try initialize */ |
139 | image = (__le32 *)priv->ucode_init.v_addr; | 139 | image = (__le32 *)il->ucode_init.v_addr; |
140 | len = priv->ucode_init.len; | 140 | len = il->ucode_init.len; |
141 | ret = il4965_verify_inst_sparse(priv, image, len); | 141 | ret = il4965_verify_inst_sparse(il, image, len); |
142 | if (!ret) { | 142 | if (!ret) { |
143 | IL_DEBUG_INFO(priv, "Initialize uCode is good in inst SRAM\n"); | 143 | IL_DEBUG_INFO(il, "Initialize uCode is good in inst SRAM\n"); |
144 | return 0; | 144 | return 0; |
145 | } | 145 | } |
146 | 146 | ||
147 | /* Try runtime/protocol */ | 147 | /* Try runtime/protocol */ |
148 | image = (__le32 *)priv->ucode_code.v_addr; | 148 | image = (__le32 *)il->ucode_code.v_addr; |
149 | len = priv->ucode_code.len; | 149 | len = il->ucode_code.len; |
150 | ret = il4965_verify_inst_sparse(priv, image, len); | 150 | ret = il4965_verify_inst_sparse(il, image, len); |
151 | if (!ret) { | 151 | if (!ret) { |
152 | IL_DEBUG_INFO(priv, "Runtime uCode is good in inst SRAM\n"); | 152 | IL_DEBUG_INFO(il, "Runtime uCode is good in inst SRAM\n"); |
153 | return 0; | 153 | return 0; |
154 | } | 154 | } |
155 | 155 | ||
156 | IL_ERR(priv, "NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n"); | 156 | IL_ERR(il, "NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n"); |
157 | 157 | ||
158 | /* Since nothing seems to match, show first several data entries in | 158 | /* Since nothing seems to match, show first several data entries in |
159 | * instruction SRAM, so maybe visual inspection will give a clue. | 159 | * instruction SRAM, so maybe visual inspection will give a clue. |
160 | * Selection of bootstrap image (vs. other images) is arbitrary. */ | 160 | * Selection of bootstrap image (vs. other images) is arbitrary. */ |
161 | image = (__le32 *)priv->ucode_boot.v_addr; | 161 | image = (__le32 *)il->ucode_boot.v_addr; |
162 | len = priv->ucode_boot.len; | 162 | len = il->ucode_boot.len; |
163 | ret = il4965_verify_inst_full(priv, image, len); | 163 | ret = il4965_verify_inst_full(il, image, len); |
164 | 164 | ||
165 | return ret; | 165 | return ret; |
166 | } | 166 | } |
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.c b/drivers/net/wireless/iwlegacy/iwl-4965.c index 0f2bc5f767d..d3c818354ca 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965.c | |||
@@ -48,8 +48,8 @@ | |||
48 | #include "iwl-4965.h" | 48 | #include "iwl-4965.h" |
49 | #include "iwl-4965-debugfs.h" | 49 | #include "iwl-4965-debugfs.h" |
50 | 50 | ||
51 | static int il4965_send_tx_power(struct il_priv *priv); | 51 | static int il4965_send_tx_power(struct il_priv *il); |
52 | static int il4965_hw_get_temperature(struct il_priv *priv); | 52 | static int il4965_hw_get_temperature(struct il_priv *il); |
53 | 53 | ||
54 | /* Highest firmware API version supported */ | 54 | /* Highest firmware API version supported */ |
55 | #define IWL4965_UCODE_API_MAX 2 | 55 | #define IWL4965_UCODE_API_MAX 2 |
@@ -62,23 +62,23 @@ static int il4965_hw_get_temperature(struct il_priv *priv); | |||
62 | #define IWL4965_MODULE_FIRMWARE(api) _IWL4965_MODULE_FIRMWARE(api) | 62 | #define IWL4965_MODULE_FIRMWARE(api) _IWL4965_MODULE_FIRMWARE(api) |
63 | 63 | ||
64 | /* check contents of special bootstrap uCode SRAM */ | 64 | /* check contents of special bootstrap uCode SRAM */ |
65 | static int il4965_verify_bsm(struct il_priv *priv) | 65 | static int il4965_verify_bsm(struct il_priv *il) |
66 | { | 66 | { |
67 | __le32 *image = priv->ucode_boot.v_addr; | 67 | __le32 *image = il->ucode_boot.v_addr; |
68 | u32 len = priv->ucode_boot.len; | 68 | u32 len = il->ucode_boot.len; |
69 | u32 reg; | 69 | u32 reg; |
70 | u32 val; | 70 | u32 val; |
71 | 71 | ||
72 | IL_DEBUG_INFO(priv, "Begin verify bsm\n"); | 72 | IL_DEBUG_INFO(il, "Begin verify bsm\n"); |
73 | 73 | ||
74 | /* verify BSM SRAM contents */ | 74 | /* verify BSM SRAM contents */ |
75 | val = il_read_prph(priv, BSM_WR_DWCOUNT_REG); | 75 | val = il_read_prph(il, BSM_WR_DWCOUNT_REG); |
76 | for (reg = BSM_SRAM_LOWER_BOUND; | 76 | for (reg = BSM_SRAM_LOWER_BOUND; |
77 | reg < BSM_SRAM_LOWER_BOUND + len; | 77 | reg < BSM_SRAM_LOWER_BOUND + len; |
78 | reg += sizeof(u32), image++) { | 78 | reg += sizeof(u32), image++) { |
79 | val = il_read_prph(priv, reg); | 79 | val = il_read_prph(il, reg); |
80 | if (val != le32_to_cpu(*image)) { | 80 | if (val != le32_to_cpu(*image)) { |
81 | IL_ERR(priv, "BSM uCode verification failed at " | 81 | IL_ERR(il, "BSM uCode verification failed at " |
82 | "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n", | 82 | "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n", |
83 | BSM_SRAM_LOWER_BOUND, | 83 | BSM_SRAM_LOWER_BOUND, |
84 | reg - BSM_SRAM_LOWER_BOUND, len, | 84 | reg - BSM_SRAM_LOWER_BOUND, len, |
@@ -87,7 +87,7 @@ static int il4965_verify_bsm(struct il_priv *priv) | |||
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | IL_DEBUG_INFO(priv, "BSM bootstrap uCode image OK\n"); | 90 | IL_DEBUG_INFO(il, "BSM bootstrap uCode image OK\n"); |
91 | 91 | ||
92 | return 0; | 92 | return 0; |
93 | } | 93 | } |
@@ -124,10 +124,10 @@ static int il4965_verify_bsm(struct il_priv *priv) | |||
124 | * the runtime uCode instructions and the backup data cache into SRAM, | 124 | * the runtime uCode instructions and the backup data cache into SRAM, |
125 | * and re-launches the runtime uCode from where it left off. | 125 | * and re-launches the runtime uCode from where it left off. |
126 | */ | 126 | */ |
127 | static int il4965_load_bsm(struct il_priv *priv) | 127 | static int il4965_load_bsm(struct il_priv *il) |
128 | { | 128 | { |
129 | __le32 *image = priv->ucode_boot.v_addr; | 129 | __le32 *image = il->ucode_boot.v_addr; |
130 | u32 len = priv->ucode_boot.len; | 130 | u32 len = il->ucode_boot.len; |
131 | dma_addr_t pinst; | 131 | dma_addr_t pinst; |
132 | dma_addr_t pdata; | 132 | dma_addr_t pdata; |
133 | u32 inst_len; | 133 | u32 inst_len; |
@@ -137,9 +137,9 @@ static int il4965_load_bsm(struct il_priv *priv) | |||
137 | u32 reg_offset; | 137 | u32 reg_offset; |
138 | int ret; | 138 | int ret; |
139 | 139 | ||
140 | IL_DEBUG_INFO(priv, "Begin load bsm\n"); | 140 | IL_DEBUG_INFO(il, "Begin load bsm\n"); |
141 | 141 | ||
142 | priv->ucode_type = UCODE_RT; | 142 | il->ucode_type = UCODE_RT; |
143 | 143 | ||
144 | /* make sure bootstrap program is no larger than BSM's SRAM size */ | 144 | /* make sure bootstrap program is no larger than BSM's SRAM size */ |
145 | if (len > IWL49_MAX_BSM_SIZE) | 145 | if (len > IWL49_MAX_BSM_SIZE) |
@@ -151,53 +151,53 @@ static int il4965_load_bsm(struct il_priv *priv) | |||
151 | * after the "initialize" uCode has run, to point to | 151 | * after the "initialize" uCode has run, to point to |
152 | * runtime/protocol instructions and backup data cache. | 152 | * runtime/protocol instructions and backup data cache. |
153 | */ | 153 | */ |
154 | pinst = priv->ucode_init.p_addr >> 4; | 154 | pinst = il->ucode_init.p_addr >> 4; |
155 | pdata = priv->ucode_init_data.p_addr >> 4; | 155 | pdata = il->ucode_init_data.p_addr >> 4; |
156 | inst_len = priv->ucode_init.len; | 156 | inst_len = il->ucode_init.len; |
157 | data_len = priv->ucode_init_data.len; | 157 | data_len = il->ucode_init_data.len; |
158 | 158 | ||
159 | il_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); | 159 | il_write_prph(il, BSM_DRAM_INST_PTR_REG, pinst); |
160 | il_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); | 160 | il_write_prph(il, BSM_DRAM_DATA_PTR_REG, pdata); |
161 | il_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); | 161 | il_write_prph(il, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); |
162 | il_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); | 162 | il_write_prph(il, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); |
163 | 163 | ||
164 | /* Fill BSM memory with bootstrap instructions */ | 164 | /* Fill BSM memory with bootstrap instructions */ |
165 | for (reg_offset = BSM_SRAM_LOWER_BOUND; | 165 | for (reg_offset = BSM_SRAM_LOWER_BOUND; |
166 | reg_offset < BSM_SRAM_LOWER_BOUND + len; | 166 | reg_offset < BSM_SRAM_LOWER_BOUND + len; |
167 | reg_offset += sizeof(u32), image++) | 167 | reg_offset += sizeof(u32), image++) |
168 | _il_write_prph(priv, reg_offset, le32_to_cpu(*image)); | 168 | _il_write_prph(il, reg_offset, le32_to_cpu(*image)); |
169 | 169 | ||
170 | ret = il4965_verify_bsm(priv); | 170 | ret = il4965_verify_bsm(il); |
171 | if (ret) | 171 | if (ret) |
172 | return ret; | 172 | return ret; |
173 | 173 | ||
174 | /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */ | 174 | /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */ |
175 | il_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0); | 175 | il_write_prph(il, BSM_WR_MEM_SRC_REG, 0x0); |
176 | il_write_prph(priv, | 176 | il_write_prph(il, |
177 | BSM_WR_MEM_DST_REG, IWL49_RTC_INST_LOWER_BOUND); | 177 | BSM_WR_MEM_DST_REG, IWL49_RTC_INST_LOWER_BOUND); |
178 | il_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); | 178 | il_write_prph(il, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); |
179 | 179 | ||
180 | /* Load bootstrap code into instruction SRAM now, | 180 | /* Load bootstrap code into instruction SRAM now, |
181 | * to prepare to load "initialize" uCode */ | 181 | * to prepare to load "initialize" uCode */ |
182 | il_write_prph(priv, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START); | 182 | il_write_prph(il, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START); |
183 | 183 | ||
184 | /* Wait for load of bootstrap uCode to finish */ | 184 | /* Wait for load of bootstrap uCode to finish */ |
185 | for (i = 0; i < 100; i++) { | 185 | for (i = 0; i < 100; i++) { |
186 | done = il_read_prph(priv, BSM_WR_CTRL_REG); | 186 | done = il_read_prph(il, BSM_WR_CTRL_REG); |
187 | if (!(done & BSM_WR_CTRL_REG_BIT_START)) | 187 | if (!(done & BSM_WR_CTRL_REG_BIT_START)) |
188 | break; | 188 | break; |
189 | udelay(10); | 189 | udelay(10); |
190 | } | 190 | } |
191 | if (i < 100) | 191 | if (i < 100) |
192 | IL_DEBUG_INFO(priv, "BSM write complete, poll %d iterations\n", i); | 192 | IL_DEBUG_INFO(il, "BSM write complete, poll %d iterations\n", i); |
193 | else { | 193 | else { |
194 | IL_ERR(priv, "BSM write did not complete!\n"); | 194 | IL_ERR(il, "BSM write did not complete!\n"); |
195 | return -EIO; | 195 | return -EIO; |
196 | } | 196 | } |
197 | 197 | ||
198 | /* Enable future boot loads whenever power management unit triggers it | 198 | /* Enable future boot loads whenever power management unit triggers it |
199 | * (e.g. when powering back up after power-save shutdown) */ | 199 | * (e.g. when powering back up after power-save shutdown) */ |
200 | il_write_prph(priv, | 200 | il_write_prph(il, |
201 | BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START_EN); | 201 | BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START_EN); |
202 | 202 | ||
203 | 203 | ||
@@ -213,27 +213,27 @@ static int il4965_load_bsm(struct il_priv *priv) | |||
213 | * We need to replace them to load runtime uCode inst and data, | 213 | * We need to replace them to load runtime uCode inst and data, |
214 | * and to save runtime data when powering down. | 214 | * and to save runtime data when powering down. |
215 | */ | 215 | */ |
216 | static int il4965_set_ucode_ptrs(struct il_priv *priv) | 216 | static int il4965_set_ucode_ptrs(struct il_priv *il) |
217 | { | 217 | { |
218 | dma_addr_t pinst; | 218 | dma_addr_t pinst; |
219 | dma_addr_t pdata; | 219 | dma_addr_t pdata; |
220 | int ret = 0; | 220 | int ret = 0; |
221 | 221 | ||
222 | /* bits 35:4 for 4965 */ | 222 | /* bits 35:4 for 4965 */ |
223 | pinst = priv->ucode_code.p_addr >> 4; | 223 | pinst = il->ucode_code.p_addr >> 4; |
224 | pdata = priv->ucode_data_backup.p_addr >> 4; | 224 | pdata = il->ucode_data_backup.p_addr >> 4; |
225 | 225 | ||
226 | /* Tell bootstrap uCode where to find image to load */ | 226 | /* Tell bootstrap uCode where to find image to load */ |
227 | il_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); | 227 | il_write_prph(il, BSM_DRAM_INST_PTR_REG, pinst); |
228 | il_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); | 228 | il_write_prph(il, BSM_DRAM_DATA_PTR_REG, pdata); |
229 | il_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, | 229 | il_write_prph(il, BSM_DRAM_DATA_BYTECOUNT_REG, |
230 | priv->ucode_data.len); | 230 | il->ucode_data.len); |
231 | 231 | ||
232 | /* Inst byte count must be last to set up, bit 31 signals uCode | 232 | /* Inst byte count must be last to set up, bit 31 signals uCode |
233 | * that all new ptr/size info is in place */ | 233 | * that all new ptr/size info is in place */ |
234 | il_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, | 234 | il_write_prph(il, BSM_DRAM_INST_BYTECOUNT_REG, |
235 | priv->ucode_code.len | BSM_DRAM_INST_LOAD); | 235 | il->ucode_code.len | BSM_DRAM_INST_LOAD); |
236 | IL_DEBUG_INFO(priv, "Runtime uCode pointers are set.\n"); | 236 | IL_DEBUG_INFO(il, "Runtime uCode pointers are set.\n"); |
237 | 237 | ||
238 | return ret; | 238 | return ret; |
239 | } | 239 | } |
@@ -244,40 +244,40 @@ static int il4965_set_ucode_ptrs(struct il_priv *priv) | |||
244 | * Called after REPLY_ALIVE notification received from "initialize" uCode. | 244 | * Called after REPLY_ALIVE notification received from "initialize" uCode. |
245 | * | 245 | * |
246 | * The 4965 "initialize" ALIVE reply contains calibration data for: | 246 | * The 4965 "initialize" ALIVE reply contains calibration data for: |
247 | * Voltage, temperature, and MIMO tx gain correction, now stored in priv | 247 | * Voltage, temperature, and MIMO tx gain correction, now stored in il |
248 | * (3945 does not contain this data). | 248 | * (3945 does not contain this data). |
249 | * | 249 | * |
250 | * Tell "initialize" uCode to go ahead and load the runtime uCode. | 250 | * Tell "initialize" uCode to go ahead and load the runtime uCode. |
251 | */ | 251 | */ |
252 | static void il4965_init_alive_start(struct il_priv *priv) | 252 | static void il4965_init_alive_start(struct il_priv *il) |
253 | { | 253 | { |
254 | /* Bootstrap uCode has loaded initialize uCode ... verify inst image. | 254 | /* Bootstrap uCode has loaded initialize uCode ... verify inst image. |
255 | * This is a paranoid check, because we would not have gotten the | 255 | * This is a paranoid check, because we would not have gotten the |
256 | * "initialize" alive if code weren't properly loaded. */ | 256 | * "initialize" alive if code weren't properly loaded. */ |
257 | if (il4965_verify_ucode(priv)) { | 257 | if (il4965_verify_ucode(il)) { |
258 | /* Runtime instruction load was bad; | 258 | /* Runtime instruction load was bad; |
259 | * take it all the way back down so we can try again */ | 259 | * take it all the way back down so we can try again */ |
260 | IL_DEBUG_INFO(priv, "Bad \"initialize\" uCode load.\n"); | 260 | IL_DEBUG_INFO(il, "Bad \"initialize\" uCode load.\n"); |
261 | goto restart; | 261 | goto restart; |
262 | } | 262 | } |
263 | 263 | ||
264 | /* Calculate temperature */ | 264 | /* Calculate temperature */ |
265 | priv->temperature = il4965_hw_get_temperature(priv); | 265 | il->temperature = il4965_hw_get_temperature(il); |
266 | 266 | ||
267 | /* Send pointers to protocol/runtime uCode image ... init code will | 267 | /* Send pointers to protocol/runtime uCode image ... init code will |
268 | * load and launch runtime uCode, which will send us another "Alive" | 268 | * load and launch runtime uCode, which will send us another "Alive" |
269 | * notification. */ | 269 | * notification. */ |
270 | IL_DEBUG_INFO(priv, "Initialization Alive received.\n"); | 270 | IL_DEBUG_INFO(il, "Initialization Alive received.\n"); |
271 | if (il4965_set_ucode_ptrs(priv)) { | 271 | if (il4965_set_ucode_ptrs(il)) { |
272 | /* Runtime instruction load won't happen; | 272 | /* Runtime instruction load won't happen; |
273 | * take it all the way back down so we can try again */ | 273 | * take it all the way back down so we can try again */ |
274 | IL_DEBUG_INFO(priv, "Couldn't set up uCode pointers.\n"); | 274 | IL_DEBUG_INFO(il, "Couldn't set up uCode pointers.\n"); |
275 | goto restart; | 275 | goto restart; |
276 | } | 276 | } |
277 | return; | 277 | return; |
278 | 278 | ||
279 | restart: | 279 | restart: |
280 | queue_work(priv->workqueue, &priv->restart); | 280 | queue_work(il->workqueue, &il->restart); |
281 | } | 281 | } |
282 | 282 | ||
283 | static bool iw4965_is_ht40_channel(__le32 rxon_flags) | 283 | static bool iw4965_is_ht40_channel(__le32 rxon_flags) |
@@ -288,43 +288,43 @@ static bool iw4965_is_ht40_channel(__le32 rxon_flags) | |||
288 | (chan_mod == CHANNEL_MODE_MIXED)); | 288 | (chan_mod == CHANNEL_MODE_MIXED)); |
289 | } | 289 | } |
290 | 290 | ||
291 | static void il4965_nic_config(struct il_priv *priv) | 291 | static void il4965_nic_config(struct il_priv *il) |
292 | { | 292 | { |
293 | unsigned long flags; | 293 | unsigned long flags; |
294 | u16 radio_cfg; | 294 | u16 radio_cfg; |
295 | 295 | ||
296 | spin_lock_irqsave(&priv->lock, flags); | 296 | spin_lock_irqsave(&il->lock, flags); |
297 | 297 | ||
298 | radio_cfg = il_eeprom_query16(priv, EEPROM_RADIO_CONFIG); | 298 | radio_cfg = il_eeprom_query16(il, EEPROM_RADIO_CONFIG); |
299 | 299 | ||
300 | /* write radio config values to register */ | 300 | /* write radio config values to register */ |
301 | if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) == EEPROM_4965_RF_CFG_TYPE_MAX) | 301 | if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) == EEPROM_4965_RF_CFG_TYPE_MAX) |
302 | il_set_bit(priv, CSR_HW_IF_CONFIG_REG, | 302 | il_set_bit(il, CSR_HW_IF_CONFIG_REG, |
303 | EEPROM_RF_CFG_TYPE_MSK(radio_cfg) | | 303 | EEPROM_RF_CFG_TYPE_MSK(radio_cfg) | |
304 | EEPROM_RF_CFG_STEP_MSK(radio_cfg) | | 304 | EEPROM_RF_CFG_STEP_MSK(radio_cfg) | |
305 | EEPROM_RF_CFG_DASH_MSK(radio_cfg)); | 305 | EEPROM_RF_CFG_DASH_MSK(radio_cfg)); |
306 | 306 | ||
307 | /* set CSR_HW_CONFIG_REG for uCode use */ | 307 | /* set CSR_HW_CONFIG_REG for uCode use */ |
308 | il_set_bit(priv, CSR_HW_IF_CONFIG_REG, | 308 | il_set_bit(il, CSR_HW_IF_CONFIG_REG, |
309 | CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | | 309 | CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | |
310 | CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); | 310 | CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); |
311 | 311 | ||
312 | priv->calib_info = (struct il_eeprom_calib_info *) | 312 | il->calib_info = (struct il_eeprom_calib_info *) |
313 | il_eeprom_query_addr(priv, | 313 | il_eeprom_query_addr(il, |
314 | EEPROM_4965_CALIB_TXPOWER_OFFSET); | 314 | EEPROM_4965_CALIB_TXPOWER_OFFSET); |
315 | 315 | ||
316 | spin_unlock_irqrestore(&priv->lock, flags); | 316 | spin_unlock_irqrestore(&il->lock, flags); |
317 | } | 317 | } |
318 | 318 | ||
319 | /* Reset differential Rx gains in NIC to prepare for chain noise calibration. | 319 | /* Reset differential Rx gains in NIC to prepare for chain noise calibration. |
320 | * Called after every association, but this runs only once! | 320 | * Called after every association, but this runs only once! |
321 | * ... once chain noise is calibrated the first time, it's good forever. */ | 321 | * ... once chain noise is calibrated the first time, it's good forever. */ |
322 | static void il4965_chain_noise_reset(struct il_priv *priv) | 322 | static void il4965_chain_noise_reset(struct il_priv *il) |
323 | { | 323 | { |
324 | struct il_chain_noise_data *data = &(priv->chain_noise_data); | 324 | struct il_chain_noise_data *data = &(il->chain_noise_data); |
325 | 325 | ||
326 | if ((data->state == IL_CHAIN_NOISE_ALIVE) && | 326 | if ((data->state == IL_CHAIN_NOISE_ALIVE) && |
327 | il_is_any_associated(priv)) { | 327 | il_is_any_associated(il)) { |
328 | struct il_calib_diff_gain_cmd cmd; | 328 | struct il_calib_diff_gain_cmd cmd; |
329 | 329 | ||
330 | /* clear data for chain noise calibration algorithm */ | 330 | /* clear data for chain noise calibration algorithm */ |
@@ -341,12 +341,12 @@ static void il4965_chain_noise_reset(struct il_priv *priv) | |||
341 | cmd.diff_gain_a = 0; | 341 | cmd.diff_gain_a = 0; |
342 | cmd.diff_gain_b = 0; | 342 | cmd.diff_gain_b = 0; |
343 | cmd.diff_gain_c = 0; | 343 | cmd.diff_gain_c = 0; |
344 | if (il_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, | 344 | if (il_send_cmd_pdu(il, REPLY_PHY_CALIBRATION_CMD, |
345 | sizeof(cmd), &cmd)) | 345 | sizeof(cmd), &cmd)) |
346 | IL_ERR(priv, | 346 | IL_ERR(il, |
347 | "Could not send REPLY_PHY_CALIBRATION_CMD\n"); | 347 | "Could not send REPLY_PHY_CALIBRATION_CMD\n"); |
348 | data->state = IL_CHAIN_NOISE_ACCUMULATE; | 348 | data->state = IL_CHAIN_NOISE_ACCUMULATE; |
349 | IL_DEBUG_CALIB(priv, "Run chain_noise_calibrate\n"); | 349 | IL_DEBUG_CALIB(il, "Run chain_noise_calibrate\n"); |
350 | } | 350 | } |
351 | } | 351 | } |
352 | 352 | ||
@@ -377,10 +377,10 @@ static struct il_sensitivity_ranges il4965_sensitivity = { | |||
377 | .nrg_th_cca = 62, | 377 | .nrg_th_cca = 62, |
378 | }; | 378 | }; |
379 | 379 | ||
380 | static void il4965_set_ct_threshold(struct il_priv *priv) | 380 | static void il4965_set_ct_threshold(struct il_priv *il) |
381 | { | 381 | { |
382 | /* want Kelvin */ | 382 | /* want Kelvin */ |
383 | priv->hw_params.ct_kill_threshold = | 383 | il->hw_params.ct_kill_threshold = |
384 | CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD_LEGACY); | 384 | CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD_LEGACY); |
385 | } | 385 | } |
386 | 386 | ||
@@ -389,37 +389,37 @@ static void il4965_set_ct_threshold(struct il_priv *priv) | |||
389 | * | 389 | * |
390 | * Called when initializing driver | 390 | * Called when initializing driver |
391 | */ | 391 | */ |
392 | static int il4965_hw_set_hw_params(struct il_priv *priv) | 392 | static int il4965_hw_set_hw_params(struct il_priv *il) |
393 | { | 393 | { |
394 | if (priv->cfg->mod_params->num_of_queues >= IL_MIN_NUM_QUEUES && | 394 | if (il->cfg->mod_params->num_of_queues >= IL_MIN_NUM_QUEUES && |
395 | priv->cfg->mod_params->num_of_queues <= IWL49_NUM_QUEUES) | 395 | il->cfg->mod_params->num_of_queues <= IWL49_NUM_QUEUES) |
396 | priv->cfg->base_params->num_of_queues = | 396 | il->cfg->base_params->num_of_queues = |
397 | priv->cfg->mod_params->num_of_queues; | 397 | il->cfg->mod_params->num_of_queues; |
398 | 398 | ||
399 | priv->hw_params.max_txq_num = priv->cfg->base_params->num_of_queues; | 399 | il->hw_params.max_txq_num = il->cfg->base_params->num_of_queues; |
400 | priv->hw_params.dma_chnl_num = FH49_TCSR_CHNL_NUM; | 400 | il->hw_params.dma_chnl_num = FH49_TCSR_CHNL_NUM; |
401 | priv->hw_params.scd_bc_tbls_size = | 401 | il->hw_params.scd_bc_tbls_size = |
402 | priv->cfg->base_params->num_of_queues * | 402 | il->cfg->base_params->num_of_queues * |
403 | sizeof(struct il4965_scd_bc_tbl); | 403 | sizeof(struct il4965_scd_bc_tbl); |
404 | priv->hw_params.tfd_size = sizeof(struct il_tfd); | 404 | il->hw_params.tfd_size = sizeof(struct il_tfd); |
405 | priv->hw_params.max_stations = IWL4965_STATION_COUNT; | 405 | il->hw_params.max_stations = IWL4965_STATION_COUNT; |
406 | priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id = IWL4965_BROADCAST_ID; | 406 | il->contexts[IL_RXON_CTX_BSS].bcast_sta_id = IWL4965_BROADCAST_ID; |
407 | priv->hw_params.max_data_size = IWL49_RTC_DATA_SIZE; | 407 | il->hw_params.max_data_size = IWL49_RTC_DATA_SIZE; |
408 | priv->hw_params.max_inst_size = IWL49_RTC_INST_SIZE; | 408 | il->hw_params.max_inst_size = IWL49_RTC_INST_SIZE; |
409 | priv->hw_params.max_bsm_size = BSM_SRAM_SIZE; | 409 | il->hw_params.max_bsm_size = BSM_SRAM_SIZE; |
410 | priv->hw_params.ht40_channel = BIT(IEEE80211_BAND_5GHZ); | 410 | il->hw_params.ht40_channel = BIT(IEEE80211_BAND_5GHZ); |
411 | 411 | ||
412 | priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR; | 412 | il->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR; |
413 | 413 | ||
414 | priv->hw_params.tx_chains_num = il4965_num_of_ant(priv->cfg->valid_tx_ant); | 414 | il->hw_params.tx_chains_num = il4965_num_of_ant(il->cfg->valid_tx_ant); |
415 | priv->hw_params.rx_chains_num = il4965_num_of_ant(priv->cfg->valid_rx_ant); | 415 | il->hw_params.rx_chains_num = il4965_num_of_ant(il->cfg->valid_rx_ant); |
416 | priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant; | 416 | il->hw_params.valid_tx_ant = il->cfg->valid_tx_ant; |
417 | priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant; | 417 | il->hw_params.valid_rx_ant = il->cfg->valid_rx_ant; |
418 | 418 | ||
419 | il4965_set_ct_threshold(priv); | 419 | il4965_set_ct_threshold(il); |
420 | 420 | ||
421 | priv->hw_params.sens = &il4965_sensitivity; | 421 | il->hw_params.sens = &il4965_sensitivity; |
422 | priv->hw_params.beacon_time_tsf_bits = IWL4965_EXT_BEACON_TIME_POS; | 422 | il->hw_params.beacon_time_tsf_bits = IWL4965_EXT_BEACON_TIME_POS; |
423 | 423 | ||
424 | return 0; | 424 | return 0; |
425 | } | 425 | } |
@@ -498,16 +498,16 @@ static s32 il4965_get_tx_atten_grp(u16 channel) | |||
498 | return -EINVAL; | 498 | return -EINVAL; |
499 | } | 499 | } |
500 | 500 | ||
501 | static u32 il4965_get_sub_band(const struct il_priv *priv, u32 channel) | 501 | static u32 il4965_get_sub_band(const struct il_priv *il, u32 channel) |
502 | { | 502 | { |
503 | s32 b = -1; | 503 | s32 b = -1; |
504 | 504 | ||
505 | for (b = 0; b < EEPROM_TX_POWER_BANDS; b++) { | 505 | for (b = 0; b < EEPROM_TX_POWER_BANDS; b++) { |
506 | if (priv->calib_info->band_info[b].ch_from == 0) | 506 | if (il->calib_info->band_info[b].ch_from == 0) |
507 | continue; | 507 | continue; |
508 | 508 | ||
509 | if ((channel >= priv->calib_info->band_info[b].ch_from) | 509 | if ((channel >= il->calib_info->band_info[b].ch_from) |
510 | && (channel <= priv->calib_info->band_info[b].ch_to)) | 510 | && (channel <= il->calib_info->band_info[b].ch_to)) |
511 | break; | 511 | break; |
512 | } | 512 | } |
513 | 513 | ||
@@ -534,7 +534,7 @@ static s32 il4965_interpolate_value(s32 x, s32 x1, s32 y1, s32 x2, s32 y2) | |||
534 | * differences in channel frequencies, which is proportional to differences | 534 | * differences in channel frequencies, which is proportional to differences |
535 | * in channel number. | 535 | * in channel number. |
536 | */ | 536 | */ |
537 | static int il4965_interpolate_chan(struct il_priv *priv, u32 channel, | 537 | static int il4965_interpolate_chan(struct il_priv *il, u32 channel, |
538 | struct il_eeprom_calib_ch_info *chan_info) | 538 | struct il_eeprom_calib_ch_info *chan_info) |
539 | { | 539 | { |
540 | s32 s = -1; | 540 | s32 s = -1; |
@@ -546,24 +546,24 @@ static int il4965_interpolate_chan(struct il_priv *priv, u32 channel, | |||
546 | u32 ch_i1; | 546 | u32 ch_i1; |
547 | u32 ch_i2; | 547 | u32 ch_i2; |
548 | 548 | ||
549 | s = il4965_get_sub_band(priv, channel); | 549 | s = il4965_get_sub_band(il, channel); |
550 | if (s >= EEPROM_TX_POWER_BANDS) { | 550 | if (s >= EEPROM_TX_POWER_BANDS) { |
551 | IL_ERR(priv, "Tx Power can not find channel %d\n", channel); | 551 | IL_ERR(il, "Tx Power can not find channel %d\n", channel); |
552 | return -1; | 552 | return -1; |
553 | } | 553 | } |
554 | 554 | ||
555 | ch_i1 = priv->calib_info->band_info[s].ch1.ch_num; | 555 | ch_i1 = il->calib_info->band_info[s].ch1.ch_num; |
556 | ch_i2 = priv->calib_info->band_info[s].ch2.ch_num; | 556 | ch_i2 = il->calib_info->band_info[s].ch2.ch_num; |
557 | chan_info->ch_num = (u8) channel; | 557 | chan_info->ch_num = (u8) channel; |
558 | 558 | ||
559 | IL_DEBUG_TXPOWER(priv, "channel %d subband %d factory cal ch %d & %d\n", | 559 | IL_DEBUG_TXPOWER(il, "channel %d subband %d factory cal ch %d & %d\n", |
560 | channel, s, ch_i1, ch_i2); | 560 | channel, s, ch_i1, ch_i2); |
561 | 561 | ||
562 | for (c = 0; c < EEPROM_TX_POWER_TX_CHAINS; c++) { | 562 | for (c = 0; c < EEPROM_TX_POWER_TX_CHAINS; c++) { |
563 | for (m = 0; m < EEPROM_TX_POWER_MEASUREMENTS; m++) { | 563 | for (m = 0; m < EEPROM_TX_POWER_MEASUREMENTS; m++) { |
564 | m1 = &(priv->calib_info->band_info[s].ch1. | 564 | m1 = &(il->calib_info->band_info[s].ch1. |
565 | measurements[c][m]); | 565 | measurements[c][m]); |
566 | m2 = &(priv->calib_info->band_info[s].ch2. | 566 | m2 = &(il->calib_info->band_info[s].ch2. |
567 | measurements[c][m]); | 567 | measurements[c][m]); |
568 | omeas = &(chan_info->measurements[c][m]); | 568 | omeas = &(chan_info->measurements[c][m]); |
569 | 569 | ||
@@ -586,16 +586,16 @@ static int il4965_interpolate_chan(struct il_priv *priv, u32 channel, | |||
586 | m1->pa_det, ch_i2, | 586 | m1->pa_det, ch_i2, |
587 | m2->pa_det); | 587 | m2->pa_det); |
588 | 588 | ||
589 | IL_DEBUG_TXPOWER(priv, | 589 | IL_DEBUG_TXPOWER(il, |
590 | "chain %d meas %d AP1=%d AP2=%d AP=%d\n", c, m, | 590 | "chain %d meas %d AP1=%d AP2=%d AP=%d\n", c, m, |
591 | m1->actual_pow, m2->actual_pow, omeas->actual_pow); | 591 | m1->actual_pow, m2->actual_pow, omeas->actual_pow); |
592 | IL_DEBUG_TXPOWER(priv, | 592 | IL_DEBUG_TXPOWER(il, |
593 | "chain %d meas %d NI1=%d NI2=%d NI=%d\n", c, m, | 593 | "chain %d meas %d NI1=%d NI2=%d NI=%d\n", c, m, |
594 | m1->gain_idx, m2->gain_idx, omeas->gain_idx); | 594 | m1->gain_idx, m2->gain_idx, omeas->gain_idx); |
595 | IL_DEBUG_TXPOWER(priv, | 595 | IL_DEBUG_TXPOWER(il, |
596 | "chain %d meas %d PA1=%d PA2=%d PA=%d\n", c, m, | 596 | "chain %d meas %d PA1=%d PA2=%d PA=%d\n", c, m, |
597 | m1->pa_det, m2->pa_det, omeas->pa_det); | 597 | m1->pa_det, m2->pa_det, omeas->pa_det); |
598 | IL_DEBUG_TXPOWER(priv, | 598 | IL_DEBUG_TXPOWER(il, |
599 | "chain %d meas %d T1=%d T2=%d T=%d\n", c, m, | 599 | "chain %d meas %d T1=%d T2=%d T=%d\n", c, m, |
600 | m1->temperature, m2->temperature, | 600 | m1->temperature, m2->temperature, |
601 | omeas->temperature); | 601 | omeas->temperature); |
@@ -867,7 +867,7 @@ static const struct gain_entry gain_table[2][108] = { | |||
867 | } | 867 | } |
868 | }; | 868 | }; |
869 | 869 | ||
870 | static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, | 870 | static int il4965_fill_txpower_tbl(struct il_priv *il, u8 band, u16 channel, |
871 | u8 is_ht40, u8 ctrl_chan_high, | 871 | u8 is_ht40, u8 ctrl_chan_high, |
872 | struct il4965_tx_power_db *tx_power_tbl) | 872 | struct il4965_tx_power_db *tx_power_tbl) |
873 | { | 873 | { |
@@ -897,13 +897,13 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, | |||
897 | 897 | ||
898 | /* tx_power_user_lmt is in dBm, convert to half-dBm (half-dB units | 898 | /* tx_power_user_lmt is in dBm, convert to half-dBm (half-dB units |
899 | * are used for indexing into txpower table) */ | 899 | * are used for indexing into txpower table) */ |
900 | user_target_power = 2 * priv->tx_power_user_lmt; | 900 | user_target_power = 2 * il->tx_power_user_lmt; |
901 | 901 | ||
902 | /* Get current (RXON) channel, band, width */ | 902 | /* Get current (RXON) channel, band, width */ |
903 | IL_DEBUG_TXPOWER(priv, "chan %d band %d is_ht40 %d\n", channel, band, | 903 | IL_DEBUG_TXPOWER(il, "chan %d band %d is_ht40 %d\n", channel, band, |
904 | is_ht40); | 904 | is_ht40); |
905 | 905 | ||
906 | ch_info = il_get_channel_info(priv, priv->band, channel); | 906 | ch_info = il_get_channel_info(il, il->band, channel); |
907 | 907 | ||
908 | if (!il_is_channel_valid(ch_info)) | 908 | if (!il_is_channel_valid(ch_info)) |
909 | return -EINVAL; | 909 | return -EINVAL; |
@@ -912,12 +912,12 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, | |||
912 | * and 2) mimo txpower balance between Tx chains. */ | 912 | * and 2) mimo txpower balance between Tx chains. */ |
913 | txatten_grp = il4965_get_tx_atten_grp(channel); | 913 | txatten_grp = il4965_get_tx_atten_grp(channel); |
914 | if (txatten_grp < 0) { | 914 | if (txatten_grp < 0) { |
915 | IL_ERR(priv, "Can't find txatten group for channel %d.\n", | 915 | IL_ERR(il, "Can't find txatten group for channel %d.\n", |
916 | channel); | 916 | channel); |
917 | return txatten_grp; | 917 | return txatten_grp; |
918 | } | 918 | } |
919 | 919 | ||
920 | IL_DEBUG_TXPOWER(priv, "channel %d belongs to txatten group %d\n", | 920 | IL_DEBUG_TXPOWER(il, "channel %d belongs to txatten group %d\n", |
921 | channel, txatten_grp); | 921 | channel, txatten_grp); |
922 | 922 | ||
923 | if (is_ht40) { | 923 | if (is_ht40) { |
@@ -930,9 +930,9 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, | |||
930 | /* hardware txpower limits ... | 930 | /* hardware txpower limits ... |
931 | * saturation (clipping distortion) txpowers are in half-dBm */ | 931 | * saturation (clipping distortion) txpowers are in half-dBm */ |
932 | if (band) | 932 | if (band) |
933 | saturation_power = priv->calib_info->saturation_power24; | 933 | saturation_power = il->calib_info->saturation_power24; |
934 | else | 934 | else |
935 | saturation_power = priv->calib_info->saturation_power52; | 935 | saturation_power = il->calib_info->saturation_power52; |
936 | 936 | ||
937 | if (saturation_power < IL_TX_POWER_SATURATION_MIN || | 937 | if (saturation_power < IL_TX_POWER_SATURATION_MIN || |
938 | saturation_power > IL_TX_POWER_SATURATION_MAX) { | 938 | 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, | |||
959 | 959 | ||
960 | /* Interpolate txpower calibration values for this channel, | 960 | /* Interpolate txpower calibration values for this channel, |
961 | * based on factory calibration tests on spaced channels. */ | 961 | * based on factory calibration tests on spaced channels. */ |
962 | il4965_interpolate_chan(priv, channel, &ch_eeprom_info); | 962 | il4965_interpolate_chan(il, channel, &ch_eeprom_info); |
963 | 963 | ||
964 | /* calculate tx gain adjustment based on power supply voltage */ | 964 | /* calculate tx gain adjustment based on power supply voltage */ |
965 | voltage = le16_to_cpu(priv->calib_info->voltage); | 965 | voltage = le16_to_cpu(il->calib_info->voltage); |
966 | init_voltage = (s32)le32_to_cpu(priv->card_alive_init.voltage); | 966 | init_voltage = (s32)le32_to_cpu(il->card_alive_init.voltage); |
967 | voltage_compensation = | 967 | voltage_compensation = |
968 | il4965_get_voltage_compensation(voltage, init_voltage); | 968 | il4965_get_voltage_compensation(voltage, init_voltage); |
969 | 969 | ||
970 | IL_DEBUG_TXPOWER(priv, "curr volt %d eeprom volt %d volt comp %d\n", | 970 | IL_DEBUG_TXPOWER(il, "curr volt %d eeprom volt %d volt comp %d\n", |
971 | init_voltage, | 971 | init_voltage, |
972 | voltage, voltage_compensation); | 972 | voltage, voltage_compensation); |
973 | 973 | ||
974 | /* get current temperature (Celsius) */ | 974 | /* get current temperature (Celsius) */ |
975 | current_temp = max(priv->temperature, IL_TX_POWER_TEMPERATURE_MIN); | 975 | current_temp = max(il->temperature, IL_TX_POWER_TEMPERATURE_MIN); |
976 | current_temp = min(priv->temperature, IL_TX_POWER_TEMPERATURE_MAX); | 976 | current_temp = min(il->temperature, IL_TX_POWER_TEMPERATURE_MAX); |
977 | current_temp = KELVIN_TO_CELSIUS(current_temp); | 977 | current_temp = KELVIN_TO_CELSIUS(current_temp); |
978 | 978 | ||
979 | /* select thermal txpower adjustment params, based on channel group | 979 | /* select thermal txpower adjustment params, based on channel group |
@@ -998,13 +998,13 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, | |||
998 | factory_gain_index[c] = measurement->gain_idx; | 998 | factory_gain_index[c] = measurement->gain_idx; |
999 | factory_actual_pwr[c] = measurement->actual_pow; | 999 | factory_actual_pwr[c] = measurement->actual_pow; |
1000 | 1000 | ||
1001 | IL_DEBUG_TXPOWER(priv, "chain = %d\n", c); | 1001 | IL_DEBUG_TXPOWER(il, "chain = %d\n", c); |
1002 | IL_DEBUG_TXPOWER(priv, "fctry tmp %d, " | 1002 | IL_DEBUG_TXPOWER(il, "fctry tmp %d, " |
1003 | "curr tmp %d, comp %d steps\n", | 1003 | "curr tmp %d, comp %d steps\n", |
1004 | factory_temp, current_temp, | 1004 | factory_temp, current_temp, |
1005 | temperature_comp[c]); | 1005 | temperature_comp[c]); |
1006 | 1006 | ||
1007 | IL_DEBUG_TXPOWER(priv, "fctry idx %d, fctry pwr %d\n", | 1007 | IL_DEBUG_TXPOWER(il, "fctry idx %d, fctry pwr %d\n", |
1008 | factory_gain_index[c], | 1008 | factory_gain_index[c], |
1009 | factory_actual_pwr[c]); | 1009 | factory_actual_pwr[c]); |
1010 | } | 1010 | } |
@@ -1037,7 +1037,7 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, | |||
1037 | if (target_power > power_limit) | 1037 | if (target_power > power_limit) |
1038 | target_power = power_limit; | 1038 | target_power = power_limit; |
1039 | 1039 | ||
1040 | IL_DEBUG_TXPOWER(priv, "rate %d sat %d reg %d usr %d tgt %d\n", | 1040 | IL_DEBUG_TXPOWER(il, "rate %d sat %d reg %d usr %d tgt %d\n", |
1041 | i, saturation_power - back_off_table[i], | 1041 | i, saturation_power - back_off_table[i], |
1042 | current_regulatory, user_target_power, | 1042 | current_regulatory, user_target_power, |
1043 | target_power); | 1043 | target_power); |
@@ -1048,7 +1048,7 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, | |||
1048 | 1048 | ||
1049 | if (is_mimo_rate) | 1049 | if (is_mimo_rate) |
1050 | atten_value = | 1050 | atten_value = |
1051 | (s32)le32_to_cpu(priv->card_alive_init. | 1051 | (s32)le32_to_cpu(il->card_alive_init. |
1052 | tx_atten[txatten_grp][c]); | 1052 | tx_atten[txatten_grp][c]); |
1053 | else | 1053 | else |
1054 | atten_value = 0; | 1054 | atten_value = 0; |
@@ -1061,7 +1061,7 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, | |||
1061 | voltage_compensation + | 1061 | voltage_compensation + |
1062 | atten_value); | 1062 | atten_value); |
1063 | 1063 | ||
1064 | /* IL_DEBUG_TXPOWER(priv, "calculated txpower index %d\n", | 1064 | /* IL_DEBUG_TXPOWER(il, "calculated txpower index %d\n", |
1065 | power_index); */ | 1065 | power_index); */ |
1066 | 1066 | ||
1067 | if (power_index < get_min_power_index(i, band)) | 1067 | if (power_index < get_min_power_index(i, band)) |
@@ -1078,12 +1078,12 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, | |||
1078 | 1078 | ||
1079 | /* stay within the table! */ | 1079 | /* stay within the table! */ |
1080 | if (power_index > 107) { | 1080 | if (power_index > 107) { |
1081 | IL_WARN(priv, "txpower index %d > 107\n", | 1081 | IL_WARN(il, "txpower index %d > 107\n", |
1082 | power_index); | 1082 | power_index); |
1083 | power_index = 107; | 1083 | power_index = 107; |
1084 | } | 1084 | } |
1085 | if (power_index < 0) { | 1085 | if (power_index < 0) { |
1086 | IL_WARN(priv, "txpower index %d < 0\n", | 1086 | IL_WARN(il, "txpower index %d < 0\n", |
1087 | power_index); | 1087 | power_index); |
1088 | power_index = 0; | 1088 | power_index = 0; |
1089 | } | 1089 | } |
@@ -1094,7 +1094,7 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, | |||
1094 | tx_power.s.dsp_predis_atten[c] = | 1094 | tx_power.s.dsp_predis_atten[c] = |
1095 | gain_table[band][power_index].dsp; | 1095 | gain_table[band][power_index].dsp; |
1096 | 1096 | ||
1097 | IL_DEBUG_TXPOWER(priv, "chain %d mimo %d index %d " | 1097 | IL_DEBUG_TXPOWER(il, "chain %d mimo %d index %d " |
1098 | "gain 0x%02x dsp %d\n", | 1098 | "gain 0x%02x dsp %d\n", |
1099 | c, atten_value, power_index, | 1099 | c, atten_value, power_index, |
1100 | tx_power.s.radio_tx_gain[c], | 1100 | tx_power.s.radio_tx_gain[c], |
@@ -1112,22 +1112,22 @@ static int il4965_fill_txpower_tbl(struct il_priv *priv, u8 band, u16 channel, | |||
1112 | * il4965_send_tx_power - Configure the TXPOWER level user limit | 1112 | * il4965_send_tx_power - Configure the TXPOWER level user limit |
1113 | * | 1113 | * |
1114 | * Uses the active RXON for channel, band, and characteristics (ht40, high) | 1114 | * Uses the active RXON for channel, band, and characteristics (ht40, high) |
1115 | * The power limit is taken from priv->tx_power_user_lmt. | 1115 | * The power limit is taken from il->tx_power_user_lmt. |
1116 | */ | 1116 | */ |
1117 | static int il4965_send_tx_power(struct il_priv *priv) | 1117 | static int il4965_send_tx_power(struct il_priv *il) |
1118 | { | 1118 | { |
1119 | struct il4965_txpowertable_cmd cmd = { 0 }; | 1119 | struct il4965_txpowertable_cmd cmd = { 0 }; |
1120 | int ret; | 1120 | int ret; |
1121 | u8 band = 0; | 1121 | u8 band = 0; |
1122 | bool is_ht40 = false; | 1122 | bool is_ht40 = false; |
1123 | u8 ctrl_chan_high = 0; | 1123 | u8 ctrl_chan_high = 0; |
1124 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 1124 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
1125 | 1125 | ||
1126 | if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &priv->status), | 1126 | if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &il->status), |
1127 | "TX Power requested while scanning!\n")) | 1127 | "TX Power requested while scanning!\n")) |
1128 | return -EAGAIN; | 1128 | return -EAGAIN; |
1129 | 1129 | ||
1130 | band = priv->band == IEEE80211_BAND_2GHZ; | 1130 | band = il->band == IEEE80211_BAND_2GHZ; |
1131 | 1131 | ||
1132 | is_ht40 = iw4965_is_ht40_channel(ctx->active.flags); | 1132 | is_ht40 = iw4965_is_ht40_channel(ctx->active.flags); |
1133 | 1133 | ||
@@ -1137,20 +1137,20 @@ static int il4965_send_tx_power(struct il_priv *priv) | |||
1137 | cmd.band = band; | 1137 | cmd.band = band; |
1138 | cmd.channel = ctx->active.channel; | 1138 | cmd.channel = ctx->active.channel; |
1139 | 1139 | ||
1140 | ret = il4965_fill_txpower_tbl(priv, band, | 1140 | ret = il4965_fill_txpower_tbl(il, band, |
1141 | le16_to_cpu(ctx->active.channel), | 1141 | le16_to_cpu(ctx->active.channel), |
1142 | is_ht40, ctrl_chan_high, &cmd.tx_power); | 1142 | is_ht40, ctrl_chan_high, &cmd.tx_power); |
1143 | if (ret) | 1143 | if (ret) |
1144 | goto out; | 1144 | goto out; |
1145 | 1145 | ||
1146 | ret = il_send_cmd_pdu(priv, | 1146 | ret = il_send_cmd_pdu(il, |
1147 | REPLY_TX_PWR_TABLE_CMD, sizeof(cmd), &cmd); | 1147 | REPLY_TX_PWR_TABLE_CMD, sizeof(cmd), &cmd); |
1148 | 1148 | ||
1149 | out: | 1149 | out: |
1150 | return ret; | 1150 | return ret; |
1151 | } | 1151 | } |
1152 | 1152 | ||
1153 | static int il4965_send_rxon_assoc(struct il_priv *priv, | 1153 | static int il4965_send_rxon_assoc(struct il_priv *il, |
1154 | struct il_rxon_context *ctx) | 1154 | struct il_rxon_context *ctx) |
1155 | { | 1155 | { |
1156 | int ret = 0; | 1156 | int ret = 0; |
@@ -1167,7 +1167,7 @@ static int il4965_send_rxon_assoc(struct il_priv *priv, | |||
1167 | rxon2->ofdm_ht_dual_stream_basic_rates) && | 1167 | rxon2->ofdm_ht_dual_stream_basic_rates) && |
1168 | (rxon1->rx_chain == rxon2->rx_chain) && | 1168 | (rxon1->rx_chain == rxon2->rx_chain) && |
1169 | (rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates)) { | 1169 | (rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates)) { |
1170 | IL_DEBUG_INFO(priv, "Using current RXON_ASSOC. Not resending.\n"); | 1170 | IL_DEBUG_INFO(il, "Using current RXON_ASSOC. Not resending.\n"); |
1171 | return 0; | 1171 | return 0; |
1172 | } | 1172 | } |
1173 | 1173 | ||
@@ -1182,13 +1182,13 @@ static int il4965_send_rxon_assoc(struct il_priv *priv, | |||
1182 | ctx->staging.ofdm_ht_dual_stream_basic_rates; | 1182 | ctx->staging.ofdm_ht_dual_stream_basic_rates; |
1183 | rxon_assoc.rx_chain_select_flags = ctx->staging.rx_chain; | 1183 | rxon_assoc.rx_chain_select_flags = ctx->staging.rx_chain; |
1184 | 1184 | ||
1185 | ret = il_send_cmd_pdu_async(priv, REPLY_RXON_ASSOC, | 1185 | ret = il_send_cmd_pdu_async(il, REPLY_RXON_ASSOC, |
1186 | sizeof(rxon_assoc), &rxon_assoc, NULL); | 1186 | sizeof(rxon_assoc), &rxon_assoc, NULL); |
1187 | 1187 | ||
1188 | return ret; | 1188 | return ret; |
1189 | } | 1189 | } |
1190 | 1190 | ||
1191 | static int il4965_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) | 1191 | static int il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx) |
1192 | { | 1192 | { |
1193 | /* cast away the const for active_rxon in this function */ | 1193 | /* cast away the const for active_rxon in this function */ |
1194 | struct il_rxon_cmd *active_rxon = (void *)&ctx->active; | 1194 | 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) | |||
1196 | bool new_assoc = | 1196 | bool new_assoc = |
1197 | !!(ctx->staging.filter_flags & RXON_FILTER_ASSOC_MSK); | 1197 | !!(ctx->staging.filter_flags & RXON_FILTER_ASSOC_MSK); |
1198 | 1198 | ||
1199 | if (!il_is_alive(priv)) | 1199 | if (!il_is_alive(il)) |
1200 | return -EBUSY; | 1200 | return -EBUSY; |
1201 | 1201 | ||
1202 | if (!ctx->is_active) | 1202 | if (!ctx->is_active) |
@@ -1205,9 +1205,9 @@ static int il4965_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) | |||
1205 | /* always get timestamp with Rx frame */ | 1205 | /* always get timestamp with Rx frame */ |
1206 | ctx->staging.flags |= RXON_FLG_TSF2HOST_MSK; | 1206 | ctx->staging.flags |= RXON_FLG_TSF2HOST_MSK; |
1207 | 1207 | ||
1208 | ret = il_check_rxon_cmd(priv, ctx); | 1208 | ret = il_check_rxon_cmd(il, ctx); |
1209 | if (ret) { | 1209 | if (ret) { |
1210 | IL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); | 1210 | IL_ERR(il, "Invalid RXON configuration. Not committing.\n"); |
1211 | return -EINVAL; | 1211 | return -EINVAL; |
1212 | } | 1212 | } |
1213 | 1213 | ||
@@ -1215,30 +1215,30 @@ static int il4965_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) | |||
1215 | * receive commit_rxon request | 1215 | * receive commit_rxon request |
1216 | * abort any previous channel switch if still in process | 1216 | * abort any previous channel switch if still in process |
1217 | */ | 1217 | */ |
1218 | if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status) && | 1218 | if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &il->status) && |
1219 | (priv->switch_channel != ctx->staging.channel)) { | 1219 | (il->switch_channel != ctx->staging.channel)) { |
1220 | IL_DEBUG_11H(priv, "abort channel switch on %d\n", | 1220 | IL_DEBUG_11H(il, "abort channel switch on %d\n", |
1221 | le16_to_cpu(priv->switch_channel)); | 1221 | le16_to_cpu(il->switch_channel)); |
1222 | il_chswitch_done(priv, false); | 1222 | il_chswitch_done(il, false); |
1223 | } | 1223 | } |
1224 | 1224 | ||
1225 | /* If we don't need to send a full RXON, we can use | 1225 | /* If we don't need to send a full RXON, we can use |
1226 | * il_rxon_assoc_cmd which is used to reconfigure filter | 1226 | * il_rxon_assoc_cmd which is used to reconfigure filter |
1227 | * and other flags for the current radio configuration. */ | 1227 | * and other flags for the current radio configuration. */ |
1228 | if (!il_full_rxon_required(priv, ctx)) { | 1228 | if (!il_full_rxon_required(il, ctx)) { |
1229 | ret = il_send_rxon_assoc(priv, ctx); | 1229 | ret = il_send_rxon_assoc(il, ctx); |
1230 | if (ret) { | 1230 | if (ret) { |
1231 | IL_ERR(priv, "Error setting RXON_ASSOC (%d)\n", ret); | 1231 | IL_ERR(il, "Error setting RXON_ASSOC (%d)\n", ret); |
1232 | return ret; | 1232 | return ret; |
1233 | } | 1233 | } |
1234 | 1234 | ||
1235 | memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); | 1235 | memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); |
1236 | il_print_rx_config_cmd(priv, ctx); | 1236 | il_print_rx_config_cmd(il, ctx); |
1237 | /* | 1237 | /* |
1238 | * We do not commit tx power settings while channel changing, | 1238 | * We do not commit tx power settings while channel changing, |
1239 | * do it now if tx power changed. | 1239 | * do it now if tx power changed. |
1240 | */ | 1240 | */ |
1241 | il_set_tx_power(priv, priv->tx_power_next, false); | 1241 | il_set_tx_power(il, il->tx_power_next, false); |
1242 | return 0; | 1242 | return 0; |
1243 | } | 1243 | } |
1244 | 1244 | ||
@@ -1247,10 +1247,10 @@ static int il4965_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) | |||
1247 | * we must clear the associated from the active configuration | 1247 | * we must clear the associated from the active configuration |
1248 | * before we apply the new config */ | 1248 | * before we apply the new config */ |
1249 | if (il_is_associated_ctx(ctx) && new_assoc) { | 1249 | if (il_is_associated_ctx(ctx) && new_assoc) { |
1250 | IL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n"); | 1250 | IL_DEBUG_INFO(il, "Toggling associated bit on current RXON\n"); |
1251 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 1251 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
1252 | 1252 | ||
1253 | ret = il_send_cmd_pdu(priv, ctx->rxon_cmd, | 1253 | ret = il_send_cmd_pdu(il, ctx->rxon_cmd, |
1254 | sizeof(struct il_rxon_cmd), | 1254 | sizeof(struct il_rxon_cmd), |
1255 | active_rxon); | 1255 | active_rxon); |
1256 | 1256 | ||
@@ -1258,19 +1258,19 @@ static int il4965_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) | |||
1258 | * active_rxon back to what it was previously */ | 1258 | * active_rxon back to what it was previously */ |
1259 | if (ret) { | 1259 | if (ret) { |
1260 | active_rxon->filter_flags |= RXON_FILTER_ASSOC_MSK; | 1260 | active_rxon->filter_flags |= RXON_FILTER_ASSOC_MSK; |
1261 | IL_ERR(priv, "Error clearing ASSOC_MSK (%d)\n", ret); | 1261 | IL_ERR(il, "Error clearing ASSOC_MSK (%d)\n", ret); |
1262 | return ret; | 1262 | return ret; |
1263 | } | 1263 | } |
1264 | il_clear_ucode_stations(priv, ctx); | 1264 | il_clear_ucode_stations(il, ctx); |
1265 | il_restore_stations(priv, ctx); | 1265 | il_restore_stations(il, ctx); |
1266 | ret = il4965_restore_default_wep_keys(priv, ctx); | 1266 | ret = il4965_restore_default_wep_keys(il, ctx); |
1267 | if (ret) { | 1267 | if (ret) { |
1268 | IL_ERR(priv, "Failed to restore WEP keys (%d)\n", ret); | 1268 | IL_ERR(il, "Failed to restore WEP keys (%d)\n", ret); |
1269 | return ret; | 1269 | return ret; |
1270 | } | 1270 | } |
1271 | } | 1271 | } |
1272 | 1272 | ||
1273 | IL_DEBUG_INFO(priv, "Sending RXON\n" | 1273 | IL_DEBUG_INFO(il, "Sending RXON\n" |
1274 | "* with%s RXON_FILTER_ASSOC_MSK\n" | 1274 | "* with%s RXON_FILTER_ASSOC_MSK\n" |
1275 | "* channel = %d\n" | 1275 | "* channel = %d\n" |
1276 | "* bssid = %pM\n", | 1276 | "* bssid = %pM\n", |
@@ -1278,62 +1278,62 @@ static int il4965_commit_rxon(struct il_priv *priv, struct il_rxon_context *ctx) | |||
1278 | le16_to_cpu(ctx->staging.channel), | 1278 | le16_to_cpu(ctx->staging.channel), |
1279 | ctx->staging.bssid_addr); | 1279 | ctx->staging.bssid_addr); |
1280 | 1280 | ||
1281 | il_set_rxon_hwcrypto(priv, ctx, | 1281 | il_set_rxon_hwcrypto(il, ctx, |
1282 | !priv->cfg->mod_params->sw_crypto); | 1282 | !il->cfg->mod_params->sw_crypto); |
1283 | 1283 | ||
1284 | /* Apply the new configuration | 1284 | /* Apply the new configuration |
1285 | * RXON unassoc clears the station table in uCode so restoration of | 1285 | * RXON unassoc clears the station table in uCode so restoration of |
1286 | * stations is needed after it (the RXON command) completes | 1286 | * stations is needed after it (the RXON command) completes |
1287 | */ | 1287 | */ |
1288 | if (!new_assoc) { | 1288 | if (!new_assoc) { |
1289 | ret = il_send_cmd_pdu(priv, ctx->rxon_cmd, | 1289 | ret = il_send_cmd_pdu(il, ctx->rxon_cmd, |
1290 | sizeof(struct il_rxon_cmd), &ctx->staging); | 1290 | sizeof(struct il_rxon_cmd), &ctx->staging); |
1291 | if (ret) { | 1291 | if (ret) { |
1292 | IL_ERR(priv, "Error setting new RXON (%d)\n", ret); | 1292 | IL_ERR(il, "Error setting new RXON (%d)\n", ret); |
1293 | return ret; | 1293 | return ret; |
1294 | } | 1294 | } |
1295 | IL_DEBUG_INFO(priv, "Return from !new_assoc RXON.\n"); | 1295 | IL_DEBUG_INFO(il, "Return from !new_assoc RXON.\n"); |
1296 | memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); | 1296 | memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); |
1297 | il_clear_ucode_stations(priv, ctx); | 1297 | il_clear_ucode_stations(il, ctx); |
1298 | il_restore_stations(priv, ctx); | 1298 | il_restore_stations(il, ctx); |
1299 | ret = il4965_restore_default_wep_keys(priv, ctx); | 1299 | ret = il4965_restore_default_wep_keys(il, ctx); |
1300 | if (ret) { | 1300 | if (ret) { |
1301 | IL_ERR(priv, "Failed to restore WEP keys (%d)\n", ret); | 1301 | IL_ERR(il, "Failed to restore WEP keys (%d)\n", ret); |
1302 | return ret; | 1302 | return ret; |
1303 | } | 1303 | } |
1304 | } | 1304 | } |
1305 | if (new_assoc) { | 1305 | if (new_assoc) { |
1306 | priv->start_calib = 0; | 1306 | il->start_calib = 0; |
1307 | /* Apply the new configuration | 1307 | /* Apply the new configuration |
1308 | * RXON assoc doesn't clear the station table in uCode, | 1308 | * RXON assoc doesn't clear the station table in uCode, |
1309 | */ | 1309 | */ |
1310 | ret = il_send_cmd_pdu(priv, ctx->rxon_cmd, | 1310 | ret = il_send_cmd_pdu(il, ctx->rxon_cmd, |
1311 | sizeof(struct il_rxon_cmd), &ctx->staging); | 1311 | sizeof(struct il_rxon_cmd), &ctx->staging); |
1312 | if (ret) { | 1312 | if (ret) { |
1313 | IL_ERR(priv, "Error setting new RXON (%d)\n", ret); | 1313 | IL_ERR(il, "Error setting new RXON (%d)\n", ret); |
1314 | return ret; | 1314 | return ret; |
1315 | } | 1315 | } |
1316 | memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); | 1316 | memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); |
1317 | } | 1317 | } |
1318 | il_print_rx_config_cmd(priv, ctx); | 1318 | il_print_rx_config_cmd(il, ctx); |
1319 | 1319 | ||
1320 | il4965_init_sensitivity(priv); | 1320 | il4965_init_sensitivity(il); |
1321 | 1321 | ||
1322 | /* If we issue a new RXON command which required a tune then we must | 1322 | /* If we issue a new RXON command which required a tune then we must |
1323 | * send a new TXPOWER command or we won't be able to Tx any frames */ | 1323 | * send a new TXPOWER command or we won't be able to Tx any frames */ |
1324 | ret = il_set_tx_power(priv, priv->tx_power_next, true); | 1324 | ret = il_set_tx_power(il, il->tx_power_next, true); |
1325 | if (ret) { | 1325 | if (ret) { |
1326 | IL_ERR(priv, "Error sending TX power (%d)\n", ret); | 1326 | IL_ERR(il, "Error sending TX power (%d)\n", ret); |
1327 | return ret; | 1327 | return ret; |
1328 | } | 1328 | } |
1329 | 1329 | ||
1330 | return 0; | 1330 | return 0; |
1331 | } | 1331 | } |
1332 | 1332 | ||
1333 | static int il4965_hw_channel_switch(struct il_priv *priv, | 1333 | static int il4965_hw_channel_switch(struct il_priv *il, |
1334 | struct ieee80211_channel_switch *ch_switch) | 1334 | struct ieee80211_channel_switch *ch_switch) |
1335 | { | 1335 | { |
1336 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 1336 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
1337 | int rc; | 1337 | int rc; |
1338 | u8 band = 0; | 1338 | u8 band = 0; |
1339 | bool is_ht40 = false; | 1339 | bool is_ht40 = false; |
@@ -1346,7 +1346,7 @@ static int il4965_hw_channel_switch(struct il_priv *priv, | |||
1346 | u8 switch_count; | 1346 | u8 switch_count; |
1347 | u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval); | 1347 | u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval); |
1348 | struct ieee80211_vif *vif = ctx->vif; | 1348 | struct ieee80211_vif *vif = ctx->vif; |
1349 | band = priv->band == IEEE80211_BAND_2GHZ; | 1349 | band = il->band == IEEE80211_BAND_2GHZ; |
1350 | 1350 | ||
1351 | is_ht40 = iw4965_is_ht40_channel(ctx->staging.flags); | 1351 | is_ht40 = iw4965_is_ht40_channel(ctx->staging.flags); |
1352 | 1352 | ||
@@ -1366,57 +1366,57 @@ static int il4965_hw_channel_switch(struct il_priv *priv, | |||
1366 | * calculate the ucode channel switch time | 1366 | * calculate the ucode channel switch time |
1367 | * adding TSF as one of the factor for when to switch | 1367 | * adding TSF as one of the factor for when to switch |
1368 | */ | 1368 | */ |
1369 | if ((priv->ucode_beacon_time > tsf_low) && beacon_interval) { | 1369 | if ((il->ucode_beacon_time > tsf_low) && beacon_interval) { |
1370 | if (switch_count > ((priv->ucode_beacon_time - tsf_low) / | 1370 | if (switch_count > ((il->ucode_beacon_time - tsf_low) / |
1371 | beacon_interval)) { | 1371 | beacon_interval)) { |
1372 | switch_count -= (priv->ucode_beacon_time - | 1372 | switch_count -= (il->ucode_beacon_time - |
1373 | tsf_low) / beacon_interval; | 1373 | tsf_low) / beacon_interval; |
1374 | } else | 1374 | } else |
1375 | switch_count = 0; | 1375 | switch_count = 0; |
1376 | } | 1376 | } |
1377 | if (switch_count <= 1) | 1377 | if (switch_count <= 1) |
1378 | cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time); | 1378 | cmd.switch_time = cpu_to_le32(il->ucode_beacon_time); |
1379 | else { | 1379 | else { |
1380 | switch_time_in_usec = | 1380 | switch_time_in_usec = |
1381 | vif->bss_conf.beacon_int * switch_count * TIME_UNIT; | 1381 | vif->bss_conf.beacon_int * switch_count * TIME_UNIT; |
1382 | ucode_switch_time = il_usecs_to_beacons(priv, | 1382 | ucode_switch_time = il_usecs_to_beacons(il, |
1383 | switch_time_in_usec, | 1383 | switch_time_in_usec, |
1384 | beacon_interval); | 1384 | beacon_interval); |
1385 | cmd.switch_time = il_add_beacon_time(priv, | 1385 | cmd.switch_time = il_add_beacon_time(il, |
1386 | priv->ucode_beacon_time, | 1386 | il->ucode_beacon_time, |
1387 | ucode_switch_time, | 1387 | ucode_switch_time, |
1388 | beacon_interval); | 1388 | beacon_interval); |
1389 | } | 1389 | } |
1390 | IL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n", | 1390 | IL_DEBUG_11H(il, "uCode time for the switch is 0x%x\n", |
1391 | cmd.switch_time); | 1391 | cmd.switch_time); |
1392 | ch_info = il_get_channel_info(priv, priv->band, ch); | 1392 | ch_info = il_get_channel_info(il, il->band, ch); |
1393 | if (ch_info) | 1393 | if (ch_info) |
1394 | cmd.expect_beacon = il_is_channel_radar(ch_info); | 1394 | cmd.expect_beacon = il_is_channel_radar(ch_info); |
1395 | else { | 1395 | else { |
1396 | IL_ERR(priv, "invalid channel switch from %u to %u\n", | 1396 | IL_ERR(il, "invalid channel switch from %u to %u\n", |
1397 | ctx->active.channel, ch); | 1397 | ctx->active.channel, ch); |
1398 | return -EFAULT; | 1398 | return -EFAULT; |
1399 | } | 1399 | } |
1400 | 1400 | ||
1401 | rc = il4965_fill_txpower_tbl(priv, band, ch, is_ht40, | 1401 | rc = il4965_fill_txpower_tbl(il, band, ch, is_ht40, |
1402 | ctrl_chan_high, &cmd.tx_power); | 1402 | ctrl_chan_high, &cmd.tx_power); |
1403 | if (rc) { | 1403 | if (rc) { |
1404 | IL_DEBUG_11H(priv, "error:%d fill txpower_tbl\n", rc); | 1404 | IL_DEBUG_11H(il, "error:%d fill txpower_tbl\n", rc); |
1405 | return rc; | 1405 | return rc; |
1406 | } | 1406 | } |
1407 | 1407 | ||
1408 | return il_send_cmd_pdu(priv, | 1408 | return il_send_cmd_pdu(il, |
1409 | REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd); | 1409 | REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd); |
1410 | } | 1410 | } |
1411 | 1411 | ||
1412 | /** | 1412 | /** |
1413 | * il4965_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array | 1413 | * il4965_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array |
1414 | */ | 1414 | */ |
1415 | static void il4965_txq_update_byte_cnt_tbl(struct il_priv *priv, | 1415 | static void il4965_txq_update_byte_cnt_tbl(struct il_priv *il, |
1416 | struct il_tx_queue *txq, | 1416 | struct il_tx_queue *txq, |
1417 | u16 byte_cnt) | 1417 | u16 byte_cnt) |
1418 | { | 1418 | { |
1419 | struct il4965_scd_bc_tbl *scd_bc_tbl = priv->scd_bc_tbls.addr; | 1419 | struct il4965_scd_bc_tbl *scd_bc_tbl = il->scd_bc_tbls.addr; |
1420 | int txq_id = txq->q.id; | 1420 | int txq_id = txq->q.id; |
1421 | int write_ptr = txq->q.write_ptr; | 1421 | int write_ptr = txq->q.write_ptr; |
1422 | int len = byte_cnt + IL_TX_CRC_SIZE + IL_TX_DELIMITER_SIZE; | 1422 | 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, | |||
1440 | * | 1440 | * |
1441 | * A return of <0 indicates bogus data in the statistics | 1441 | * A return of <0 indicates bogus data in the statistics |
1442 | */ | 1442 | */ |
1443 | static int il4965_hw_get_temperature(struct il_priv *priv) | 1443 | static int il4965_hw_get_temperature(struct il_priv *il) |
1444 | { | 1444 | { |
1445 | s32 temperature; | 1445 | s32 temperature; |
1446 | s32 vt; | 1446 | s32 vt; |
1447 | s32 R1, R2, R3; | 1447 | s32 R1, R2, R3; |
1448 | u32 R4; | 1448 | u32 R4; |
1449 | 1449 | ||
1450 | if (test_bit(STATUS_TEMPERATURE, &priv->status) && | 1450 | if (test_bit(STATUS_TEMPERATURE, &il->status) && |
1451 | (priv->_4965.statistics.flag & | 1451 | (il->_4965.statistics.flag & |
1452 | STATISTICS_REPLY_FLG_HT40_MODE_MSK)) { | 1452 | STATISTICS_REPLY_FLG_HT40_MODE_MSK)) { |
1453 | IL_DEBUG_TEMP(priv, "Running HT40 temperature calibration\n"); | 1453 | IL_DEBUG_TEMP(il, "Running HT40 temperature calibration\n"); |
1454 | R1 = (s32)le32_to_cpu(priv->card_alive_init.therm_r1[1]); | 1454 | R1 = (s32)le32_to_cpu(il->card_alive_init.therm_r1[1]); |
1455 | R2 = (s32)le32_to_cpu(priv->card_alive_init.therm_r2[1]); | 1455 | R2 = (s32)le32_to_cpu(il->card_alive_init.therm_r2[1]); |
1456 | R3 = (s32)le32_to_cpu(priv->card_alive_init.therm_r3[1]); | 1456 | R3 = (s32)le32_to_cpu(il->card_alive_init.therm_r3[1]); |
1457 | R4 = le32_to_cpu(priv->card_alive_init.therm_r4[1]); | 1457 | R4 = le32_to_cpu(il->card_alive_init.therm_r4[1]); |
1458 | } else { | 1458 | } else { |
1459 | IL_DEBUG_TEMP(priv, "Running temperature calibration\n"); | 1459 | IL_DEBUG_TEMP(il, "Running temperature calibration\n"); |
1460 | R1 = (s32)le32_to_cpu(priv->card_alive_init.therm_r1[0]); | 1460 | R1 = (s32)le32_to_cpu(il->card_alive_init.therm_r1[0]); |
1461 | R2 = (s32)le32_to_cpu(priv->card_alive_init.therm_r2[0]); | 1461 | R2 = (s32)le32_to_cpu(il->card_alive_init.therm_r2[0]); |
1462 | R3 = (s32)le32_to_cpu(priv->card_alive_init.therm_r3[0]); | 1462 | R3 = (s32)le32_to_cpu(il->card_alive_init.therm_r3[0]); |
1463 | R4 = le32_to_cpu(priv->card_alive_init.therm_r4[0]); | 1463 | R4 = le32_to_cpu(il->card_alive_init.therm_r4[0]); |
1464 | } | 1464 | } |
1465 | 1465 | ||
1466 | /* | 1466 | /* |
@@ -1470,16 +1470,16 @@ static int il4965_hw_get_temperature(struct il_priv *priv) | |||
1470 | * with an updated temperature, use R4 provided to us in the | 1470 | * with an updated temperature, use R4 provided to us in the |
1471 | * "initialize" ALIVE response. | 1471 | * "initialize" ALIVE response. |
1472 | */ | 1472 | */ |
1473 | if (!test_bit(STATUS_TEMPERATURE, &priv->status)) | 1473 | if (!test_bit(STATUS_TEMPERATURE, &il->status)) |
1474 | vt = sign_extend32(R4, 23); | 1474 | vt = sign_extend32(R4, 23); |
1475 | else | 1475 | else |
1476 | vt = sign_extend32(le32_to_cpu(priv->_4965.statistics. | 1476 | vt = sign_extend32(le32_to_cpu(il->_4965.statistics. |
1477 | general.common.temperature), 23); | 1477 | general.common.temperature), 23); |
1478 | 1478 | ||
1479 | IL_DEBUG_TEMP(priv, "Calib values R[1-3]: %d %d %d R4: %d\n", R1, R2, R3, vt); | 1479 | IL_DEBUG_TEMP(il, "Calib values R[1-3]: %d %d %d R4: %d\n", R1, R2, R3, vt); |
1480 | 1480 | ||
1481 | if (R3 == R1) { | 1481 | if (R3 == R1) { |
1482 | IL_ERR(priv, "Calibration conflict R1 == R3\n"); | 1482 | IL_ERR(il, "Calibration conflict R1 == R3\n"); |
1483 | return -1; | 1483 | return -1; |
1484 | } | 1484 | } |
1485 | 1485 | ||
@@ -1489,7 +1489,7 @@ static int il4965_hw_get_temperature(struct il_priv *priv) | |||
1489 | temperature /= (R3 - R1); | 1489 | temperature /= (R3 - R1); |
1490 | temperature = (temperature * 97) / 100 + TEMPERATURE_CALIB_KELVIN_OFFSET; | 1490 | temperature = (temperature * 97) / 100 + TEMPERATURE_CALIB_KELVIN_OFFSET; |
1491 | 1491 | ||
1492 | IL_DEBUG_TEMP(priv, "Calibrated temperature: %dK, %dC\n", | 1492 | IL_DEBUG_TEMP(il, "Calibrated temperature: %dK, %dC\n", |
1493 | temperature, KELVIN_TO_CELSIUS(temperature)); | 1493 | temperature, KELVIN_TO_CELSIUS(temperature)); |
1494 | 1494 | ||
1495 | return temperature; | 1495 | return temperature; |
@@ -1504,66 +1504,66 @@ static int il4965_hw_get_temperature(struct il_priv *priv) | |||
1504 | * If the temperature changed has changed sufficiently, then a recalibration | 1504 | * If the temperature changed has changed sufficiently, then a recalibration |
1505 | * is needed. | 1505 | * is needed. |
1506 | * | 1506 | * |
1507 | * Assumes caller will replace priv->last_temperature once calibration | 1507 | * Assumes caller will replace il->last_temperature once calibration |
1508 | * executed. | 1508 | * executed. |
1509 | */ | 1509 | */ |
1510 | static int il4965_is_temp_calib_needed(struct il_priv *priv) | 1510 | static int il4965_is_temp_calib_needed(struct il_priv *il) |
1511 | { | 1511 | { |
1512 | int temp_diff; | 1512 | int temp_diff; |
1513 | 1513 | ||
1514 | if (!test_bit(STATUS_STATISTICS, &priv->status)) { | 1514 | if (!test_bit(STATUS_STATISTICS, &il->status)) { |
1515 | IL_DEBUG_TEMP(priv, "Temperature not updated -- no statistics.\n"); | 1515 | IL_DEBUG_TEMP(il, "Temperature not updated -- no statistics.\n"); |
1516 | return 0; | 1516 | return 0; |
1517 | } | 1517 | } |
1518 | 1518 | ||
1519 | temp_diff = priv->temperature - priv->last_temperature; | 1519 | temp_diff = il->temperature - il->last_temperature; |
1520 | 1520 | ||
1521 | /* get absolute value */ | 1521 | /* get absolute value */ |
1522 | if (temp_diff < 0) { | 1522 | if (temp_diff < 0) { |
1523 | IL_DEBUG_POWER(priv, "Getting cooler, delta %d\n", temp_diff); | 1523 | IL_DEBUG_POWER(il, "Getting cooler, delta %d\n", temp_diff); |
1524 | temp_diff = -temp_diff; | 1524 | temp_diff = -temp_diff; |
1525 | } else if (temp_diff == 0) | 1525 | } else if (temp_diff == 0) |
1526 | IL_DEBUG_POWER(priv, "Temperature unchanged\n"); | 1526 | IL_DEBUG_POWER(il, "Temperature unchanged\n"); |
1527 | else | 1527 | else |
1528 | IL_DEBUG_POWER(priv, "Getting warmer, delta %d\n", temp_diff); | 1528 | IL_DEBUG_POWER(il, "Getting warmer, delta %d\n", temp_diff); |
1529 | 1529 | ||
1530 | if (temp_diff < IL_TEMPERATURE_THRESHOLD) { | 1530 | if (temp_diff < IL_TEMPERATURE_THRESHOLD) { |
1531 | IL_DEBUG_POWER(priv, " => thermal txpower calib not needed\n"); | 1531 | IL_DEBUG_POWER(il, " => thermal txpower calib not needed\n"); |
1532 | return 0; | 1532 | return 0; |
1533 | } | 1533 | } |
1534 | 1534 | ||
1535 | IL_DEBUG_POWER(priv, " => thermal txpower calib needed\n"); | 1535 | IL_DEBUG_POWER(il, " => thermal txpower calib needed\n"); |
1536 | 1536 | ||
1537 | return 1; | 1537 | return 1; |
1538 | } | 1538 | } |
1539 | 1539 | ||
1540 | static void il4965_temperature_calib(struct il_priv *priv) | 1540 | static void il4965_temperature_calib(struct il_priv *il) |
1541 | { | 1541 | { |
1542 | s32 temp; | 1542 | s32 temp; |
1543 | 1543 | ||
1544 | temp = il4965_hw_get_temperature(priv); | 1544 | temp = il4965_hw_get_temperature(il); |
1545 | if (IL_TX_POWER_TEMPERATURE_OUT_OF_RANGE(temp)) | 1545 | if (IL_TX_POWER_TEMPERATURE_OUT_OF_RANGE(temp)) |
1546 | return; | 1546 | return; |
1547 | 1547 | ||
1548 | if (priv->temperature != temp) { | 1548 | if (il->temperature != temp) { |
1549 | if (priv->temperature) | 1549 | if (il->temperature) |
1550 | IL_DEBUG_TEMP(priv, "Temperature changed " | 1550 | IL_DEBUG_TEMP(il, "Temperature changed " |
1551 | "from %dC to %dC\n", | 1551 | "from %dC to %dC\n", |
1552 | KELVIN_TO_CELSIUS(priv->temperature), | 1552 | KELVIN_TO_CELSIUS(il->temperature), |
1553 | KELVIN_TO_CELSIUS(temp)); | 1553 | KELVIN_TO_CELSIUS(temp)); |
1554 | else | 1554 | else |
1555 | IL_DEBUG_TEMP(priv, "Temperature " | 1555 | IL_DEBUG_TEMP(il, "Temperature " |
1556 | "initialized to %dC\n", | 1556 | "initialized to %dC\n", |
1557 | KELVIN_TO_CELSIUS(temp)); | 1557 | KELVIN_TO_CELSIUS(temp)); |
1558 | } | 1558 | } |
1559 | 1559 | ||
1560 | priv->temperature = temp; | 1560 | il->temperature = temp; |
1561 | set_bit(STATUS_TEMPERATURE, &priv->status); | 1561 | set_bit(STATUS_TEMPERATURE, &il->status); |
1562 | 1562 | ||
1563 | if (!priv->disable_tx_power_cal && | 1563 | if (!il->disable_tx_power_cal && |
1564 | unlikely(!test_bit(STATUS_SCANNING, &priv->status)) && | 1564 | unlikely(!test_bit(STATUS_SCANNING, &il->status)) && |
1565 | il4965_is_temp_calib_needed(priv)) | 1565 | il4965_is_temp_calib_needed(il)) |
1566 | queue_work(priv->workqueue, &priv->txpower_work); | 1566 | queue_work(il->workqueue, &il->txpower_work); |
1567 | } | 1567 | } |
1568 | 1568 | ||
1569 | static u16 il4965_get_hcmd_size(u8 cmd_id, u16 len) | 1569 | 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) | |||
1604 | /** | 1604 | /** |
1605 | * il4965_tx_status_reply_tx - Handle Tx response for frames in aggregation queue | 1605 | * il4965_tx_status_reply_tx - Handle Tx response for frames in aggregation queue |
1606 | */ | 1606 | */ |
1607 | static int il4965_tx_status_reply_tx(struct il_priv *priv, | 1607 | static int il4965_tx_status_reply_tx(struct il_priv *il, |
1608 | struct il_ht_agg *agg, | 1608 | struct il_ht_agg *agg, |
1609 | struct il4965_tx_resp *tx_resp, | 1609 | struct il4965_tx_resp *tx_resp, |
1610 | int txq_id, u16 start_idx) | 1610 | int txq_id, u16 start_idx) |
@@ -1617,7 +1617,7 @@ static int il4965_tx_status_reply_tx(struct il_priv *priv, | |||
1617 | int i, sh, idx; | 1617 | int i, sh, idx; |
1618 | u16 seq; | 1618 | u16 seq; |
1619 | if (agg->wait_for_ba) | 1619 | if (agg->wait_for_ba) |
1620 | IL_DEBUG_TX_REPLY(priv, "got tx response w/o block-ack\n"); | 1620 | IL_DEBUG_TX_REPLY(il, "got tx response w/o block-ack\n"); |
1621 | 1621 | ||
1622 | agg->frame_count = tx_resp->frame_count; | 1622 | agg->frame_count = tx_resp->frame_count; |
1623 | agg->start_idx = start_idx; | 1623 | agg->start_idx = start_idx; |
@@ -1630,18 +1630,18 @@ static int il4965_tx_status_reply_tx(struct il_priv *priv, | |||
1630 | status = le16_to_cpu(frame_status[0].status); | 1630 | status = le16_to_cpu(frame_status[0].status); |
1631 | idx = start_idx; | 1631 | idx = start_idx; |
1632 | 1632 | ||
1633 | IL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, StartIdx=%d idx=%d\n", | 1633 | IL_DEBUG_TX_REPLY(il, "FrameCnt = %d, StartIdx=%d idx=%d\n", |
1634 | agg->frame_count, agg->start_idx, idx); | 1634 | agg->frame_count, agg->start_idx, idx); |
1635 | 1635 | ||
1636 | info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb); | 1636 | info = IEEE80211_SKB_CB(il->txq[txq_id].txb[idx].skb); |
1637 | info->status.rates[0].count = tx_resp->failure_frame + 1; | 1637 | info->status.rates[0].count = tx_resp->failure_frame + 1; |
1638 | info->flags &= ~IEEE80211_TX_CTL_AMPDU; | 1638 | info->flags &= ~IEEE80211_TX_CTL_AMPDU; |
1639 | info->flags |= il4965_tx_status_to_mac80211(status); | 1639 | info->flags |= il4965_tx_status_to_mac80211(status); |
1640 | il4965_hwrate_to_tx_control(priv, rate_n_flags, info); | 1640 | il4965_hwrate_to_tx_control(il, rate_n_flags, info); |
1641 | 1641 | ||
1642 | IL_DEBUG_TX_REPLY(priv, "1 Frame 0x%x failure :%d\n", | 1642 | IL_DEBUG_TX_REPLY(il, "1 Frame 0x%x failure :%d\n", |
1643 | status & 0xff, tx_resp->failure_frame); | 1643 | status & 0xff, tx_resp->failure_frame); |
1644 | IL_DEBUG_TX_REPLY(priv, "Rate Info rate_n_flags=%x\n", rate_n_flags); | 1644 | IL_DEBUG_TX_REPLY(il, "Rate Info rate_n_flags=%x\n", rate_n_flags); |
1645 | 1645 | ||
1646 | agg->wait_for_ba = 0; | 1646 | agg->wait_for_ba = 0; |
1647 | } else { | 1647 | } else { |
@@ -1661,12 +1661,12 @@ static int il4965_tx_status_reply_tx(struct il_priv *priv, | |||
1661 | AGG_TX_STATE_ABORT_MSK)) | 1661 | AGG_TX_STATE_ABORT_MSK)) |
1662 | continue; | 1662 | continue; |
1663 | 1663 | ||
1664 | IL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, txq_id=%d idx=%d\n", | 1664 | IL_DEBUG_TX_REPLY(il, "FrameCnt = %d, txq_id=%d idx=%d\n", |
1665 | agg->frame_count, txq_id, idx); | 1665 | agg->frame_count, txq_id, idx); |
1666 | 1666 | ||
1667 | hdr = il_tx_queue_get_hdr(priv, txq_id, idx); | 1667 | hdr = il_tx_queue_get_hdr(il, txq_id, idx); |
1668 | if (!hdr) { | 1668 | if (!hdr) { |
1669 | IL_ERR(priv, | 1669 | IL_ERR(il, |
1670 | "BUG_ON idx doesn't point to valid skb" | 1670 | "BUG_ON idx doesn't point to valid skb" |
1671 | " idx=%d, txq_id=%d\n", idx, txq_id); | 1671 | " idx=%d, txq_id=%d\n", idx, txq_id); |
1672 | return -1; | 1672 | return -1; |
@@ -1674,14 +1674,14 @@ static int il4965_tx_status_reply_tx(struct il_priv *priv, | |||
1674 | 1674 | ||
1675 | sc = le16_to_cpu(hdr->seq_ctrl); | 1675 | sc = le16_to_cpu(hdr->seq_ctrl); |
1676 | if (idx != (SEQ_TO_SN(sc) & 0xff)) { | 1676 | if (idx != (SEQ_TO_SN(sc) & 0xff)) { |
1677 | IL_ERR(priv, | 1677 | IL_ERR(il, |
1678 | "BUG_ON idx doesn't match seq control" | 1678 | "BUG_ON idx doesn't match seq control" |
1679 | " idx=%d, seq_idx=%d, seq=%d\n", | 1679 | " idx=%d, seq_idx=%d, seq=%d\n", |
1680 | idx, SEQ_TO_SN(sc), hdr->seq_ctrl); | 1680 | idx, SEQ_TO_SN(sc), hdr->seq_ctrl); |
1681 | return -1; | 1681 | return -1; |
1682 | } | 1682 | } |
1683 | 1683 | ||
1684 | IL_DEBUG_TX_REPLY(priv, "AGG Frame i=%d idx %d seq=%d\n", | 1684 | IL_DEBUG_TX_REPLY(il, "AGG Frame i=%d idx %d seq=%d\n", |
1685 | i, idx, SEQ_TO_SN(sc)); | 1685 | i, idx, SEQ_TO_SN(sc)); |
1686 | 1686 | ||
1687 | sh = idx - start; | 1687 | sh = idx - start; |
@@ -1699,13 +1699,13 @@ static int il4965_tx_status_reply_tx(struct il_priv *priv, | |||
1699 | sh = 0; | 1699 | sh = 0; |
1700 | } | 1700 | } |
1701 | bitmap |= 1ULL << sh; | 1701 | bitmap |= 1ULL << sh; |
1702 | IL_DEBUG_TX_REPLY(priv, "start=%d bitmap=0x%llx\n", | 1702 | IL_DEBUG_TX_REPLY(il, "start=%d bitmap=0x%llx\n", |
1703 | start, (unsigned long long)bitmap); | 1703 | start, (unsigned long long)bitmap); |
1704 | } | 1704 | } |
1705 | 1705 | ||
1706 | agg->bitmap = bitmap; | 1706 | agg->bitmap = bitmap; |
1707 | agg->start_idx = start; | 1707 | agg->start_idx = start; |
1708 | IL_DEBUG_TX_REPLY(priv, "Frames %d start_idx=%d bitmap=0x%llx\n", | 1708 | IL_DEBUG_TX_REPLY(il, "Frames %d start_idx=%d bitmap=0x%llx\n", |
1709 | agg->frame_count, agg->start_idx, | 1709 | agg->frame_count, agg->start_idx, |
1710 | (unsigned long long)agg->bitmap); | 1710 | (unsigned long long)agg->bitmap); |
1711 | 1711 | ||
@@ -1715,30 +1715,30 @@ static int il4965_tx_status_reply_tx(struct il_priv *priv, | |||
1715 | return 0; | 1715 | return 0; |
1716 | } | 1716 | } |
1717 | 1717 | ||
1718 | static u8 il4965_find_station(struct il_priv *priv, const u8 *addr) | 1718 | static u8 il4965_find_station(struct il_priv *il, const u8 *addr) |
1719 | { | 1719 | { |
1720 | int i; | 1720 | int i; |
1721 | int start = 0; | 1721 | int start = 0; |
1722 | int ret = IL_INVALID_STATION; | 1722 | int ret = IL_INVALID_STATION; |
1723 | unsigned long flags; | 1723 | unsigned long flags; |
1724 | 1724 | ||
1725 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC)) | 1725 | if ((il->iw_mode == NL80211_IFTYPE_ADHOC)) |
1726 | start = IL_STA_ID; | 1726 | start = IL_STA_ID; |
1727 | 1727 | ||
1728 | if (is_broadcast_ether_addr(addr)) | 1728 | if (is_broadcast_ether_addr(addr)) |
1729 | return priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id; | 1729 | return il->contexts[IL_RXON_CTX_BSS].bcast_sta_id; |
1730 | 1730 | ||
1731 | spin_lock_irqsave(&priv->sta_lock, flags); | 1731 | spin_lock_irqsave(&il->sta_lock, flags); |
1732 | for (i = start; i < priv->hw_params.max_stations; i++) | 1732 | for (i = start; i < il->hw_params.max_stations; i++) |
1733 | if (priv->stations[i].used && | 1733 | if (il->stations[i].used && |
1734 | (!compare_ether_addr(priv->stations[i].sta.sta.addr, | 1734 | (!compare_ether_addr(il->stations[i].sta.sta.addr, |
1735 | addr))) { | 1735 | addr))) { |
1736 | ret = i; | 1736 | ret = i; |
1737 | goto out; | 1737 | goto out; |
1738 | } | 1738 | } |
1739 | 1739 | ||
1740 | IL_DEBUG_ASSOC_LIMIT(priv, "can not find STA %pM total %d\n", | 1740 | IL_DEBUG_ASSOC_LIMIT(il, "can not find STA %pM total %d\n", |
1741 | addr, priv->num_stations); | 1741 | addr, il->num_stations); |
1742 | 1742 | ||
1743 | out: | 1743 | out: |
1744 | /* | 1744 | /* |
@@ -1747,38 +1747,38 @@ static u8 il4965_find_station(struct il_priv *priv, const u8 *addr) | |||
1747 | * station | 1747 | * station |
1748 | */ | 1748 | */ |
1749 | if (ret != IL_INVALID_STATION && | 1749 | if (ret != IL_INVALID_STATION && |
1750 | (!(priv->stations[ret].used & IL_STA_UCODE_ACTIVE) || | 1750 | (!(il->stations[ret].used & IL_STA_UCODE_ACTIVE) || |
1751 | ((priv->stations[ret].used & IL_STA_UCODE_ACTIVE) && | 1751 | ((il->stations[ret].used & IL_STA_UCODE_ACTIVE) && |
1752 | (priv->stations[ret].used & IL_STA_UCODE_INPROGRESS)))) { | 1752 | (il->stations[ret].used & IL_STA_UCODE_INPROGRESS)))) { |
1753 | IL_ERR(priv, "Requested station info for sta %d before ready.\n", | 1753 | IL_ERR(il, "Requested station info for sta %d before ready.\n", |
1754 | ret); | 1754 | ret); |
1755 | ret = IL_INVALID_STATION; | 1755 | ret = IL_INVALID_STATION; |
1756 | } | 1756 | } |
1757 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 1757 | spin_unlock_irqrestore(&il->sta_lock, flags); |
1758 | return ret; | 1758 | return ret; |
1759 | } | 1759 | } |
1760 | 1760 | ||
1761 | static int il4965_get_ra_sta_id(struct il_priv *priv, struct ieee80211_hdr *hdr) | 1761 | static int il4965_get_ra_sta_id(struct il_priv *il, struct ieee80211_hdr *hdr) |
1762 | { | 1762 | { |
1763 | if (priv->iw_mode == NL80211_IFTYPE_STATION) { | 1763 | if (il->iw_mode == NL80211_IFTYPE_STATION) { |
1764 | return IL_AP_ID; | 1764 | return IL_AP_ID; |
1765 | } else { | 1765 | } else { |
1766 | u8 *da = ieee80211_get_DA(hdr); | 1766 | u8 *da = ieee80211_get_DA(hdr); |
1767 | return il4965_find_station(priv, da); | 1767 | return il4965_find_station(il, da); |
1768 | } | 1768 | } |
1769 | } | 1769 | } |
1770 | 1770 | ||
1771 | /** | 1771 | /** |
1772 | * il4965_rx_reply_tx - Handle standard (non-aggregation) Tx response | 1772 | * il4965_rx_reply_tx - Handle standard (non-aggregation) Tx response |
1773 | */ | 1773 | */ |
1774 | static void il4965_rx_reply_tx(struct il_priv *priv, | 1774 | static void il4965_rx_reply_tx(struct il_priv *il, |
1775 | struct il_rx_mem_buffer *rxb) | 1775 | struct il_rx_mem_buffer *rxb) |
1776 | { | 1776 | { |
1777 | struct il_rx_packet *pkt = rxb_addr(rxb); | 1777 | struct il_rx_packet *pkt = rxb_addr(rxb); |
1778 | u16 sequence = le16_to_cpu(pkt->hdr.sequence); | 1778 | u16 sequence = le16_to_cpu(pkt->hdr.sequence); |
1779 | int txq_id = SEQ_TO_QUEUE(sequence); | 1779 | int txq_id = SEQ_TO_QUEUE(sequence); |
1780 | int index = SEQ_TO_INDEX(sequence); | 1780 | int index = SEQ_TO_INDEX(sequence); |
1781 | struct il_tx_queue *txq = &priv->txq[txq_id]; | 1781 | struct il_tx_queue *txq = &il->txq[txq_id]; |
1782 | struct ieee80211_hdr *hdr; | 1782 | struct ieee80211_hdr *hdr; |
1783 | struct ieee80211_tx_info *info; | 1783 | struct ieee80211_tx_info *info; |
1784 | struct il4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; | 1784 | 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, | |||
1790 | unsigned long flags; | 1790 | unsigned long flags; |
1791 | 1791 | ||
1792 | if ((index >= txq->q.n_bd) || (il_queue_used(&txq->q, index) == 0)) { | 1792 | if ((index >= txq->q.n_bd) || (il_queue_used(&txq->q, index) == 0)) { |
1793 | IL_ERR(priv, "Read index for DMA queue txq_id (%d) index %d " | 1793 | IL_ERR(il, "Read index for DMA queue txq_id (%d) index %d " |
1794 | "is out of range [0-%d] %d %d\n", txq_id, | 1794 | "is out of range [0-%d] %d %d\n", txq_id, |
1795 | index, txq->q.n_bd, txq->q.write_ptr, | 1795 | index, txq->q.n_bd, txq->q.write_ptr, |
1796 | txq->q.read_ptr); | 1796 | txq->q.read_ptr); |
@@ -1801,27 +1801,27 @@ static void il4965_rx_reply_tx(struct il_priv *priv, | |||
1801 | info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb); | 1801 | info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb); |
1802 | memset(&info->status, 0, sizeof(info->status)); | 1802 | memset(&info->status, 0, sizeof(info->status)); |
1803 | 1803 | ||
1804 | hdr = il_tx_queue_get_hdr(priv, txq_id, index); | 1804 | hdr = il_tx_queue_get_hdr(il, txq_id, index); |
1805 | if (ieee80211_is_data_qos(hdr->frame_control)) { | 1805 | if (ieee80211_is_data_qos(hdr->frame_control)) { |
1806 | qc = ieee80211_get_qos_ctl(hdr); | 1806 | qc = ieee80211_get_qos_ctl(hdr); |
1807 | tid = qc[0] & 0xf; | 1807 | tid = qc[0] & 0xf; |
1808 | } | 1808 | } |
1809 | 1809 | ||
1810 | sta_id = il4965_get_ra_sta_id(priv, hdr); | 1810 | sta_id = il4965_get_ra_sta_id(il, hdr); |
1811 | if (txq->sched_retry && unlikely(sta_id == IL_INVALID_STATION)) { | 1811 | if (txq->sched_retry && unlikely(sta_id == IL_INVALID_STATION)) { |
1812 | IL_ERR(priv, "Station not known\n"); | 1812 | IL_ERR(il, "Station not known\n"); |
1813 | return; | 1813 | return; |
1814 | } | 1814 | } |
1815 | 1815 | ||
1816 | spin_lock_irqsave(&priv->sta_lock, flags); | 1816 | spin_lock_irqsave(&il->sta_lock, flags); |
1817 | if (txq->sched_retry) { | 1817 | if (txq->sched_retry) { |
1818 | const u32 scd_ssn = il4965_get_scd_ssn(tx_resp); | 1818 | const u32 scd_ssn = il4965_get_scd_ssn(tx_resp); |
1819 | struct il_ht_agg *agg = NULL; | 1819 | struct il_ht_agg *agg = NULL; |
1820 | WARN_ON(!qc); | 1820 | WARN_ON(!qc); |
1821 | 1821 | ||
1822 | agg = &priv->stations[sta_id].tid[tid].agg; | 1822 | agg = &il->stations[sta_id].tid[tid].agg; |
1823 | 1823 | ||
1824 | il4965_tx_status_reply_tx(priv, agg, tx_resp, txq_id, index); | 1824 | il4965_tx_status_reply_tx(il, agg, tx_resp, txq_id, index); |
1825 | 1825 | ||
1826 | /* check if BAR is needed */ | 1826 | /* check if BAR is needed */ |
1827 | if ((tx_resp->frame_count == 1) && !il4965_is_tx_success(status)) | 1827 | 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, | |||
1830 | if (txq->q.read_ptr != (scd_ssn & 0xff)) { | 1830 | if (txq->q.read_ptr != (scd_ssn & 0xff)) { |
1831 | index = il_queue_dec_wrap(scd_ssn & 0xff, | 1831 | index = il_queue_dec_wrap(scd_ssn & 0xff, |
1832 | txq->q.n_bd); | 1832 | txq->q.n_bd); |
1833 | IL_DEBUG_TX_REPLY(priv, "Retry scheduler reclaim scd_ssn " | 1833 | IL_DEBUG_TX_REPLY(il, "Retry scheduler reclaim scd_ssn " |
1834 | "%d index %d\n", scd_ssn , index); | 1834 | "%d index %d\n", scd_ssn , index); |
1835 | freed = il4965_tx_queue_reclaim(priv, txq_id, index); | 1835 | freed = il4965_tx_queue_reclaim(il, txq_id, index); |
1836 | if (qc) | 1836 | if (qc) |
1837 | il4965_free_tfds_in_queue(priv, sta_id, | 1837 | il4965_free_tfds_in_queue(il, sta_id, |
1838 | tid, freed); | 1838 | tid, freed); |
1839 | 1839 | ||
1840 | if (priv->mac80211_registered && | 1840 | if (il->mac80211_registered && |
1841 | (il_queue_space(&txq->q) > txq->q.low_mark) | 1841 | (il_queue_space(&txq->q) > txq->q.low_mark) |
1842 | && (agg->state != IL_EMPTYING_HW_QUEUE_DELBA)) | 1842 | && (agg->state != IL_EMPTYING_HW_QUEUE_DELBA)) |
1843 | il_wake_queue(priv, txq); | 1843 | il_wake_queue(il, txq); |
1844 | } | 1844 | } |
1845 | } else { | 1845 | } else { |
1846 | info->status.rates[0].count = tx_resp->failure_frame + 1; | 1846 | info->status.rates[0].count = tx_resp->failure_frame + 1; |
1847 | info->flags |= il4965_tx_status_to_mac80211(status); | 1847 | info->flags |= il4965_tx_status_to_mac80211(status); |
1848 | il4965_hwrate_to_tx_control(priv, | 1848 | il4965_hwrate_to_tx_control(il, |
1849 | le32_to_cpu(tx_resp->rate_n_flags), | 1849 | le32_to_cpu(tx_resp->rate_n_flags), |
1850 | info); | 1850 | info); |
1851 | 1851 | ||
1852 | IL_DEBUG_TX_REPLY(priv, "TXQ %d status %s (0x%08x) " | 1852 | IL_DEBUG_TX_REPLY(il, "TXQ %d status %s (0x%08x) " |
1853 | "rate_n_flags 0x%x retries %d\n", | 1853 | "rate_n_flags 0x%x retries %d\n", |
1854 | txq_id, | 1854 | txq_id, |
1855 | il4965_get_tx_fail_reason(status), status, | 1855 | il4965_get_tx_fail_reason(status), status, |
1856 | le32_to_cpu(tx_resp->rate_n_flags), | 1856 | le32_to_cpu(tx_resp->rate_n_flags), |
1857 | tx_resp->failure_frame); | 1857 | tx_resp->failure_frame); |
1858 | 1858 | ||
1859 | freed = il4965_tx_queue_reclaim(priv, txq_id, index); | 1859 | freed = il4965_tx_queue_reclaim(il, txq_id, index); |
1860 | if (qc && likely(sta_id != IL_INVALID_STATION)) | 1860 | if (qc && likely(sta_id != IL_INVALID_STATION)) |
1861 | il4965_free_tfds_in_queue(priv, sta_id, tid, freed); | 1861 | il4965_free_tfds_in_queue(il, sta_id, tid, freed); |
1862 | else if (sta_id == IL_INVALID_STATION) | 1862 | else if (sta_id == IL_INVALID_STATION) |
1863 | IL_DEBUG_TX_REPLY(priv, "Station not known\n"); | 1863 | IL_DEBUG_TX_REPLY(il, "Station not known\n"); |
1864 | 1864 | ||
1865 | if (priv->mac80211_registered && | 1865 | if (il->mac80211_registered && |
1866 | (il_queue_space(&txq->q) > txq->q.low_mark)) | 1866 | (il_queue_space(&txq->q) > txq->q.low_mark)) |
1867 | il_wake_queue(priv, txq); | 1867 | il_wake_queue(il, txq); |
1868 | } | 1868 | } |
1869 | if (qc && likely(sta_id != IL_INVALID_STATION)) | 1869 | if (qc && likely(sta_id != IL_INVALID_STATION)) |
1870 | il4965_txq_check_empty(priv, sta_id, tid, txq_id); | 1870 | il4965_txq_check_empty(il, sta_id, tid, txq_id); |
1871 | 1871 | ||
1872 | il4965_check_abort_status(priv, tx_resp->frame_count, status); | 1872 | il4965_check_abort_status(il, tx_resp->frame_count, status); |
1873 | 1873 | ||
1874 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 1874 | spin_unlock_irqrestore(&il->sta_lock, flags); |
1875 | } | 1875 | } |
1876 | 1876 | ||
1877 | static void il4965_rx_beacon_notif(struct il_priv *priv, | 1877 | static void il4965_rx_beacon_notif(struct il_priv *il, |
1878 | struct il_rx_mem_buffer *rxb) | 1878 | struct il_rx_mem_buffer *rxb) |
1879 | { | 1879 | { |
1880 | struct il_rx_packet *pkt = rxb_addr(rxb); | 1880 | struct il_rx_packet *pkt = rxb_addr(rxb); |
@@ -1882,7 +1882,7 @@ static void il4965_rx_beacon_notif(struct il_priv *priv, | |||
1882 | u8 rate __maybe_unused = | 1882 | u8 rate __maybe_unused = |
1883 | il4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); | 1883 | il4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); |
1884 | 1884 | ||
1885 | IL_DEBUG_RX(priv, "beacon status %#x, retries:%d ibssmgr:%d " | 1885 | IL_DEBUG_RX(il, "beacon status %#x, retries:%d ibssmgr:%d " |
1886 | "tsf:0x%.8x%.8x rate:%d\n", | 1886 | "tsf:0x%.8x%.8x rate:%d\n", |
1887 | le32_to_cpu(beacon->beacon_notify_hdr.u.status) & TX_STATUS_MSK, | 1887 | le32_to_cpu(beacon->beacon_notify_hdr.u.status) & TX_STATUS_MSK, |
1888 | beacon->beacon_notify_hdr.failure_frame, | 1888 | beacon->beacon_notify_hdr.failure_frame, |
@@ -1890,17 +1890,17 @@ static void il4965_rx_beacon_notif(struct il_priv *priv, | |||
1890 | le32_to_cpu(beacon->high_tsf), | 1890 | le32_to_cpu(beacon->high_tsf), |
1891 | le32_to_cpu(beacon->low_tsf), rate); | 1891 | le32_to_cpu(beacon->low_tsf), rate); |
1892 | 1892 | ||
1893 | priv->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status); | 1893 | il->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status); |
1894 | } | 1894 | } |
1895 | 1895 | ||
1896 | /* Set up 4965-specific Rx frame reply handlers */ | 1896 | /* Set up 4965-specific Rx frame reply handlers */ |
1897 | static void il4965_rx_handler_setup(struct il_priv *priv) | 1897 | static void il4965_rx_handler_setup(struct il_priv *il) |
1898 | { | 1898 | { |
1899 | /* Legacy Rx frames */ | 1899 | /* Legacy Rx frames */ |
1900 | priv->rx_handlers[REPLY_RX] = il4965_rx_reply_rx; | 1900 | il->rx_handlers[REPLY_RX] = il4965_rx_reply_rx; |
1901 | /* Tx response */ | 1901 | /* Tx response */ |
1902 | priv->rx_handlers[REPLY_TX] = il4965_rx_reply_tx; | 1902 | il->rx_handlers[REPLY_TX] = il4965_rx_reply_tx; |
1903 | priv->rx_handlers[BEACON_NOTIFICATION] = il4965_rx_beacon_notif; | 1903 | il->rx_handlers[BEACON_NOTIFICATION] = il4965_rx_beacon_notif; |
1904 | } | 1904 | } |
1905 | 1905 | ||
1906 | static struct il_hcmd_ops il4965_hcmd = { | 1906 | static struct il_hcmd_ops il4965_hcmd = { |
@@ -1909,53 +1909,53 @@ static struct il_hcmd_ops il4965_hcmd = { | |||
1909 | .set_rxon_chain = il4965_set_rxon_chain, | 1909 | .set_rxon_chain = il4965_set_rxon_chain, |
1910 | }; | 1910 | }; |
1911 | 1911 | ||
1912 | static void il4965_post_scan(struct il_priv *priv) | 1912 | static void il4965_post_scan(struct il_priv *il) |
1913 | { | 1913 | { |
1914 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 1914 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
1915 | 1915 | ||
1916 | /* | 1916 | /* |
1917 | * Since setting the RXON may have been deferred while | 1917 | * Since setting the RXON may have been deferred while |
1918 | * performing the scan, fire one off if needed | 1918 | * performing the scan, fire one off if needed |
1919 | */ | 1919 | */ |
1920 | if (memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging))) | 1920 | if (memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging))) |
1921 | il_commit_rxon(priv, ctx); | 1921 | il_commit_rxon(il, ctx); |
1922 | } | 1922 | } |
1923 | 1923 | ||
1924 | static void il4965_post_associate(struct il_priv *priv) | 1924 | static void il4965_post_associate(struct il_priv *il) |
1925 | { | 1925 | { |
1926 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 1926 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
1927 | struct ieee80211_vif *vif = ctx->vif; | 1927 | struct ieee80211_vif *vif = ctx->vif; |
1928 | struct ieee80211_conf *conf = NULL; | 1928 | struct ieee80211_conf *conf = NULL; |
1929 | int ret = 0; | 1929 | int ret = 0; |
1930 | 1930 | ||
1931 | if (!vif || !priv->is_open) | 1931 | if (!vif || !il->is_open) |
1932 | return; | 1932 | return; |
1933 | 1933 | ||
1934 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 1934 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) |
1935 | return; | 1935 | return; |
1936 | 1936 | ||
1937 | il_scan_cancel_timeout(priv, 200); | 1937 | il_scan_cancel_timeout(il, 200); |
1938 | 1938 | ||
1939 | conf = il_ieee80211_get_hw_conf(priv->hw); | 1939 | conf = il_ieee80211_get_hw_conf(il->hw); |
1940 | 1940 | ||
1941 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 1941 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
1942 | il_commit_rxon(priv, ctx); | 1942 | il_commit_rxon(il, ctx); |
1943 | 1943 | ||
1944 | ret = il_send_rxon_timing(priv, ctx); | 1944 | ret = il_send_rxon_timing(il, ctx); |
1945 | if (ret) | 1945 | if (ret) |
1946 | IL_WARN(priv, "RXON timing - " | 1946 | IL_WARN(il, "RXON timing - " |
1947 | "Attempting to continue.\n"); | 1947 | "Attempting to continue.\n"); |
1948 | 1948 | ||
1949 | ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; | 1949 | ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; |
1950 | 1950 | ||
1951 | il_set_rxon_ht(priv, &priv->current_ht_config); | 1951 | il_set_rxon_ht(il, &il->current_ht_config); |
1952 | 1952 | ||
1953 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 1953 | if (il->cfg->ops->hcmd->set_rxon_chain) |
1954 | priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); | 1954 | il->cfg->ops->hcmd->set_rxon_chain(il, ctx); |
1955 | 1955 | ||
1956 | ctx->staging.assoc_id = cpu_to_le16(vif->bss_conf.aid); | 1956 | ctx->staging.assoc_id = cpu_to_le16(vif->bss_conf.aid); |
1957 | 1957 | ||
1958 | IL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", | 1958 | IL_DEBUG_ASSOC(il, "assoc id %d beacon interval %d\n", |
1959 | vif->bss_conf.aid, vif->bss_conf.beacon_int); | 1959 | vif->bss_conf.aid, vif->bss_conf.beacon_int); |
1960 | 1960 | ||
1961 | if (vif->bss_conf.use_short_preamble) | 1961 | if (vif->bss_conf.use_short_preamble) |
@@ -1970,19 +1970,19 @@ static void il4965_post_associate(struct il_priv *priv) | |||
1970 | ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 1970 | ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
1971 | } | 1971 | } |
1972 | 1972 | ||
1973 | il_commit_rxon(priv, ctx); | 1973 | il_commit_rxon(il, ctx); |
1974 | 1974 | ||
1975 | IL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", | 1975 | IL_DEBUG_ASSOC(il, "Associated as %d to: %pM\n", |
1976 | vif->bss_conf.aid, ctx->active.bssid_addr); | 1976 | vif->bss_conf.aid, ctx->active.bssid_addr); |
1977 | 1977 | ||
1978 | switch (vif->type) { | 1978 | switch (vif->type) { |
1979 | case NL80211_IFTYPE_STATION: | 1979 | case NL80211_IFTYPE_STATION: |
1980 | break; | 1980 | break; |
1981 | case NL80211_IFTYPE_ADHOC: | 1981 | case NL80211_IFTYPE_ADHOC: |
1982 | il4965_send_beacon_cmd(priv); | 1982 | il4965_send_beacon_cmd(il); |
1983 | break; | 1983 | break; |
1984 | default: | 1984 | default: |
1985 | IL_ERR(priv, "%s Should not be called in %d mode\n", | 1985 | IL_ERR(il, "%s Should not be called in %d mode\n", |
1986 | __func__, vif->type); | 1986 | __func__, vif->type); |
1987 | break; | 1987 | break; |
1988 | } | 1988 | } |
@@ -1990,23 +1990,23 @@ static void il4965_post_associate(struct il_priv *priv) | |||
1990 | /* the chain noise calibration will enabled PM upon completion | 1990 | /* the chain noise calibration will enabled PM upon completion |
1991 | * If chain noise has already been run, then we need to enable | 1991 | * If chain noise has already been run, then we need to enable |
1992 | * power management here */ | 1992 | * power management here */ |
1993 | if (priv->chain_noise_data.state == IL_CHAIN_NOISE_DONE) | 1993 | if (il->chain_noise_data.state == IL_CHAIN_NOISE_DONE) |
1994 | il_power_update_mode(priv, false); | 1994 | il_power_update_mode(il, false); |
1995 | 1995 | ||
1996 | /* Enable Rx differential gain and sensitivity calibrations */ | 1996 | /* Enable Rx differential gain and sensitivity calibrations */ |
1997 | il4965_chain_noise_reset(priv); | 1997 | il4965_chain_noise_reset(il); |
1998 | priv->start_calib = 1; | 1998 | il->start_calib = 1; |
1999 | } | 1999 | } |
2000 | 2000 | ||
2001 | static void il4965_config_ap(struct il_priv *priv) | 2001 | static void il4965_config_ap(struct il_priv *il) |
2002 | { | 2002 | { |
2003 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 2003 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
2004 | struct ieee80211_vif *vif = ctx->vif; | 2004 | struct ieee80211_vif *vif = ctx->vif; |
2005 | int ret = 0; | 2005 | int ret = 0; |
2006 | 2006 | ||
2007 | lockdep_assert_held(&priv->mutex); | 2007 | lockdep_assert_held(&il->mutex); |
2008 | 2008 | ||
2009 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 2009 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) |
2010 | return; | 2010 | return; |
2011 | 2011 | ||
2012 | /* The following should be done only at AP bring up */ | 2012 | /* The following should be done only at AP bring up */ |
@@ -2014,20 +2014,20 @@ static void il4965_config_ap(struct il_priv *priv) | |||
2014 | 2014 | ||
2015 | /* RXON - unassoc (to set timing command) */ | 2015 | /* RXON - unassoc (to set timing command) */ |
2016 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 2016 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
2017 | il_commit_rxon(priv, ctx); | 2017 | il_commit_rxon(il, ctx); |
2018 | 2018 | ||
2019 | /* RXON Timing */ | 2019 | /* RXON Timing */ |
2020 | ret = il_send_rxon_timing(priv, ctx); | 2020 | ret = il_send_rxon_timing(il, ctx); |
2021 | if (ret) | 2021 | if (ret) |
2022 | IL_WARN(priv, "RXON timing failed - " | 2022 | IL_WARN(il, "RXON timing failed - " |
2023 | "Attempting to continue.\n"); | 2023 | "Attempting to continue.\n"); |
2024 | 2024 | ||
2025 | /* AP has all antennas */ | 2025 | /* AP has all antennas */ |
2026 | priv->chain_noise_data.active_chains = | 2026 | il->chain_noise_data.active_chains = |
2027 | priv->hw_params.valid_rx_ant; | 2027 | il->hw_params.valid_rx_ant; |
2028 | il_set_rxon_ht(priv, &priv->current_ht_config); | 2028 | il_set_rxon_ht(il, &il->current_ht_config); |
2029 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 2029 | if (il->cfg->ops->hcmd->set_rxon_chain) |
2030 | priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); | 2030 | il->cfg->ops->hcmd->set_rxon_chain(il, ctx); |
2031 | 2031 | ||
2032 | ctx->staging.assoc_id = 0; | 2032 | ctx->staging.assoc_id = 0; |
2033 | 2033 | ||
@@ -2047,12 +2047,12 @@ static void il4965_config_ap(struct il_priv *priv) | |||
2047 | ~RXON_FLG_SHORT_SLOT_MSK; | 2047 | ~RXON_FLG_SHORT_SLOT_MSK; |
2048 | } | 2048 | } |
2049 | /* need to send beacon cmd before committing assoc RXON! */ | 2049 | /* need to send beacon cmd before committing assoc RXON! */ |
2050 | il4965_send_beacon_cmd(priv); | 2050 | il4965_send_beacon_cmd(il); |
2051 | /* restore RXON assoc */ | 2051 | /* restore RXON assoc */ |
2052 | ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; | 2052 | ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; |
2053 | il_commit_rxon(priv, ctx); | 2053 | il_commit_rxon(il, ctx); |
2054 | } | 2054 | } |
2055 | il4965_send_beacon_cmd(priv); | 2055 | il4965_send_beacon_cmd(il); |
2056 | } | 2056 | } |
2057 | 2057 | ||
2058 | static struct il_hcmd_utils_ops il4965_hcmd_utils = { | 2058 | 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 7b322168bfc..ea2a98e3a4a 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; | |||
73 | extern struct ieee80211_ops il4965_hw_ops; | 73 | extern struct ieee80211_ops il4965_hw_ops; |
74 | 74 | ||
75 | /* tx queue */ | 75 | /* tx queue */ |
76 | void il4965_free_tfds_in_queue(struct il_priv *priv, | 76 | void il4965_free_tfds_in_queue(struct il_priv *il, |
77 | int sta_id, int tid, int freed); | 77 | int sta_id, int tid, int freed); |
78 | 78 | ||
79 | /* RXON */ | 79 | /* RXON */ |
80 | void il4965_set_rxon_chain(struct il_priv *priv, | 80 | void il4965_set_rxon_chain(struct il_priv *il, |
81 | struct il_rxon_context *ctx); | 81 | struct il_rxon_context *ctx); |
82 | 82 | ||
83 | /* uCode */ | 83 | /* uCode */ |
84 | int il4965_verify_ucode(struct il_priv *priv); | 84 | int il4965_verify_ucode(struct il_priv *il); |
85 | 85 | ||
86 | /* lib */ | 86 | /* lib */ |
87 | void il4965_check_abort_status(struct il_priv *priv, | 87 | void il4965_check_abort_status(struct il_priv *il, |
88 | u8 frame_count, u32 status); | 88 | u8 frame_count, u32 status); |
89 | 89 | ||
90 | void il4965_rx_queue_reset(struct il_priv *priv, struct il_rx_queue *rxq); | 90 | void il4965_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq); |
91 | int il4965_rx_init(struct il_priv *priv, struct il_rx_queue *rxq); | 91 | int il4965_rx_init(struct il_priv *il, struct il_rx_queue *rxq); |
92 | int il4965_hw_nic_init(struct il_priv *priv); | 92 | int il4965_hw_nic_init(struct il_priv *il); |
93 | int il4965_dump_fh(struct il_priv *priv, char **buf, bool display); | 93 | int il4965_dump_fh(struct il_priv *il, char **buf, bool display); |
94 | 94 | ||
95 | /* rx */ | 95 | /* rx */ |
96 | void il4965_rx_queue_restock(struct il_priv *priv); | 96 | void il4965_rx_queue_restock(struct il_priv *il); |
97 | void il4965_rx_replenish(struct il_priv *priv); | 97 | void il4965_rx_replenish(struct il_priv *il); |
98 | void il4965_rx_replenish_now(struct il_priv *priv); | 98 | void il4965_rx_replenish_now(struct il_priv *il); |
99 | void il4965_rx_queue_free(struct il_priv *priv, struct il_rx_queue *rxq); | 99 | void il4965_rx_queue_free(struct il_priv *il, struct il_rx_queue *rxq); |
100 | int il4965_rxq_stop(struct il_priv *priv); | 100 | int il4965_rxq_stop(struct il_priv *il); |
101 | int il4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band); | 101 | int il4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band); |
102 | void il4965_rx_reply_rx(struct il_priv *priv, | 102 | void il4965_rx_reply_rx(struct il_priv *il, |
103 | struct il_rx_mem_buffer *rxb); | 103 | struct il_rx_mem_buffer *rxb); |
104 | void il4965_rx_reply_rx_phy(struct il_priv *priv, | 104 | void il4965_rx_reply_rx_phy(struct il_priv *il, |
105 | struct il_rx_mem_buffer *rxb); | 105 | struct il_rx_mem_buffer *rxb); |
106 | void il4965_rx_handle(struct il_priv *priv); | 106 | void il4965_rx_handle(struct il_priv *il); |
107 | 107 | ||
108 | /* tx */ | 108 | /* tx */ |
109 | void il4965_hw_txq_free_tfd(struct il_priv *priv, struct il_tx_queue *txq); | 109 | void il4965_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq); |
110 | int il4965_hw_txq_attach_buf_to_tfd(struct il_priv *priv, | 110 | int il4965_hw_txq_attach_buf_to_tfd(struct il_priv *il, |
111 | struct il_tx_queue *txq, | 111 | struct il_tx_queue *txq, |
112 | dma_addr_t addr, u16 len, u8 reset, u8 pad); | 112 | dma_addr_t addr, u16 len, u8 reset, u8 pad); |
113 | int il4965_hw_tx_queue_init(struct il_priv *priv, | 113 | int il4965_hw_tx_queue_init(struct il_priv *il, |
114 | struct il_tx_queue *txq); | 114 | struct il_tx_queue *txq); |
115 | void il4965_hwrate_to_tx_control(struct il_priv *priv, u32 rate_n_flags, | 115 | void il4965_hwrate_to_tx_control(struct il_priv *il, u32 rate_n_flags, |
116 | struct ieee80211_tx_info *info); | 116 | struct ieee80211_tx_info *info); |
117 | int il4965_tx_skb(struct il_priv *priv, struct sk_buff *skb); | 117 | int il4965_tx_skb(struct il_priv *il, struct sk_buff *skb); |
118 | int il4965_tx_agg_start(struct il_priv *priv, struct ieee80211_vif *vif, | 118 | int il4965_tx_agg_start(struct il_priv *il, struct ieee80211_vif *vif, |
119 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); | 119 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); |
120 | int il4965_tx_agg_stop(struct il_priv *priv, struct ieee80211_vif *vif, | 120 | int il4965_tx_agg_stop(struct il_priv *il, struct ieee80211_vif *vif, |
121 | struct ieee80211_sta *sta, u16 tid); | 121 | struct ieee80211_sta *sta, u16 tid); |
122 | int il4965_txq_check_empty(struct il_priv *priv, | 122 | int il4965_txq_check_empty(struct il_priv *il, |
123 | int sta_id, u8 tid, int txq_id); | 123 | int sta_id, u8 tid, int txq_id); |
124 | void il4965_rx_reply_compressed_ba(struct il_priv *priv, | 124 | void il4965_rx_reply_compressed_ba(struct il_priv *il, |
125 | struct il_rx_mem_buffer *rxb); | 125 | struct il_rx_mem_buffer *rxb); |
126 | int il4965_tx_queue_reclaim(struct il_priv *priv, int txq_id, int index); | 126 | int il4965_tx_queue_reclaim(struct il_priv *il, int txq_id, int index); |
127 | void il4965_hw_txq_ctx_free(struct il_priv *priv); | 127 | void il4965_hw_txq_ctx_free(struct il_priv *il); |
128 | int il4965_txq_ctx_alloc(struct il_priv *priv); | 128 | int il4965_txq_ctx_alloc(struct il_priv *il); |
129 | void il4965_txq_ctx_reset(struct il_priv *priv); | 129 | void il4965_txq_ctx_reset(struct il_priv *il); |
130 | void il4965_txq_ctx_stop(struct il_priv *priv); | 130 | void il4965_txq_ctx_stop(struct il_priv *il); |
131 | void il4965_txq_set_sched(struct il_priv *priv, u32 mask); | 131 | void il4965_txq_set_sched(struct il_priv *il, u32 mask); |
132 | 132 | ||
133 | /* | 133 | /* |
134 | * Acquire priv->lock before calling this function ! | 134 | * Acquire il->lock before calling this function ! |
135 | */ | 135 | */ |
136 | void il4965_set_wr_ptrs(struct il_priv *priv, int txq_id, u32 index); | 136 | void il4965_set_wr_ptrs(struct il_priv *il, int txq_id, u32 index); |
137 | /** | 137 | /** |
138 | * il4965_tx_queue_set_status - (optionally) start Tx/Cmd queue | 138 | * il4965_tx_queue_set_status - (optionally) start Tx/Cmd queue |
139 | * @tx_fifo_id: Tx DMA/FIFO channel (range 0-7) that the queue will feed | 139 | * @tx_fifo_id: Tx DMA/FIFO channel (range 0-7) that the queue will feed |
140 | * @scd_retry: (1) Indicates queue will be used in aggregation mode | 140 | * @scd_retry: (1) Indicates queue will be used in aggregation mode |
141 | * | 141 | * |
142 | * NOTE: Acquire priv->lock before calling this function ! | 142 | * NOTE: Acquire il->lock before calling this function ! |
143 | */ | 143 | */ |
144 | void il4965_tx_queue_set_status(struct il_priv *priv, | 144 | void il4965_tx_queue_set_status(struct il_priv *il, |
145 | struct il_tx_queue *txq, | 145 | struct il_tx_queue *txq, |
146 | int tx_fifo_id, int scd_retry); | 146 | int tx_fifo_id, int scd_retry); |
147 | 147 | ||
@@ -167,27 +167,27 @@ static inline bool il4965_is_tx_success(u32 status) | |||
167 | (status == TX_STATUS_DIRECT_DONE); | 167 | (status == TX_STATUS_DIRECT_DONE); |
168 | } | 168 | } |
169 | 169 | ||
170 | u8 il4965_toggle_tx_ant(struct il_priv *priv, u8 ant_idx, u8 valid); | 170 | u8 il4965_toggle_tx_ant(struct il_priv *il, u8 ant_idx, u8 valid); |
171 | 171 | ||
172 | /* rx */ | 172 | /* rx */ |
173 | void il4965_rx_missed_beacon_notif(struct il_priv *priv, | 173 | void il4965_rx_missed_beacon_notif(struct il_priv *il, |
174 | struct il_rx_mem_buffer *rxb); | 174 | struct il_rx_mem_buffer *rxb); |
175 | bool il4965_good_plcp_health(struct il_priv *priv, | 175 | bool il4965_good_plcp_health(struct il_priv *il, |
176 | struct il_rx_packet *pkt); | 176 | struct il_rx_packet *pkt); |
177 | void il4965_rx_statistics(struct il_priv *priv, | 177 | void il4965_rx_statistics(struct il_priv *il, |
178 | struct il_rx_mem_buffer *rxb); | 178 | struct il_rx_mem_buffer *rxb); |
179 | void il4965_reply_statistics(struct il_priv *priv, | 179 | void il4965_reply_statistics(struct il_priv *il, |
180 | struct il_rx_mem_buffer *rxb); | 180 | struct il_rx_mem_buffer *rxb); |
181 | 181 | ||
182 | /* scan */ | 182 | /* scan */ |
183 | int il4965_request_scan(struct il_priv *priv, struct ieee80211_vif *vif); | 183 | int il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif); |
184 | 184 | ||
185 | /* station mgmt */ | 185 | /* station mgmt */ |
186 | int il4965_manage_ibss_station(struct il_priv *priv, | 186 | int il4965_manage_ibss_station(struct il_priv *il, |
187 | struct ieee80211_vif *vif, bool add); | 187 | struct ieee80211_vif *vif, bool add); |
188 | 188 | ||
189 | /* hcmd */ | 189 | /* hcmd */ |
190 | int il4965_send_beacon_cmd(struct il_priv *priv); | 190 | int il4965_send_beacon_cmd(struct il_priv *il); |
191 | 191 | ||
192 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 192 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
193 | const char *il4965_get_tx_fail_reason(u32 status); | 193 | const char *il4965_get_tx_fail_reason(u32 status); |
@@ -197,38 +197,38 @@ il4965_get_tx_fail_reason(u32 status) { return ""; } | |||
197 | #endif | 197 | #endif |
198 | 198 | ||
199 | /* station management */ | 199 | /* station management */ |
200 | int il4965_alloc_bcast_station(struct il_priv *priv, | 200 | int il4965_alloc_bcast_station(struct il_priv *il, |
201 | struct il_rxon_context *ctx); | 201 | struct il_rxon_context *ctx); |
202 | int il4965_add_bssid_station(struct il_priv *priv, | 202 | int il4965_add_bssid_station(struct il_priv *il, |
203 | struct il_rxon_context *ctx, | 203 | struct il_rxon_context *ctx, |
204 | const u8 *addr, u8 *sta_id_r); | 204 | const u8 *addr, u8 *sta_id_r); |
205 | int il4965_remove_default_wep_key(struct il_priv *priv, | 205 | int il4965_remove_default_wep_key(struct il_priv *il, |
206 | struct il_rxon_context *ctx, | 206 | struct il_rxon_context *ctx, |
207 | struct ieee80211_key_conf *key); | 207 | struct ieee80211_key_conf *key); |
208 | int il4965_set_default_wep_key(struct il_priv *priv, | 208 | int il4965_set_default_wep_key(struct il_priv *il, |
209 | struct il_rxon_context *ctx, | 209 | struct il_rxon_context *ctx, |
210 | struct ieee80211_key_conf *key); | 210 | struct ieee80211_key_conf *key); |
211 | int il4965_restore_default_wep_keys(struct il_priv *priv, | 211 | int il4965_restore_default_wep_keys(struct il_priv *il, |
212 | struct il_rxon_context *ctx); | 212 | struct il_rxon_context *ctx); |
213 | int il4965_set_dynamic_key(struct il_priv *priv, | 213 | int il4965_set_dynamic_key(struct il_priv *il, |
214 | struct il_rxon_context *ctx, | 214 | struct il_rxon_context *ctx, |
215 | struct ieee80211_key_conf *key, u8 sta_id); | 215 | struct ieee80211_key_conf *key, u8 sta_id); |
216 | int il4965_remove_dynamic_key(struct il_priv *priv, | 216 | int il4965_remove_dynamic_key(struct il_priv *il, |
217 | struct il_rxon_context *ctx, | 217 | struct il_rxon_context *ctx, |
218 | struct ieee80211_key_conf *key, u8 sta_id); | 218 | struct ieee80211_key_conf *key, u8 sta_id); |
219 | void il4965_update_tkip_key(struct il_priv *priv, | 219 | void il4965_update_tkip_key(struct il_priv *il, |
220 | struct il_rxon_context *ctx, | 220 | struct il_rxon_context *ctx, |
221 | struct ieee80211_key_conf *keyconf, | 221 | struct ieee80211_key_conf *keyconf, |
222 | struct ieee80211_sta *sta, u32 iv32, u16 *phase1key); | 222 | struct ieee80211_sta *sta, u32 iv32, u16 *phase1key); |
223 | int il4965_sta_tx_modify_enable_tid(struct il_priv *priv, | 223 | int il4965_sta_tx_modify_enable_tid(struct il_priv *il, |
224 | int sta_id, int tid); | 224 | int sta_id, int tid); |
225 | int il4965_sta_rx_agg_start(struct il_priv *priv, struct ieee80211_sta *sta, | 225 | int il4965_sta_rx_agg_start(struct il_priv *il, struct ieee80211_sta *sta, |
226 | int tid, u16 ssn); | 226 | int tid, u16 ssn); |
227 | int il4965_sta_rx_agg_stop(struct il_priv *priv, struct ieee80211_sta *sta, | 227 | int il4965_sta_rx_agg_stop(struct il_priv *il, struct ieee80211_sta *sta, |
228 | int tid); | 228 | int tid); |
229 | void il4965_sta_modify_sleep_tx_count(struct il_priv *priv, | 229 | void il4965_sta_modify_sleep_tx_count(struct il_priv *il, |
230 | int sta_id, int cnt); | 230 | int sta_id, int cnt); |
231 | int il4965_update_bcast_stations(struct il_priv *priv); | 231 | int il4965_update_bcast_stations(struct il_priv *il); |
232 | 232 | ||
233 | /* rate */ | 233 | /* rate */ |
234 | static inline u32 il4965_ant_idx_to_flags(u8 ant_idx) | 234 | 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) | |||
247 | } | 247 | } |
248 | 248 | ||
249 | /* eeprom */ | 249 | /* eeprom */ |
250 | void il4965_eeprom_get_mac(const struct il_priv *priv, u8 *mac); | 250 | void il4965_eeprom_get_mac(const struct il_priv *il, u8 *mac); |
251 | int il4965_eeprom_acquire_semaphore(struct il_priv *priv); | 251 | int il4965_eeprom_acquire_semaphore(struct il_priv *il); |
252 | void il4965_eeprom_release_semaphore(struct il_priv *priv); | 252 | void il4965_eeprom_release_semaphore(struct il_priv *il); |
253 | int il4965_eeprom_check_version(struct il_priv *priv); | 253 | int il4965_eeprom_check_version(struct il_priv *il); |
254 | 254 | ||
255 | /* mac80211 handlers (for 4965) */ | 255 | /* mac80211 handlers (for 4965) */ |
256 | void il4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb); | 256 | 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 7eae279e4c6..80ec543dd89 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 }; | |||
75 | EXPORT_SYMBOL(iwlegacy_bcast_addr); | 75 | EXPORT_SYMBOL(iwlegacy_bcast_addr); |
76 | 76 | ||
77 | 77 | ||
78 | /* This function both allocates and initializes hw and priv. */ | 78 | /* This function both allocates and initializes hw and il. */ |
79 | struct ieee80211_hw *il_alloc_all(struct il_cfg *cfg) | 79 | struct ieee80211_hw *il_alloc_all(struct il_cfg *cfg) |
80 | { | 80 | { |
81 | struct il_priv *priv; | 81 | struct il_priv *il; |
82 | /* mac80211 allocates memory for this device instance, including | 82 | /* mac80211 allocates memory for this device instance, including |
83 | * space for this driver's private structure */ | 83 | * space for this driver's ilate structure */ |
84 | struct ieee80211_hw *hw; | 84 | struct ieee80211_hw *hw; |
85 | 85 | ||
86 | hw = ieee80211_alloc_hw(sizeof(struct il_priv), | 86 | hw = ieee80211_alloc_hw(sizeof(struct il_priv), |
@@ -91,8 +91,8 @@ struct ieee80211_hw *il_alloc_all(struct il_cfg *cfg) | |||
91 | goto out; | 91 | goto out; |
92 | } | 92 | } |
93 | 93 | ||
94 | priv = hw->priv; | 94 | il = hw->priv; |
95 | priv->hw = hw; | 95 | il->hw = hw; |
96 | 96 | ||
97 | out: | 97 | out: |
98 | return hw; | 98 | return hw; |
@@ -101,13 +101,13 @@ EXPORT_SYMBOL(il_alloc_all); | |||
101 | 101 | ||
102 | #define MAX_BIT_RATE_40_MHZ 150 /* Mbps */ | 102 | #define MAX_BIT_RATE_40_MHZ 150 /* Mbps */ |
103 | #define MAX_BIT_RATE_20_MHZ 72 /* Mbps */ | 103 | #define MAX_BIT_RATE_20_MHZ 72 /* Mbps */ |
104 | static void il_init_ht_hw_capab(const struct il_priv *priv, | 104 | static void il_init_ht_hw_capab(const struct il_priv *il, |
105 | struct ieee80211_sta_ht_cap *ht_info, | 105 | struct ieee80211_sta_ht_cap *ht_info, |
106 | enum ieee80211_band band) | 106 | enum ieee80211_band band) |
107 | { | 107 | { |
108 | u16 max_bit_rate = 0; | 108 | u16 max_bit_rate = 0; |
109 | u8 rx_chains_num = priv->hw_params.rx_chains_num; | 109 | u8 rx_chains_num = il->hw_params.rx_chains_num; |
110 | u8 tx_chains_num = priv->hw_params.tx_chains_num; | 110 | u8 tx_chains_num = il->hw_params.tx_chains_num; |
111 | 111 | ||
112 | ht_info->cap = 0; | 112 | ht_info->cap = 0; |
113 | memset(&ht_info->mcs, 0, sizeof(ht_info->mcs)); | 113 | 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, | |||
116 | 116 | ||
117 | ht_info->cap |= IEEE80211_HT_CAP_SGI_20; | 117 | ht_info->cap |= IEEE80211_HT_CAP_SGI_20; |
118 | max_bit_rate = MAX_BIT_RATE_20_MHZ; | 118 | max_bit_rate = MAX_BIT_RATE_20_MHZ; |
119 | if (priv->hw_params.ht40_channel & BIT(band)) { | 119 | if (il->hw_params.ht40_channel & BIT(band)) { |
120 | ht_info->cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; | 120 | ht_info->cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
121 | ht_info->cap |= IEEE80211_HT_CAP_SGI_40; | 121 | ht_info->cap |= IEEE80211_HT_CAP_SGI_40; |
122 | ht_info->mcs.rx_mask[4] = 0x01; | 122 | ht_info->mcs.rx_mask[4] = 0x01; |
123 | max_bit_rate = MAX_BIT_RATE_40_MHZ; | 123 | max_bit_rate = MAX_BIT_RATE_40_MHZ; |
124 | } | 124 | } |
125 | 125 | ||
126 | if (priv->cfg->mod_params->amsdu_size_8K) | 126 | if (il->cfg->mod_params->amsdu_size_8K) |
127 | ht_info->cap |= IEEE80211_HT_CAP_MAX_AMSDU; | 127 | ht_info->cap |= IEEE80211_HT_CAP_MAX_AMSDU; |
128 | 128 | ||
129 | ht_info->ampdu_factor = CFG_HT_RX_AMPDU_FACTOR_DEF; | 129 | 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, | |||
152 | /** | 152 | /** |
153 | * il_init_geos - Initialize mac80211's geo/channel info based from eeprom | 153 | * il_init_geos - Initialize mac80211's geo/channel info based from eeprom |
154 | */ | 154 | */ |
155 | int il_init_geos(struct il_priv *priv) | 155 | int il_init_geos(struct il_priv *il) |
156 | { | 156 | { |
157 | struct il_channel_info *ch; | 157 | struct il_channel_info *ch; |
158 | struct ieee80211_supported_band *sband; | 158 | struct ieee80211_supported_band *sband; |
@@ -162,15 +162,15 @@ int il_init_geos(struct il_priv *priv) | |||
162 | int i = 0; | 162 | int i = 0; |
163 | s8 max_tx_power = 0; | 163 | s8 max_tx_power = 0; |
164 | 164 | ||
165 | if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates || | 165 | if (il->bands[IEEE80211_BAND_2GHZ].n_bitrates || |
166 | priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) { | 166 | il->bands[IEEE80211_BAND_5GHZ].n_bitrates) { |
167 | IL_DEBUG_INFO(priv, "Geography modes already initialized.\n"); | 167 | IL_DEBUG_INFO(il, "Geography modes already initialized.\n"); |
168 | set_bit(STATUS_GEO_CONFIGURED, &priv->status); | 168 | set_bit(STATUS_GEO_CONFIGURED, &il->status); |
169 | return 0; | 169 | return 0; |
170 | } | 170 | } |
171 | 171 | ||
172 | channels = kzalloc(sizeof(struct ieee80211_channel) * | 172 | channels = kzalloc(sizeof(struct ieee80211_channel) * |
173 | priv->channel_count, GFP_KERNEL); | 173 | il->channel_count, GFP_KERNEL); |
174 | if (!channels) | 174 | if (!channels) |
175 | return -ENOMEM; | 175 | return -ENOMEM; |
176 | 176 | ||
@@ -182,36 +182,36 @@ int il_init_geos(struct il_priv *priv) | |||
182 | } | 182 | } |
183 | 183 | ||
184 | /* 5.2GHz channels start after the 2.4GHz channels */ | 184 | /* 5.2GHz channels start after the 2.4GHz channels */ |
185 | sband = &priv->bands[IEEE80211_BAND_5GHZ]; | 185 | sband = &il->bands[IEEE80211_BAND_5GHZ]; |
186 | sband->channels = &channels[ARRAY_SIZE(iwlegacy_eeprom_band_1)]; | 186 | sband->channels = &channels[ARRAY_SIZE(iwlegacy_eeprom_band_1)]; |
187 | /* just OFDM */ | 187 | /* just OFDM */ |
188 | sband->bitrates = &rates[IL_FIRST_OFDM_RATE]; | 188 | sband->bitrates = &rates[IL_FIRST_OFDM_RATE]; |
189 | sband->n_bitrates = IL_RATE_COUNT_LEGACY - IL_FIRST_OFDM_RATE; | 189 | sband->n_bitrates = IL_RATE_COUNT_LEGACY - IL_FIRST_OFDM_RATE; |
190 | 190 | ||
191 | if (priv->cfg->sku & IL_SKU_N) | 191 | if (il->cfg->sku & IL_SKU_N) |
192 | il_init_ht_hw_capab(priv, &sband->ht_cap, | 192 | il_init_ht_hw_capab(il, &sband->ht_cap, |
193 | IEEE80211_BAND_5GHZ); | 193 | IEEE80211_BAND_5GHZ); |
194 | 194 | ||
195 | sband = &priv->bands[IEEE80211_BAND_2GHZ]; | 195 | sband = &il->bands[IEEE80211_BAND_2GHZ]; |
196 | sband->channels = channels; | 196 | sband->channels = channels; |
197 | /* OFDM & CCK */ | 197 | /* OFDM & CCK */ |
198 | sband->bitrates = rates; | 198 | sband->bitrates = rates; |
199 | sband->n_bitrates = IL_RATE_COUNT_LEGACY; | 199 | sband->n_bitrates = IL_RATE_COUNT_LEGACY; |
200 | 200 | ||
201 | if (priv->cfg->sku & IL_SKU_N) | 201 | if (il->cfg->sku & IL_SKU_N) |
202 | il_init_ht_hw_capab(priv, &sband->ht_cap, | 202 | il_init_ht_hw_capab(il, &sband->ht_cap, |
203 | IEEE80211_BAND_2GHZ); | 203 | IEEE80211_BAND_2GHZ); |
204 | 204 | ||
205 | priv->ieee_channels = channels; | 205 | il->ieee_channels = channels; |
206 | priv->ieee_rates = rates; | 206 | il->ieee_rates = rates; |
207 | 207 | ||
208 | for (i = 0; i < priv->channel_count; i++) { | 208 | for (i = 0; i < il->channel_count; i++) { |
209 | ch = &priv->channel_info[i]; | 209 | ch = &il->channel_info[i]; |
210 | 210 | ||
211 | if (!il_is_channel_valid(ch)) | 211 | if (!il_is_channel_valid(ch)) |
212 | continue; | 212 | continue; |
213 | 213 | ||
214 | sband = &priv->bands[ch->band]; | 214 | sband = &il->bands[ch->band]; |
215 | 215 | ||
216 | geo_ch = &sband->channels[sband->n_channels++]; | 216 | geo_ch = &sband->channels[sband->n_channels++]; |
217 | 217 | ||
@@ -239,7 +239,7 @@ int il_init_geos(struct il_priv *priv) | |||
239 | geo_ch->flags |= IEEE80211_CHAN_DISABLED; | 239 | geo_ch->flags |= IEEE80211_CHAN_DISABLED; |
240 | } | 240 | } |
241 | 241 | ||
242 | IL_DEBUG_INFO(priv, "Channel %d Freq=%d[%sGHz] %s flag=0x%X\n", | 242 | IL_DEBUG_INFO(il, "Channel %d Freq=%d[%sGHz] %s flag=0x%X\n", |
243 | ch->channel, geo_ch->center_freq, | 243 | ch->channel, geo_ch->center_freq, |
244 | il_is_channel_a_band(ch) ? "5.2" : "2.4", | 244 | il_is_channel_a_band(ch) ? "5.2" : "2.4", |
245 | geo_ch->flags & IEEE80211_CHAN_DISABLED ? | 245 | geo_ch->flags & IEEE80211_CHAN_DISABLED ? |
@@ -247,24 +247,24 @@ int il_init_geos(struct il_priv *priv) | |||
247 | geo_ch->flags); | 247 | geo_ch->flags); |
248 | } | 248 | } |
249 | 249 | ||
250 | priv->tx_power_device_lmt = max_tx_power; | 250 | il->tx_power_device_lmt = max_tx_power; |
251 | priv->tx_power_user_lmt = max_tx_power; | 251 | il->tx_power_user_lmt = max_tx_power; |
252 | priv->tx_power_next = max_tx_power; | 252 | il->tx_power_next = max_tx_power; |
253 | 253 | ||
254 | if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) && | 254 | if ((il->bands[IEEE80211_BAND_5GHZ].n_channels == 0) && |
255 | priv->cfg->sku & IL_SKU_A) { | 255 | il->cfg->sku & IL_SKU_A) { |
256 | IL_INFO(priv, "Incorrectly detected BG card as ABG. " | 256 | IL_INFO(il, "Incorrectly detected BG card as ABG. " |
257 | "Please send your PCI ID 0x%04X:0x%04X to maintainer.\n", | 257 | "Please send your PCI ID 0x%04X:0x%04X to maintainer.\n", |
258 | priv->pci_dev->device, | 258 | il->pci_dev->device, |
259 | priv->pci_dev->subsystem_device); | 259 | il->pci_dev->subsystem_device); |
260 | priv->cfg->sku &= ~IL_SKU_A; | 260 | il->cfg->sku &= ~IL_SKU_A; |
261 | } | 261 | } |
262 | 262 | ||
263 | IL_INFO(priv, "Tunable channels: %d 802.11bg, %d 802.11a channels\n", | 263 | IL_INFO(il, "Tunable channels: %d 802.11bg, %d 802.11a channels\n", |
264 | priv->bands[IEEE80211_BAND_2GHZ].n_channels, | 264 | il->bands[IEEE80211_BAND_2GHZ].n_channels, |
265 | priv->bands[IEEE80211_BAND_5GHZ].n_channels); | 265 | il->bands[IEEE80211_BAND_5GHZ].n_channels); |
266 | 266 | ||
267 | set_bit(STATUS_GEO_CONFIGURED, &priv->status); | 267 | set_bit(STATUS_GEO_CONFIGURED, &il->status); |
268 | 268 | ||
269 | return 0; | 269 | return 0; |
270 | } | 270 | } |
@@ -273,21 +273,21 @@ EXPORT_SYMBOL(il_init_geos); | |||
273 | /* | 273 | /* |
274 | * il_free_geos - undo allocations in il_init_geos | 274 | * il_free_geos - undo allocations in il_init_geos |
275 | */ | 275 | */ |
276 | void il_free_geos(struct il_priv *priv) | 276 | void il_free_geos(struct il_priv *il) |
277 | { | 277 | { |
278 | kfree(priv->ieee_channels); | 278 | kfree(il->ieee_channels); |
279 | kfree(priv->ieee_rates); | 279 | kfree(il->ieee_rates); |
280 | clear_bit(STATUS_GEO_CONFIGURED, &priv->status); | 280 | clear_bit(STATUS_GEO_CONFIGURED, &il->status); |
281 | } | 281 | } |
282 | EXPORT_SYMBOL(il_free_geos); | 282 | EXPORT_SYMBOL(il_free_geos); |
283 | 283 | ||
284 | static bool il_is_channel_extension(struct il_priv *priv, | 284 | static bool il_is_channel_extension(struct il_priv *il, |
285 | enum ieee80211_band band, | 285 | enum ieee80211_band band, |
286 | u16 channel, u8 extension_chan_offset) | 286 | u16 channel, u8 extension_chan_offset) |
287 | { | 287 | { |
288 | const struct il_channel_info *ch_info; | 288 | const struct il_channel_info *ch_info; |
289 | 289 | ||
290 | ch_info = il_get_channel_info(priv, band, channel); | 290 | ch_info = il_get_channel_info(il, band, channel); |
291 | if (!il_is_channel_valid(ch_info)) | 291 | if (!il_is_channel_valid(ch_info)) |
292 | return false; | 292 | return false; |
293 | 293 | ||
@@ -301,7 +301,7 @@ static bool il_is_channel_extension(struct il_priv *priv, | |||
301 | return false; | 301 | return false; |
302 | } | 302 | } |
303 | 303 | ||
304 | bool il_is_ht40_tx_allowed(struct il_priv *priv, | 304 | bool il_is_ht40_tx_allowed(struct il_priv *il, |
305 | struct il_rxon_context *ctx, | 305 | struct il_rxon_context *ctx, |
306 | struct ieee80211_sta_ht_cap *ht_cap) | 306 | struct ieee80211_sta_ht_cap *ht_cap) |
307 | { | 307 | { |
@@ -316,11 +316,11 @@ bool il_is_ht40_tx_allowed(struct il_priv *priv, | |||
316 | return false; | 316 | return false; |
317 | 317 | ||
318 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS | 318 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS |
319 | if (priv->disable_ht40) | 319 | if (il->disable_ht40) |
320 | return false; | 320 | return false; |
321 | #endif | 321 | #endif |
322 | 322 | ||
323 | return il_is_channel_extension(priv, priv->band, | 323 | return il_is_channel_extension(il, il->band, |
324 | le16_to_cpu(ctx->staging.channel), | 324 | le16_to_cpu(ctx->staging.channel), |
325 | ctx->ht.extension_chan_offset); | 325 | ctx->ht.extension_chan_offset); |
326 | } | 326 | } |
@@ -360,7 +360,7 @@ static u16 il_adjust_beacon_interval(u16 beacon_val, u16 max_beacon_val) | |||
360 | } | 360 | } |
361 | 361 | ||
362 | int | 362 | int |
363 | il_send_rxon_timing(struct il_priv *priv, struct il_rxon_context *ctx) | 363 | il_send_rxon_timing(struct il_priv *il, struct il_rxon_context *ctx) |
364 | { | 364 | { |
365 | u64 tsf; | 365 | u64 tsf; |
366 | s32 interval_tm, rem; | 366 | s32 interval_tm, rem; |
@@ -368,13 +368,13 @@ il_send_rxon_timing(struct il_priv *priv, struct il_rxon_context *ctx) | |||
368 | u16 beacon_int; | 368 | u16 beacon_int; |
369 | struct ieee80211_vif *vif = ctx->vif; | 369 | struct ieee80211_vif *vif = ctx->vif; |
370 | 370 | ||
371 | conf = il_ieee80211_get_hw_conf(priv->hw); | 371 | conf = il_ieee80211_get_hw_conf(il->hw); |
372 | 372 | ||
373 | lockdep_assert_held(&priv->mutex); | 373 | lockdep_assert_held(&il->mutex); |
374 | 374 | ||
375 | memset(&ctx->timing, 0, sizeof(struct il_rxon_time_cmd)); | 375 | memset(&ctx->timing, 0, sizeof(struct il_rxon_time_cmd)); |
376 | 376 | ||
377 | ctx->timing.timestamp = cpu_to_le64(priv->timestamp); | 377 | ctx->timing.timestamp = cpu_to_le64(il->timestamp); |
378 | ctx->timing.listen_interval = cpu_to_le16(conf->listen_interval); | 378 | ctx->timing.listen_interval = cpu_to_le16(conf->listen_interval); |
379 | 379 | ||
380 | beacon_int = vif ? vif->bss_conf.beacon_int : 0; | 380 | 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) | |||
386 | ctx->timing.atim_window = 0; | 386 | ctx->timing.atim_window = 0; |
387 | 387 | ||
388 | beacon_int = il_adjust_beacon_interval(beacon_int, | 388 | beacon_int = il_adjust_beacon_interval(beacon_int, |
389 | priv->hw_params.max_beacon_itrvl * TIME_UNIT); | 389 | il->hw_params.max_beacon_itrvl * TIME_UNIT); |
390 | ctx->timing.beacon_interval = cpu_to_le16(beacon_int); | 390 | ctx->timing.beacon_interval = cpu_to_le16(beacon_int); |
391 | 391 | ||
392 | tsf = priv->timestamp; /* tsf is modifed by do_div: copy it */ | 392 | tsf = il->timestamp; /* tsf is modifed by do_div: copy it */ |
393 | interval_tm = beacon_int * TIME_UNIT; | 393 | interval_tm = beacon_int * TIME_UNIT; |
394 | rem = do_div(tsf, interval_tm); | 394 | rem = do_div(tsf, interval_tm); |
395 | ctx->timing.beacon_init_val = cpu_to_le32(interval_tm - rem); | 395 | ctx->timing.beacon_init_val = cpu_to_le32(interval_tm - rem); |
396 | 396 | ||
397 | ctx->timing.dtim_period = vif ? (vif->bss_conf.dtim_period ?: 1) : 1; | 397 | ctx->timing.dtim_period = vif ? (vif->bss_conf.dtim_period ?: 1) : 1; |
398 | 398 | ||
399 | IL_DEBUG_ASSOC(priv, | 399 | IL_DEBUG_ASSOC(il, |
400 | "beacon interval %d beacon timer %d beacon tim %d\n", | 400 | "beacon interval %d beacon timer %d beacon tim %d\n", |
401 | le16_to_cpu(ctx->timing.beacon_interval), | 401 | le16_to_cpu(ctx->timing.beacon_interval), |
402 | le32_to_cpu(ctx->timing.beacon_init_val), | 402 | le32_to_cpu(ctx->timing.beacon_init_val), |
403 | le16_to_cpu(ctx->timing.atim_window)); | 403 | le16_to_cpu(ctx->timing.atim_window)); |
404 | 404 | ||
405 | return il_send_cmd_pdu(priv, ctx->rxon_timing_cmd, | 405 | return il_send_cmd_pdu(il, ctx->rxon_timing_cmd, |
406 | sizeof(ctx->timing), &ctx->timing); | 406 | sizeof(ctx->timing), &ctx->timing); |
407 | } | 407 | } |
408 | EXPORT_SYMBOL(il_send_rxon_timing); | 408 | EXPORT_SYMBOL(il_send_rxon_timing); |
409 | 409 | ||
410 | void | 410 | void |
411 | il_set_rxon_hwcrypto(struct il_priv *priv, | 411 | il_set_rxon_hwcrypto(struct il_priv *il, |
412 | struct il_rxon_context *ctx, | 412 | struct il_rxon_context *ctx, |
413 | int hw_decrypt) | 413 | int hw_decrypt) |
414 | { | 414 | { |
@@ -424,72 +424,72 @@ EXPORT_SYMBOL(il_set_rxon_hwcrypto); | |||
424 | 424 | ||
425 | /* validate RXON structure is valid */ | 425 | /* validate RXON structure is valid */ |
426 | int | 426 | int |
427 | il_check_rxon_cmd(struct il_priv *priv, struct il_rxon_context *ctx) | 427 | il_check_rxon_cmd(struct il_priv *il, struct il_rxon_context *ctx) |
428 | { | 428 | { |
429 | struct il_rxon_cmd *rxon = &ctx->staging; | 429 | struct il_rxon_cmd *rxon = &ctx->staging; |
430 | bool error = false; | 430 | bool error = false; |
431 | 431 | ||
432 | if (rxon->flags & RXON_FLG_BAND_24G_MSK) { | 432 | if (rxon->flags & RXON_FLG_BAND_24G_MSK) { |
433 | if (rxon->flags & RXON_FLG_TGJ_NARROW_BAND_MSK) { | 433 | if (rxon->flags & RXON_FLG_TGJ_NARROW_BAND_MSK) { |
434 | IL_WARN(priv, "check 2.4G: wrong narrow\n"); | 434 | IL_WARN(il, "check 2.4G: wrong narrow\n"); |
435 | error = true; | 435 | error = true; |
436 | } | 436 | } |
437 | if (rxon->flags & RXON_FLG_RADAR_DETECT_MSK) { | 437 | if (rxon->flags & RXON_FLG_RADAR_DETECT_MSK) { |
438 | IL_WARN(priv, "check 2.4G: wrong radar\n"); | 438 | IL_WARN(il, "check 2.4G: wrong radar\n"); |
439 | error = true; | 439 | error = true; |
440 | } | 440 | } |
441 | } else { | 441 | } else { |
442 | if (!(rxon->flags & RXON_FLG_SHORT_SLOT_MSK)) { | 442 | if (!(rxon->flags & RXON_FLG_SHORT_SLOT_MSK)) { |
443 | IL_WARN(priv, "check 5.2G: not short slot!\n"); | 443 | IL_WARN(il, "check 5.2G: not short slot!\n"); |
444 | error = true; | 444 | error = true; |
445 | } | 445 | } |
446 | if (rxon->flags & RXON_FLG_CCK_MSK) { | 446 | if (rxon->flags & RXON_FLG_CCK_MSK) { |
447 | IL_WARN(priv, "check 5.2G: CCK!\n"); | 447 | IL_WARN(il, "check 5.2G: CCK!\n"); |
448 | error = true; | 448 | error = true; |
449 | } | 449 | } |
450 | } | 450 | } |
451 | if ((rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1) { | 451 | if ((rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1) { |
452 | IL_WARN(priv, "mac/bssid mcast!\n"); | 452 | IL_WARN(il, "mac/bssid mcast!\n"); |
453 | error = true; | 453 | error = true; |
454 | } | 454 | } |
455 | 455 | ||
456 | /* make sure basic rates 6Mbps and 1Mbps are supported */ | 456 | /* make sure basic rates 6Mbps and 1Mbps are supported */ |
457 | if ((rxon->ofdm_basic_rates & IL_RATE_6M_MASK) == 0 && | 457 | if ((rxon->ofdm_basic_rates & IL_RATE_6M_MASK) == 0 && |
458 | (rxon->cck_basic_rates & IL_RATE_1M_MASK) == 0) { | 458 | (rxon->cck_basic_rates & IL_RATE_1M_MASK) == 0) { |
459 | IL_WARN(priv, "neither 1 nor 6 are basic\n"); | 459 | IL_WARN(il, "neither 1 nor 6 are basic\n"); |
460 | error = true; | 460 | error = true; |
461 | } | 461 | } |
462 | 462 | ||
463 | if (le16_to_cpu(rxon->assoc_id) > 2007) { | 463 | if (le16_to_cpu(rxon->assoc_id) > 2007) { |
464 | IL_WARN(priv, "aid > 2007\n"); | 464 | IL_WARN(il, "aid > 2007\n"); |
465 | error = true; | 465 | error = true; |
466 | } | 466 | } |
467 | 467 | ||
468 | if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)) | 468 | if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)) |
469 | == (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)) { | 469 | == (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)) { |
470 | IL_WARN(priv, "CCK and short slot\n"); | 470 | IL_WARN(il, "CCK and short slot\n"); |
471 | error = true; | 471 | error = true; |
472 | } | 472 | } |
473 | 473 | ||
474 | if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) | 474 | if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) |
475 | == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) { | 475 | == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) { |
476 | IL_WARN(priv, "CCK and auto detect"); | 476 | IL_WARN(il, "CCK and auto detect"); |
477 | error = true; | 477 | error = true; |
478 | } | 478 | } |
479 | 479 | ||
480 | if ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK | | 480 | if ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK | |
481 | RXON_FLG_TGG_PROTECT_MSK)) == | 481 | RXON_FLG_TGG_PROTECT_MSK)) == |
482 | RXON_FLG_TGG_PROTECT_MSK) { | 482 | RXON_FLG_TGG_PROTECT_MSK) { |
483 | IL_WARN(priv, "TGg but no auto-detect\n"); | 483 | IL_WARN(il, "TGg but no auto-detect\n"); |
484 | error = true; | 484 | error = true; |
485 | } | 485 | } |
486 | 486 | ||
487 | if (error) | 487 | if (error) |
488 | IL_WARN(priv, "Tuning to channel %d\n", | 488 | IL_WARN(il, "Tuning to channel %d\n", |
489 | le16_to_cpu(rxon->channel)); | 489 | le16_to_cpu(rxon->channel)); |
490 | 490 | ||
491 | if (error) { | 491 | if (error) { |
492 | IL_ERR(priv, "Invalid RXON\n"); | 492 | IL_ERR(il, "Invalid RXON\n"); |
493 | return -EINVAL; | 493 | return -EINVAL; |
494 | } | 494 | } |
495 | return 0; | 495 | return 0; |
@@ -498,13 +498,13 @@ EXPORT_SYMBOL(il_check_rxon_cmd); | |||
498 | 498 | ||
499 | /** | 499 | /** |
500 | * il_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed | 500 | * il_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed |
501 | * @priv: staging_rxon is compared to active_rxon | 501 | * @il: staging_rxon is compared to active_rxon |
502 | * | 502 | * |
503 | * If the RXON structure is changing enough to require a new tune, | 503 | * If the RXON structure is changing enough to require a new tune, |
504 | * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that | 504 | * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that |
505 | * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required. | 505 | * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required. |
506 | */ | 506 | */ |
507 | int il_full_rxon_required(struct il_priv *priv, | 507 | int il_full_rxon_required(struct il_priv *il, |
508 | struct il_rxon_context *ctx) | 508 | struct il_rxon_context *ctx) |
509 | { | 509 | { |
510 | const struct il_rxon_cmd *staging = &ctx->staging; | 510 | const struct il_rxon_cmd *staging = &ctx->staging; |
@@ -512,13 +512,13 @@ int il_full_rxon_required(struct il_priv *priv, | |||
512 | 512 | ||
513 | #define CHK(cond) \ | 513 | #define CHK(cond) \ |
514 | if ((cond)) { \ | 514 | if ((cond)) { \ |
515 | IL_DEBUG_INFO(priv, "need full RXON - " #cond "\n"); \ | 515 | IL_DEBUG_INFO(il, "need full RXON - " #cond "\n"); \ |
516 | return 1; \ | 516 | return 1; \ |
517 | } | 517 | } |
518 | 518 | ||
519 | #define CHK_NEQ(c1, c2) \ | 519 | #define CHK_NEQ(c1, c2) \ |
520 | if ((c1) != (c2)) { \ | 520 | if ((c1) != (c2)) { \ |
521 | IL_DEBUG_INFO(priv, "need full RXON - " \ | 521 | IL_DEBUG_INFO(il, "need full RXON - " \ |
522 | #c1 " != " #c2 " - %d != %d\n", \ | 522 | #c1 " != " #c2 " - %d != %d\n", \ |
523 | (c1), (c2)); \ | 523 | (c1), (c2)); \ |
524 | return 1; \ | 524 | return 1; \ |
@@ -558,7 +558,7 @@ int il_full_rxon_required(struct il_priv *priv, | |||
558 | } | 558 | } |
559 | EXPORT_SYMBOL(il_full_rxon_required); | 559 | EXPORT_SYMBOL(il_full_rxon_required); |
560 | 560 | ||
561 | u8 il_get_lowest_plcp(struct il_priv *priv, | 561 | u8 il_get_lowest_plcp(struct il_priv *il, |
562 | struct il_rxon_context *ctx) | 562 | struct il_rxon_context *ctx) |
563 | { | 563 | { |
564 | /* | 564 | /* |
@@ -572,7 +572,7 @@ u8 il_get_lowest_plcp(struct il_priv *priv, | |||
572 | } | 572 | } |
573 | EXPORT_SYMBOL(il_get_lowest_plcp); | 573 | EXPORT_SYMBOL(il_get_lowest_plcp); |
574 | 574 | ||
575 | static void _il_set_rxon_ht(struct il_priv *priv, | 575 | static void _il_set_rxon_ht(struct il_priv *il, |
576 | struct il_ht_config *ht_conf, | 576 | struct il_ht_config *ht_conf, |
577 | struct il_rxon_context *ctx) | 577 | struct il_rxon_context *ctx) |
578 | { | 578 | { |
@@ -594,7 +594,7 @@ static void _il_set_rxon_ht(struct il_priv *priv, | |||
594 | /* clear the HT channel mode before set the mode */ | 594 | /* clear the HT channel mode before set the mode */ |
595 | rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MSK | | 595 | rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MSK | |
596 | RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); | 596 | RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); |
597 | if (il_is_ht40_tx_allowed(priv, ctx, NULL)) { | 597 | if (il_is_ht40_tx_allowed(il, ctx, NULL)) { |
598 | /* pure ht40 */ | 598 | /* pure ht40 */ |
599 | if (ctx->ht.protection == | 599 | if (ctx->ht.protection == |
600 | IEEE80211_HT_OP_MODE_PROTECTION_20MHZ) { | 600 | IEEE80211_HT_OP_MODE_PROTECTION_20MHZ) { |
@@ -626,7 +626,7 @@ static void _il_set_rxon_ht(struct il_priv *priv, | |||
626 | case IEEE80211_HT_PARAM_CHA_SEC_NONE: | 626 | case IEEE80211_HT_PARAM_CHA_SEC_NONE: |
627 | default: | 627 | default: |
628 | /* channel location only valid if in Mixed mode */ | 628 | /* channel location only valid if in Mixed mode */ |
629 | IL_ERR(priv, | 629 | IL_ERR(il, |
630 | "invalid extension channel offset\n"); | 630 | "invalid extension channel offset\n"); |
631 | break; | 631 | break; |
632 | } | 632 | } |
@@ -635,26 +635,26 @@ static void _il_set_rxon_ht(struct il_priv *priv, | |||
635 | rxon->flags |= RXON_FLG_CHANNEL_MODE_LEGACY; | 635 | rxon->flags |= RXON_FLG_CHANNEL_MODE_LEGACY; |
636 | } | 636 | } |
637 | 637 | ||
638 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 638 | if (il->cfg->ops->hcmd->set_rxon_chain) |
639 | priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); | 639 | il->cfg->ops->hcmd->set_rxon_chain(il, ctx); |
640 | 640 | ||
641 | IL_DEBUG_ASSOC(priv, "rxon flags 0x%X operation mode :0x%X " | 641 | IL_DEBUG_ASSOC(il, "rxon flags 0x%X operation mode :0x%X " |
642 | "extension channel offset 0x%x\n", | 642 | "extension channel offset 0x%x\n", |
643 | le32_to_cpu(rxon->flags), ctx->ht.protection, | 643 | le32_to_cpu(rxon->flags), ctx->ht.protection, |
644 | ctx->ht.extension_chan_offset); | 644 | ctx->ht.extension_chan_offset); |
645 | } | 645 | } |
646 | 646 | ||
647 | void il_set_rxon_ht(struct il_priv *priv, struct il_ht_config *ht_conf) | 647 | void il_set_rxon_ht(struct il_priv *il, struct il_ht_config *ht_conf) |
648 | { | 648 | { |
649 | struct il_rxon_context *ctx; | 649 | struct il_rxon_context *ctx; |
650 | 650 | ||
651 | for_each_context(priv, ctx) | 651 | for_each_context(il, ctx) |
652 | _il_set_rxon_ht(priv, ht_conf, ctx); | 652 | _il_set_rxon_ht(il, ht_conf, ctx); |
653 | } | 653 | } |
654 | EXPORT_SYMBOL(il_set_rxon_ht); | 654 | EXPORT_SYMBOL(il_set_rxon_ht); |
655 | 655 | ||
656 | /* Return valid, unused, channel for a passive scan to reset the RF */ | 656 | /* Return valid, unused, channel for a passive scan to reset the RF */ |
657 | u8 il_get_single_channel_number(struct il_priv *priv, | 657 | u8 il_get_single_channel_number(struct il_priv *il, |
658 | enum ieee80211_band band) | 658 | enum ieee80211_band band) |
659 | { | 659 | { |
660 | const struct il_channel_info *ch_info; | 660 | const struct il_channel_info *ch_info; |
@@ -665,7 +665,7 @@ u8 il_get_single_channel_number(struct il_priv *priv, | |||
665 | 665 | ||
666 | if (band == IEEE80211_BAND_5GHZ) { | 666 | if (band == IEEE80211_BAND_5GHZ) { |
667 | min = 14; | 667 | min = 14; |
668 | max = priv->channel_count; | 668 | max = il->channel_count; |
669 | } else { | 669 | } else { |
670 | min = 0; | 670 | min = 0; |
671 | max = 14; | 671 | max = 14; |
@@ -674,8 +674,8 @@ u8 il_get_single_channel_number(struct il_priv *priv, | |||
674 | for (i = min; i < max; i++) { | 674 | for (i = min; i < max; i++) { |
675 | bool busy = false; | 675 | bool busy = false; |
676 | 676 | ||
677 | for_each_context(priv, ctx) { | 677 | for_each_context(il, ctx) { |
678 | busy = priv->channel_info[i].channel == | 678 | busy = il->channel_info[i].channel == |
679 | le16_to_cpu(ctx->staging.channel); | 679 | le16_to_cpu(ctx->staging.channel); |
680 | if (busy) | 680 | if (busy) |
681 | break; | 681 | break; |
@@ -684,8 +684,8 @@ u8 il_get_single_channel_number(struct il_priv *priv, | |||
684 | if (busy) | 684 | if (busy) |
685 | continue; | 685 | continue; |
686 | 686 | ||
687 | channel = priv->channel_info[i].channel; | 687 | channel = il->channel_info[i].channel; |
688 | ch_info = il_get_channel_info(priv, band, channel); | 688 | ch_info = il_get_channel_info(il, band, channel); |
689 | if (il_is_channel_valid(ch_info)) | 689 | if (il_is_channel_valid(ch_info)) |
690 | break; | 690 | break; |
691 | } | 691 | } |
@@ -702,14 +702,14 @@ EXPORT_SYMBOL(il_get_single_channel_number); | |||
702 | * in the staging RXON flag structure based on the ch->band | 702 | * in the staging RXON flag structure based on the ch->band |
703 | */ | 703 | */ |
704 | int | 704 | int |
705 | il_set_rxon_channel(struct il_priv *priv, struct ieee80211_channel *ch, | 705 | il_set_rxon_channel(struct il_priv *il, struct ieee80211_channel *ch, |
706 | struct il_rxon_context *ctx) | 706 | struct il_rxon_context *ctx) |
707 | { | 707 | { |
708 | enum ieee80211_band band = ch->band; | 708 | enum ieee80211_band band = ch->band; |
709 | u16 channel = ch->hw_value; | 709 | u16 channel = ch->hw_value; |
710 | 710 | ||
711 | if ((le16_to_cpu(ctx->staging.channel) == channel) && | 711 | if ((le16_to_cpu(ctx->staging.channel) == channel) && |
712 | (priv->band == band)) | 712 | (il->band == band)) |
713 | return 0; | 713 | return 0; |
714 | 714 | ||
715 | ctx->staging.channel = cpu_to_le16(channel); | 715 | ctx->staging.channel = cpu_to_le16(channel); |
@@ -718,15 +718,15 @@ il_set_rxon_channel(struct il_priv *priv, struct ieee80211_channel *ch, | |||
718 | else | 718 | else |
719 | ctx->staging.flags |= RXON_FLG_BAND_24G_MSK; | 719 | ctx->staging.flags |= RXON_FLG_BAND_24G_MSK; |
720 | 720 | ||
721 | priv->band = band; | 721 | il->band = band; |
722 | 722 | ||
723 | IL_DEBUG_INFO(priv, "Staging channel set to %d [%d]\n", channel, band); | 723 | IL_DEBUG_INFO(il, "Staging channel set to %d [%d]\n", channel, band); |
724 | 724 | ||
725 | return 0; | 725 | return 0; |
726 | } | 726 | } |
727 | EXPORT_SYMBOL(il_set_rxon_channel); | 727 | EXPORT_SYMBOL(il_set_rxon_channel); |
728 | 728 | ||
729 | void il_set_flags_for_band(struct il_priv *priv, | 729 | void il_set_flags_for_band(struct il_priv *il, |
730 | struct il_rxon_context *ctx, | 730 | struct il_rxon_context *ctx, |
731 | enum ieee80211_band band, | 731 | enum ieee80211_band band, |
732 | struct ieee80211_vif *vif) | 732 | struct ieee80211_vif *vif) |
@@ -753,7 +753,7 @@ EXPORT_SYMBOL(il_set_flags_for_band); | |||
753 | /* | 753 | /* |
754 | * initialize rxon structure with default values from eeprom | 754 | * initialize rxon structure with default values from eeprom |
755 | */ | 755 | */ |
756 | void il_connection_init_rx_config(struct il_priv *priv, | 756 | void il_connection_init_rx_config(struct il_priv *il, |
757 | struct il_rxon_context *ctx) | 757 | struct il_rxon_context *ctx) |
758 | { | 758 | { |
759 | const struct il_channel_info *ch_info; | 759 | const struct il_channel_info *ch_info; |
@@ -778,7 +778,7 @@ void il_connection_init_rx_config(struct il_priv *priv, | |||
778 | break; | 778 | break; |
779 | 779 | ||
780 | default: | 780 | default: |
781 | IL_ERR(priv, "Unsupported interface type %d\n", | 781 | IL_ERR(il, "Unsupported interface type %d\n", |
782 | ctx->vif->type); | 782 | ctx->vif->type); |
783 | break; | 783 | break; |
784 | } | 784 | } |
@@ -786,22 +786,22 @@ void il_connection_init_rx_config(struct il_priv *priv, | |||
786 | #if 0 | 786 | #if 0 |
787 | /* TODO: Figure out when short_preamble would be set and cache from | 787 | /* TODO: Figure out when short_preamble would be set and cache from |
788 | * that */ | 788 | * that */ |
789 | if (!hw_to_local(priv->hw)->short_preamble) | 789 | if (!hw_to_local(il->hw)->short_preamble) |
790 | ctx->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; | 790 | ctx->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; |
791 | else | 791 | else |
792 | ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; | 792 | ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; |
793 | #endif | 793 | #endif |
794 | 794 | ||
795 | ch_info = il_get_channel_info(priv, priv->band, | 795 | ch_info = il_get_channel_info(il, il->band, |
796 | le16_to_cpu(ctx->active.channel)); | 796 | le16_to_cpu(ctx->active.channel)); |
797 | 797 | ||
798 | if (!ch_info) | 798 | if (!ch_info) |
799 | ch_info = &priv->channel_info[0]; | 799 | ch_info = &il->channel_info[0]; |
800 | 800 | ||
801 | ctx->staging.channel = cpu_to_le16(ch_info->channel); | 801 | ctx->staging.channel = cpu_to_le16(ch_info->channel); |
802 | priv->band = ch_info->band; | 802 | il->band = ch_info->band; |
803 | 803 | ||
804 | il_set_flags_for_band(priv, ctx, priv->band, ctx->vif); | 804 | il_set_flags_for_band(il, ctx, il->band, ctx->vif); |
805 | 805 | ||
806 | ctx->staging.ofdm_basic_rates = | 806 | ctx->staging.ofdm_basic_rates = |
807 | (IL_OFDM_RATES_MASK >> IL_FIRST_OFDM_RATE) & 0xFF; | 807 | (IL_OFDM_RATES_MASK >> IL_FIRST_OFDM_RATE) & 0xFF; |
@@ -819,30 +819,30 @@ void il_connection_init_rx_config(struct il_priv *priv, | |||
819 | } | 819 | } |
820 | EXPORT_SYMBOL(il_connection_init_rx_config); | 820 | EXPORT_SYMBOL(il_connection_init_rx_config); |
821 | 821 | ||
822 | void il_set_rate(struct il_priv *priv) | 822 | void il_set_rate(struct il_priv *il) |
823 | { | 823 | { |
824 | const struct ieee80211_supported_band *hw = NULL; | 824 | const struct ieee80211_supported_band *hw = NULL; |
825 | struct ieee80211_rate *rate; | 825 | struct ieee80211_rate *rate; |
826 | struct il_rxon_context *ctx; | 826 | struct il_rxon_context *ctx; |
827 | int i; | 827 | int i; |
828 | 828 | ||
829 | hw = il_get_hw_mode(priv, priv->band); | 829 | hw = il_get_hw_mode(il, il->band); |
830 | if (!hw) { | 830 | if (!hw) { |
831 | IL_ERR(priv, "Failed to set rate: unable to get hw mode\n"); | 831 | IL_ERR(il, "Failed to set rate: unable to get hw mode\n"); |
832 | return; | 832 | return; |
833 | } | 833 | } |
834 | 834 | ||
835 | priv->active_rate = 0; | 835 | il->active_rate = 0; |
836 | 836 | ||
837 | for (i = 0; i < hw->n_bitrates; i++) { | 837 | for (i = 0; i < hw->n_bitrates; i++) { |
838 | rate = &(hw->bitrates[i]); | 838 | rate = &(hw->bitrates[i]); |
839 | if (rate->hw_value < IL_RATE_COUNT_LEGACY) | 839 | if (rate->hw_value < IL_RATE_COUNT_LEGACY) |
840 | priv->active_rate |= (1 << rate->hw_value); | 840 | il->active_rate |= (1 << rate->hw_value); |
841 | } | 841 | } |
842 | 842 | ||
843 | IL_DEBUG_RATE(priv, "Set active_rate = %0x\n", priv->active_rate); | 843 | IL_DEBUG_RATE(il, "Set active_rate = %0x\n", il->active_rate); |
844 | 844 | ||
845 | for_each_context(priv, ctx) { | 845 | for_each_context(il, ctx) { |
846 | ctx->staging.cck_basic_rates = | 846 | ctx->staging.cck_basic_rates = |
847 | (IL_CCK_BASIC_RATES_MASK >> IL_FIRST_CCK_RATE) & 0xF; | 847 | (IL_CCK_BASIC_RATES_MASK >> IL_FIRST_CCK_RATE) & 0xF; |
848 | 848 | ||
@@ -852,64 +852,64 @@ void il_set_rate(struct il_priv *priv) | |||
852 | } | 852 | } |
853 | EXPORT_SYMBOL(il_set_rate); | 853 | EXPORT_SYMBOL(il_set_rate); |
854 | 854 | ||
855 | void il_chswitch_done(struct il_priv *priv, bool is_success) | 855 | void il_chswitch_done(struct il_priv *il, bool is_success) |
856 | { | 856 | { |
857 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 857 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
858 | 858 | ||
859 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 859 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) |
860 | return; | 860 | return; |
861 | 861 | ||
862 | if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) | 862 | if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &il->status)) |
863 | ieee80211_chswitch_done(ctx->vif, is_success); | 863 | ieee80211_chswitch_done(ctx->vif, is_success); |
864 | } | 864 | } |
865 | EXPORT_SYMBOL(il_chswitch_done); | 865 | EXPORT_SYMBOL(il_chswitch_done); |
866 | 866 | ||
867 | void il_rx_csa(struct il_priv *priv, struct il_rx_mem_buffer *rxb) | 867 | void il_rx_csa(struct il_priv *il, struct il_rx_mem_buffer *rxb) |
868 | { | 868 | { |
869 | struct il_rx_packet *pkt = rxb_addr(rxb); | 869 | struct il_rx_packet *pkt = rxb_addr(rxb); |
870 | struct il_csa_notification *csa = &(pkt->u.csa_notif); | 870 | struct il_csa_notification *csa = &(pkt->u.csa_notif); |
871 | 871 | ||
872 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 872 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
873 | struct il_rxon_cmd *rxon = (void *)&ctx->active; | 873 | struct il_rxon_cmd *rxon = (void *)&ctx->active; |
874 | 874 | ||
875 | if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) | 875 | if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &il->status)) |
876 | return; | 876 | return; |
877 | 877 | ||
878 | if (!le32_to_cpu(csa->status) && csa->channel == priv->switch_channel) { | 878 | if (!le32_to_cpu(csa->status) && csa->channel == il->switch_channel) { |
879 | rxon->channel = csa->channel; | 879 | rxon->channel = csa->channel; |
880 | ctx->staging.channel = csa->channel; | 880 | ctx->staging.channel = csa->channel; |
881 | IL_DEBUG_11H(priv, "CSA notif: channel %d\n", | 881 | IL_DEBUG_11H(il, "CSA notif: channel %d\n", |
882 | le16_to_cpu(csa->channel)); | 882 | le16_to_cpu(csa->channel)); |
883 | il_chswitch_done(priv, true); | 883 | il_chswitch_done(il, true); |
884 | } else { | 884 | } else { |
885 | IL_ERR(priv, "CSA notif (fail) : channel %d\n", | 885 | IL_ERR(il, "CSA notif (fail) : channel %d\n", |
886 | le16_to_cpu(csa->channel)); | 886 | le16_to_cpu(csa->channel)); |
887 | il_chswitch_done(priv, false); | 887 | il_chswitch_done(il, false); |
888 | } | 888 | } |
889 | } | 889 | } |
890 | EXPORT_SYMBOL(il_rx_csa); | 890 | EXPORT_SYMBOL(il_rx_csa); |
891 | 891 | ||
892 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 892 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
893 | void il_print_rx_config_cmd(struct il_priv *priv, | 893 | void il_print_rx_config_cmd(struct il_priv *il, |
894 | struct il_rxon_context *ctx) | 894 | struct il_rxon_context *ctx) |
895 | { | 895 | { |
896 | struct il_rxon_cmd *rxon = &ctx->staging; | 896 | struct il_rxon_cmd *rxon = &ctx->staging; |
897 | 897 | ||
898 | IL_DEBUG_RADIO(priv, "RX CONFIG:\n"); | 898 | IL_DEBUG_RADIO(il, "RX CONFIG:\n"); |
899 | il_print_hex_dump(priv, IL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); | 899 | il_print_hex_dump(il, IL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); |
900 | IL_DEBUG_RADIO(priv, "u16 channel: 0x%x\n", | 900 | IL_DEBUG_RADIO(il, "u16 channel: 0x%x\n", |
901 | le16_to_cpu(rxon->channel)); | 901 | le16_to_cpu(rxon->channel)); |
902 | IL_DEBUG_RADIO(priv, "u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags)); | 902 | IL_DEBUG_RADIO(il, "u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags)); |
903 | IL_DEBUG_RADIO(priv, "u32 filter_flags: 0x%08x\n", | 903 | IL_DEBUG_RADIO(il, "u32 filter_flags: 0x%08x\n", |
904 | le32_to_cpu(rxon->filter_flags)); | 904 | le32_to_cpu(rxon->filter_flags)); |
905 | IL_DEBUG_RADIO(priv, "u8 dev_type: 0x%x\n", rxon->dev_type); | 905 | IL_DEBUG_RADIO(il, "u8 dev_type: 0x%x\n", rxon->dev_type); |
906 | IL_DEBUG_RADIO(priv, "u8 ofdm_basic_rates: 0x%02x\n", | 906 | IL_DEBUG_RADIO(il, "u8 ofdm_basic_rates: 0x%02x\n", |
907 | rxon->ofdm_basic_rates); | 907 | rxon->ofdm_basic_rates); |
908 | IL_DEBUG_RADIO(priv, "u8 cck_basic_rates: 0x%02x\n", | 908 | IL_DEBUG_RADIO(il, "u8 cck_basic_rates: 0x%02x\n", |
909 | rxon->cck_basic_rates); | 909 | rxon->cck_basic_rates); |
910 | IL_DEBUG_RADIO(priv, "u8[6] node_addr: %pM\n", rxon->node_addr); | 910 | IL_DEBUG_RADIO(il, "u8[6] node_addr: %pM\n", rxon->node_addr); |
911 | IL_DEBUG_RADIO(priv, "u8[6] bssid_addr: %pM\n", rxon->bssid_addr); | 911 | IL_DEBUG_RADIO(il, "u8[6] bssid_addr: %pM\n", rxon->bssid_addr); |
912 | IL_DEBUG_RADIO(priv, "u16 assoc_id: 0x%x\n", | 912 | IL_DEBUG_RADIO(il, "u16 assoc_id: 0x%x\n", |
913 | le16_to_cpu(rxon->assoc_id)); | 913 | le16_to_cpu(rxon->assoc_id)); |
914 | } | 914 | } |
915 | EXPORT_SYMBOL(il_print_rx_config_cmd); | 915 | EXPORT_SYMBOL(il_print_rx_config_cmd); |
@@ -917,68 +917,68 @@ EXPORT_SYMBOL(il_print_rx_config_cmd); | |||
917 | /** | 917 | /** |
918 | * il_irq_handle_error - called for HW or SW error interrupt from card | 918 | * il_irq_handle_error - called for HW or SW error interrupt from card |
919 | */ | 919 | */ |
920 | void il_irq_handle_error(struct il_priv *priv) | 920 | void il_irq_handle_error(struct il_priv *il) |
921 | { | 921 | { |
922 | /* Set the FW error flag -- cleared on il_down */ | 922 | /* Set the FW error flag -- cleared on il_down */ |
923 | set_bit(STATUS_FW_ERROR, &priv->status); | 923 | set_bit(STATUS_FW_ERROR, &il->status); |
924 | 924 | ||
925 | /* Cancel currently queued command. */ | 925 | /* Cancel currently queued command. */ |
926 | clear_bit(STATUS_HCMD_ACTIVE, &priv->status); | 926 | clear_bit(STATUS_HCMD_ACTIVE, &il->status); |
927 | 927 | ||
928 | IL_ERR(priv, "Loaded firmware version: %s\n", | 928 | IL_ERR(il, "Loaded firmware version: %s\n", |
929 | priv->hw->wiphy->fw_version); | 929 | il->hw->wiphy->fw_version); |
930 | 930 | ||
931 | priv->cfg->ops->lib->dump_nic_error_log(priv); | 931 | il->cfg->ops->lib->dump_nic_error_log(il); |
932 | if (priv->cfg->ops->lib->dump_fh) | 932 | if (il->cfg->ops->lib->dump_fh) |
933 | priv->cfg->ops->lib->dump_fh(priv, NULL, false); | 933 | il->cfg->ops->lib->dump_fh(il, NULL, false); |
934 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 934 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
935 | if (il_get_debug_level(priv) & IL_DL_FW_ERRORS) | 935 | if (il_get_debug_level(il) & IL_DL_FW_ERRORS) |
936 | il_print_rx_config_cmd(priv, | 936 | il_print_rx_config_cmd(il, |
937 | &priv->contexts[IL_RXON_CTX_BSS]); | 937 | &il->contexts[IL_RXON_CTX_BSS]); |
938 | #endif | 938 | #endif |
939 | 939 | ||
940 | wake_up(&priv->wait_command_queue); | 940 | wake_up(&il->wait_command_queue); |
941 | 941 | ||
942 | /* Keep the restart process from trying to send host | 942 | /* Keep the restart process from trying to send host |
943 | * commands by clearing the INIT status bit */ | 943 | * commands by clearing the INIT status bit */ |
944 | clear_bit(STATUS_READY, &priv->status); | 944 | clear_bit(STATUS_READY, &il->status); |
945 | 945 | ||
946 | if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) { | 946 | if (!test_bit(STATUS_EXIT_PENDING, &il->status)) { |
947 | IL_DEBUG(priv, IL_DL_FW_ERRORS, | 947 | IL_DEBUG(il, IL_DL_FW_ERRORS, |
948 | "Restarting adapter due to uCode error.\n"); | 948 | "Restarting adapter due to uCode error.\n"); |
949 | 949 | ||
950 | if (priv->cfg->mod_params->restart_fw) | 950 | if (il->cfg->mod_params->restart_fw) |
951 | queue_work(priv->workqueue, &priv->restart); | 951 | queue_work(il->workqueue, &il->restart); |
952 | } | 952 | } |
953 | } | 953 | } |
954 | EXPORT_SYMBOL(il_irq_handle_error); | 954 | EXPORT_SYMBOL(il_irq_handle_error); |
955 | 955 | ||
956 | static int il_apm_stop_master(struct il_priv *priv) | 956 | static int il_apm_stop_master(struct il_priv *il) |
957 | { | 957 | { |
958 | int ret = 0; | 958 | int ret = 0; |
959 | 959 | ||
960 | /* stop device's busmaster DMA activity */ | 960 | /* stop device's busmaster DMA activity */ |
961 | il_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER); | 961 | il_set_bit(il, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER); |
962 | 962 | ||
963 | ret = il_poll_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_MASTER_DISABLED, | 963 | ret = il_poll_bit(il, CSR_RESET, CSR_RESET_REG_FLAG_MASTER_DISABLED, |
964 | CSR_RESET_REG_FLAG_MASTER_DISABLED, 100); | 964 | CSR_RESET_REG_FLAG_MASTER_DISABLED, 100); |
965 | if (ret) | 965 | if (ret) |
966 | IL_WARN(priv, "Master Disable Timed Out, 100 usec\n"); | 966 | IL_WARN(il, "Master Disable Timed Out, 100 usec\n"); |
967 | 967 | ||
968 | IL_DEBUG_INFO(priv, "stop master\n"); | 968 | IL_DEBUG_INFO(il, "stop master\n"); |
969 | 969 | ||
970 | return ret; | 970 | return ret; |
971 | } | 971 | } |
972 | 972 | ||
973 | void il_apm_stop(struct il_priv *priv) | 973 | void il_apm_stop(struct il_priv *il) |
974 | { | 974 | { |
975 | IL_DEBUG_INFO(priv, "Stop card, put in low power state\n"); | 975 | IL_DEBUG_INFO(il, "Stop card, put in low power state\n"); |
976 | 976 | ||
977 | /* Stop device's DMA activity */ | 977 | /* Stop device's DMA activity */ |
978 | il_apm_stop_master(priv); | 978 | il_apm_stop_master(il); |
979 | 979 | ||
980 | /* Reset the entire device */ | 980 | /* Reset the entire device */ |
981 | il_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); | 981 | il_set_bit(il, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); |
982 | 982 | ||
983 | udelay(10); | 983 | udelay(10); |
984 | 984 | ||
@@ -986,7 +986,7 @@ void il_apm_stop(struct il_priv *priv) | |||
986 | * Clear "initialization complete" bit to move adapter from | 986 | * Clear "initialization complete" bit to move adapter from |
987 | * D0A* (powered-up Active) --> D0U* (Uninitialized) state. | 987 | * D0A* (powered-up Active) --> D0U* (Uninitialized) state. |
988 | */ | 988 | */ |
989 | il_clear_bit(priv, CSR_GP_CNTRL, | 989 | il_clear_bit(il, CSR_GP_CNTRL, |
990 | CSR_GP_CNTRL_REG_FLAG_INIT_DONE); | 990 | CSR_GP_CNTRL_REG_FLAG_INIT_DONE); |
991 | } | 991 | } |
992 | EXPORT_SYMBOL(il_apm_stop); | 992 | EXPORT_SYMBOL(il_apm_stop); |
@@ -997,12 +997,12 @@ EXPORT_SYMBOL(il_apm_stop); | |||
997 | * (e.g. after platform boot, or shutdown via il_apm_stop()) | 997 | * (e.g. after platform boot, or shutdown via il_apm_stop()) |
998 | * NOTE: This does not load uCode nor start the embedded processor | 998 | * NOTE: This does not load uCode nor start the embedded processor |
999 | */ | 999 | */ |
1000 | int il_apm_init(struct il_priv *priv) | 1000 | int il_apm_init(struct il_priv *il) |
1001 | { | 1001 | { |
1002 | int ret = 0; | 1002 | int ret = 0; |
1003 | u16 lctl; | 1003 | u16 lctl; |
1004 | 1004 | ||
1005 | IL_DEBUG_INFO(priv, "Init card's basic functions\n"); | 1005 | IL_DEBUG_INFO(il, "Init card's basic functions\n"); |
1006 | 1006 | ||
1007 | /* | 1007 | /* |
1008 | * Use "set_bit" below rather than "write", to preserve any hardware | 1008 | * Use "set_bit" below rather than "write", to preserve any hardware |
@@ -1010,18 +1010,18 @@ int il_apm_init(struct il_priv *priv) | |||
1010 | */ | 1010 | */ |
1011 | 1011 | ||
1012 | /* Disable L0S exit timer (platform NMI Work/Around) */ | 1012 | /* Disable L0S exit timer (platform NMI Work/Around) */ |
1013 | il_set_bit(priv, CSR_GIO_CHICKEN_BITS, | 1013 | il_set_bit(il, CSR_GIO_CHICKEN_BITS, |
1014 | CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER); | 1014 | CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER); |
1015 | 1015 | ||
1016 | /* | 1016 | /* |
1017 | * Disable L0s without affecting L1; | 1017 | * Disable L0s without affecting L1; |
1018 | * don't wait for ICH L0s (ICH bug W/A) | 1018 | * don't wait for ICH L0s (ICH bug W/A) |
1019 | */ | 1019 | */ |
1020 | il_set_bit(priv, CSR_GIO_CHICKEN_BITS, | 1020 | il_set_bit(il, CSR_GIO_CHICKEN_BITS, |
1021 | CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX); | 1021 | CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX); |
1022 | 1022 | ||
1023 | /* Set FH wait threshold to maximum (HW error during stress W/A) */ | 1023 | /* Set FH wait threshold to maximum (HW error during stress W/A) */ |
1024 | il_set_bit(priv, CSR_DBG_HPET_MEM_REG, | 1024 | il_set_bit(il, CSR_DBG_HPET_MEM_REG, |
1025 | CSR_DBG_HPET_MEM_REG_VAL); | 1025 | CSR_DBG_HPET_MEM_REG_VAL); |
1026 | 1026 | ||
1027 | /* | 1027 | /* |
@@ -1029,7 +1029,7 @@ int il_apm_init(struct il_priv *priv) | |||
1029 | * wake device's PCI Express link L1a -> L0s | 1029 | * wake device's PCI Express link L1a -> L0s |
1030 | * NOTE: This is no-op for 3945 (non-existent bit) | 1030 | * NOTE: This is no-op for 3945 (non-existent bit) |
1031 | */ | 1031 | */ |
1032 | il_set_bit(priv, CSR_HW_IF_CONFIG_REG, | 1032 | il_set_bit(il, CSR_HW_IF_CONFIG_REG, |
1033 | CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A); | 1033 | CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A); |
1034 | 1034 | ||
1035 | /* | 1035 | /* |
@@ -1040,43 +1040,43 @@ int il_apm_init(struct il_priv *priv) | |||
1040 | * If not (unlikely), enable L0S, so there is at least some | 1040 | * If not (unlikely), enable L0S, so there is at least some |
1041 | * power savings, even without L1. | 1041 | * power savings, even without L1. |
1042 | */ | 1042 | */ |
1043 | if (priv->cfg->base_params->set_l0s) { | 1043 | if (il->cfg->base_params->set_l0s) { |
1044 | lctl = il_pcie_link_ctl(priv); | 1044 | lctl = il_pcie_link_ctl(il); |
1045 | if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) == | 1045 | if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) == |
1046 | PCI_CFG_LINK_CTRL_VAL_L1_EN) { | 1046 | PCI_CFG_LINK_CTRL_VAL_L1_EN) { |
1047 | /* L1-ASPM enabled; disable(!) L0S */ | 1047 | /* L1-ASPM enabled; disable(!) L0S */ |
1048 | il_set_bit(priv, CSR_GIO_REG, | 1048 | il_set_bit(il, CSR_GIO_REG, |
1049 | CSR_GIO_REG_VAL_L0S_ENABLED); | 1049 | CSR_GIO_REG_VAL_L0S_ENABLED); |
1050 | IL_DEBUG_POWER(priv, "L1 Enabled; Disabling L0S\n"); | 1050 | IL_DEBUG_POWER(il, "L1 Enabled; Disabling L0S\n"); |
1051 | } else { | 1051 | } else { |
1052 | /* L1-ASPM disabled; enable(!) L0S */ | 1052 | /* L1-ASPM disabled; enable(!) L0S */ |
1053 | il_clear_bit(priv, CSR_GIO_REG, | 1053 | il_clear_bit(il, CSR_GIO_REG, |
1054 | CSR_GIO_REG_VAL_L0S_ENABLED); | 1054 | CSR_GIO_REG_VAL_L0S_ENABLED); |
1055 | IL_DEBUG_POWER(priv, "L1 Disabled; Enabling L0S\n"); | 1055 | IL_DEBUG_POWER(il, "L1 Disabled; Enabling L0S\n"); |
1056 | } | 1056 | } |
1057 | } | 1057 | } |
1058 | 1058 | ||
1059 | /* Configure analog phase-lock-loop before activating to D0A */ | 1059 | /* Configure analog phase-lock-loop before activating to D0A */ |
1060 | if (priv->cfg->base_params->pll_cfg_val) | 1060 | if (il->cfg->base_params->pll_cfg_val) |
1061 | il_set_bit(priv, CSR_ANA_PLL_CFG, | 1061 | il_set_bit(il, CSR_ANA_PLL_CFG, |
1062 | priv->cfg->base_params->pll_cfg_val); | 1062 | il->cfg->base_params->pll_cfg_val); |
1063 | 1063 | ||
1064 | /* | 1064 | /* |
1065 | * Set "initialization complete" bit to move adapter from | 1065 | * Set "initialization complete" bit to move adapter from |
1066 | * D0U* --> D0A* (powered-up active) state. | 1066 | * D0U* --> D0A* (powered-up active) state. |
1067 | */ | 1067 | */ |
1068 | il_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); | 1068 | il_set_bit(il, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); |
1069 | 1069 | ||
1070 | /* | 1070 | /* |
1071 | * Wait for clock stabilization; once stabilized, access to | 1071 | * Wait for clock stabilization; once stabilized, access to |
1072 | * device-internal resources is supported, e.g. il_write_prph() | 1072 | * device-internal resources is supported, e.g. il_write_prph() |
1073 | * and accesses to uCode SRAM. | 1073 | * and accesses to uCode SRAM. |
1074 | */ | 1074 | */ |
1075 | ret = il_poll_bit(priv, CSR_GP_CNTRL, | 1075 | ret = il_poll_bit(il, CSR_GP_CNTRL, |
1076 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, | 1076 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, |
1077 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); | 1077 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); |
1078 | if (ret < 0) { | 1078 | if (ret < 0) { |
1079 | IL_DEBUG_INFO(priv, "Failed to init the card\n"); | 1079 | IL_DEBUG_INFO(il, "Failed to init the card\n"); |
1080 | goto out; | 1080 | goto out; |
1081 | } | 1081 | } |
1082 | 1082 | ||
@@ -1088,16 +1088,16 @@ int il_apm_init(struct il_priv *priv) | |||
1088 | * do not disable clocks. This preserves any hardware bits already | 1088 | * do not disable clocks. This preserves any hardware bits already |
1089 | * set by default in "CLK_CTRL_REG" after reset. | 1089 | * set by default in "CLK_CTRL_REG" after reset. |
1090 | */ | 1090 | */ |
1091 | if (priv->cfg->base_params->use_bsm) | 1091 | if (il->cfg->base_params->use_bsm) |
1092 | il_write_prph(priv, APMG_CLK_EN_REG, | 1092 | il_write_prph(il, APMG_CLK_EN_REG, |
1093 | APMG_CLK_VAL_DMA_CLK_RQT | APMG_CLK_VAL_BSM_CLK_RQT); | 1093 | APMG_CLK_VAL_DMA_CLK_RQT | APMG_CLK_VAL_BSM_CLK_RQT); |
1094 | else | 1094 | else |
1095 | il_write_prph(priv, APMG_CLK_EN_REG, | 1095 | il_write_prph(il, APMG_CLK_EN_REG, |
1096 | APMG_CLK_VAL_DMA_CLK_RQT); | 1096 | APMG_CLK_VAL_DMA_CLK_RQT); |
1097 | udelay(20); | 1097 | udelay(20); |
1098 | 1098 | ||
1099 | /* Disable L1-Active */ | 1099 | /* Disable L1-Active */ |
1100 | il_set_bits_prph(priv, APMG_PCIDEV_STT_REG, | 1100 | il_set_bits_prph(il, APMG_PCIDEV_STT_REG, |
1101 | APMG_PCIDEV_STT_VAL_L1_ACT_DIS); | 1101 | APMG_PCIDEV_STT_VAL_L1_ACT_DIS); |
1102 | 1102 | ||
1103 | out: | 1103 | out: |
@@ -1106,66 +1106,66 @@ out: | |||
1106 | EXPORT_SYMBOL(il_apm_init); | 1106 | EXPORT_SYMBOL(il_apm_init); |
1107 | 1107 | ||
1108 | 1108 | ||
1109 | int il_set_tx_power(struct il_priv *priv, s8 tx_power, bool force) | 1109 | int il_set_tx_power(struct il_priv *il, s8 tx_power, bool force) |
1110 | { | 1110 | { |
1111 | int ret; | 1111 | int ret; |
1112 | s8 prev_tx_power; | 1112 | s8 prev_tx_power; |
1113 | bool defer; | 1113 | bool defer; |
1114 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 1114 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
1115 | 1115 | ||
1116 | lockdep_assert_held(&priv->mutex); | 1116 | lockdep_assert_held(&il->mutex); |
1117 | 1117 | ||
1118 | if (priv->tx_power_user_lmt == tx_power && !force) | 1118 | if (il->tx_power_user_lmt == tx_power && !force) |
1119 | return 0; | 1119 | return 0; |
1120 | 1120 | ||
1121 | if (!priv->cfg->ops->lib->send_tx_power) | 1121 | if (!il->cfg->ops->lib->send_tx_power) |
1122 | return -EOPNOTSUPP; | 1122 | return -EOPNOTSUPP; |
1123 | 1123 | ||
1124 | /* 0 dBm mean 1 milliwatt */ | 1124 | /* 0 dBm mean 1 milliwatt */ |
1125 | if (tx_power < 0) { | 1125 | if (tx_power < 0) { |
1126 | IL_WARN(priv, | 1126 | IL_WARN(il, |
1127 | "Requested user TXPOWER %d below 1 mW.\n", | 1127 | "Requested user TXPOWER %d below 1 mW.\n", |
1128 | tx_power); | 1128 | tx_power); |
1129 | return -EINVAL; | 1129 | return -EINVAL; |
1130 | } | 1130 | } |
1131 | 1131 | ||
1132 | if (tx_power > priv->tx_power_device_lmt) { | 1132 | if (tx_power > il->tx_power_device_lmt) { |
1133 | IL_WARN(priv, | 1133 | IL_WARN(il, |
1134 | "Requested user TXPOWER %d above upper limit %d.\n", | 1134 | "Requested user TXPOWER %d above upper limit %d.\n", |
1135 | tx_power, priv->tx_power_device_lmt); | 1135 | tx_power, il->tx_power_device_lmt); |
1136 | return -EINVAL; | 1136 | return -EINVAL; |
1137 | } | 1137 | } |
1138 | 1138 | ||
1139 | if (!il_is_ready_rf(priv)) | 1139 | if (!il_is_ready_rf(il)) |
1140 | return -EIO; | 1140 | return -EIO; |
1141 | 1141 | ||
1142 | /* scan complete and commit_rxon use tx_power_next value, | 1142 | /* scan complete and commit_rxon use tx_power_next value, |
1143 | * it always need to be updated for newest request */ | 1143 | * it always need to be updated for newest request */ |
1144 | priv->tx_power_next = tx_power; | 1144 | il->tx_power_next = tx_power; |
1145 | 1145 | ||
1146 | /* do not set tx power when scanning or channel changing */ | 1146 | /* do not set tx power when scanning or channel changing */ |
1147 | defer = test_bit(STATUS_SCANNING, &priv->status) || | 1147 | defer = test_bit(STATUS_SCANNING, &il->status) || |
1148 | memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging)); | 1148 | memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging)); |
1149 | if (defer && !force) { | 1149 | if (defer && !force) { |
1150 | IL_DEBUG_INFO(priv, "Deferring tx power set\n"); | 1150 | IL_DEBUG_INFO(il, "Deferring tx power set\n"); |
1151 | return 0; | 1151 | return 0; |
1152 | } | 1152 | } |
1153 | 1153 | ||
1154 | prev_tx_power = priv->tx_power_user_lmt; | 1154 | prev_tx_power = il->tx_power_user_lmt; |
1155 | priv->tx_power_user_lmt = tx_power; | 1155 | il->tx_power_user_lmt = tx_power; |
1156 | 1156 | ||
1157 | ret = priv->cfg->ops->lib->send_tx_power(priv); | 1157 | ret = il->cfg->ops->lib->send_tx_power(il); |
1158 | 1158 | ||
1159 | /* if fail to set tx_power, restore the orig. tx power */ | 1159 | /* if fail to set tx_power, restore the orig. tx power */ |
1160 | if (ret) { | 1160 | if (ret) { |
1161 | priv->tx_power_user_lmt = prev_tx_power; | 1161 | il->tx_power_user_lmt = prev_tx_power; |
1162 | priv->tx_power_next = prev_tx_power; | 1162 | il->tx_power_next = prev_tx_power; |
1163 | } | 1163 | } |
1164 | return ret; | 1164 | return ret; |
1165 | } | 1165 | } |
1166 | EXPORT_SYMBOL(il_set_tx_power); | 1166 | EXPORT_SYMBOL(il_set_tx_power); |
1167 | 1167 | ||
1168 | void il_send_bt_config(struct il_priv *priv) | 1168 | void il_send_bt_config(struct il_priv *il) |
1169 | { | 1169 | { |
1170 | struct il_bt_cmd bt_cmd = { | 1170 | struct il_bt_cmd bt_cmd = { |
1171 | .lead_time = BT_LEAD_TIME_DEF, | 1171 | .lead_time = BT_LEAD_TIME_DEF, |
@@ -1179,16 +1179,16 @@ void il_send_bt_config(struct il_priv *priv) | |||
1179 | else | 1179 | else |
1180 | bt_cmd.flags = BT_COEX_ENABLE; | 1180 | bt_cmd.flags = BT_COEX_ENABLE; |
1181 | 1181 | ||
1182 | IL_DEBUG_INFO(priv, "BT coex %s\n", | 1182 | IL_DEBUG_INFO(il, "BT coex %s\n", |
1183 | (bt_cmd.flags == BT_COEX_DISABLE) ? "disable" : "active"); | 1183 | (bt_cmd.flags == BT_COEX_DISABLE) ? "disable" : "active"); |
1184 | 1184 | ||
1185 | if (il_send_cmd_pdu(priv, REPLY_BT_CONFIG, | 1185 | if (il_send_cmd_pdu(il, REPLY_BT_CONFIG, |
1186 | sizeof(struct il_bt_cmd), &bt_cmd)) | 1186 | sizeof(struct il_bt_cmd), &bt_cmd)) |
1187 | IL_ERR(priv, "failed to send BT Coex Config\n"); | 1187 | IL_ERR(il, "failed to send BT Coex Config\n"); |
1188 | } | 1188 | } |
1189 | EXPORT_SYMBOL(il_send_bt_config); | 1189 | EXPORT_SYMBOL(il_send_bt_config); |
1190 | 1190 | ||
1191 | int il_send_statistics_request(struct il_priv *priv, u8 flags, bool clear) | 1191 | int il_send_statistics_request(struct il_priv *il, u8 flags, bool clear) |
1192 | { | 1192 | { |
1193 | struct il_statistics_cmd statistics_cmd = { | 1193 | struct il_statistics_cmd statistics_cmd = { |
1194 | .configuration_flags = | 1194 | .configuration_flags = |
@@ -1196,46 +1196,46 @@ int il_send_statistics_request(struct il_priv *priv, u8 flags, bool clear) | |||
1196 | }; | 1196 | }; |
1197 | 1197 | ||
1198 | if (flags & CMD_ASYNC) | 1198 | if (flags & CMD_ASYNC) |
1199 | return il_send_cmd_pdu_async(priv, REPLY_STATISTICS_CMD, | 1199 | return il_send_cmd_pdu_async(il, REPLY_STATISTICS_CMD, |
1200 | sizeof(struct il_statistics_cmd), | 1200 | sizeof(struct il_statistics_cmd), |
1201 | &statistics_cmd, NULL); | 1201 | &statistics_cmd, NULL); |
1202 | else | 1202 | else |
1203 | return il_send_cmd_pdu(priv, REPLY_STATISTICS_CMD, | 1203 | return il_send_cmd_pdu(il, REPLY_STATISTICS_CMD, |
1204 | sizeof(struct il_statistics_cmd), | 1204 | sizeof(struct il_statistics_cmd), |
1205 | &statistics_cmd); | 1205 | &statistics_cmd); |
1206 | } | 1206 | } |
1207 | EXPORT_SYMBOL(il_send_statistics_request); | 1207 | EXPORT_SYMBOL(il_send_statistics_request); |
1208 | 1208 | ||
1209 | void il_rx_pm_sleep_notif(struct il_priv *priv, | 1209 | void il_rx_pm_sleep_notif(struct il_priv *il, |
1210 | struct il_rx_mem_buffer *rxb) | 1210 | struct il_rx_mem_buffer *rxb) |
1211 | { | 1211 | { |
1212 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 1212 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
1213 | struct il_rx_packet *pkt = rxb_addr(rxb); | 1213 | struct il_rx_packet *pkt = rxb_addr(rxb); |
1214 | struct il_sleep_notification *sleep = &(pkt->u.sleep_notif); | 1214 | struct il_sleep_notification *sleep = &(pkt->u.sleep_notif); |
1215 | IL_DEBUG_RX(priv, "sleep mode: %d, src: %d\n", | 1215 | IL_DEBUG_RX(il, "sleep mode: %d, src: %d\n", |
1216 | sleep->pm_sleep_mode, sleep->pm_wakeup_src); | 1216 | sleep->pm_sleep_mode, sleep->pm_wakeup_src); |
1217 | #endif | 1217 | #endif |
1218 | } | 1218 | } |
1219 | EXPORT_SYMBOL(il_rx_pm_sleep_notif); | 1219 | EXPORT_SYMBOL(il_rx_pm_sleep_notif); |
1220 | 1220 | ||
1221 | void il_rx_pm_debug_statistics_notif(struct il_priv *priv, | 1221 | void il_rx_pm_debug_statistics_notif(struct il_priv *il, |
1222 | struct il_rx_mem_buffer *rxb) | 1222 | struct il_rx_mem_buffer *rxb) |
1223 | { | 1223 | { |
1224 | struct il_rx_packet *pkt = rxb_addr(rxb); | 1224 | struct il_rx_packet *pkt = rxb_addr(rxb); |
1225 | u32 len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; | 1225 | u32 len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; |
1226 | IL_DEBUG_RADIO(priv, "Dumping %d bytes of unhandled " | 1226 | IL_DEBUG_RADIO(il, "Dumping %d bytes of unhandled " |
1227 | "notification for %s:\n", len, | 1227 | "notification for %s:\n", len, |
1228 | il_get_cmd_string(pkt->hdr.cmd)); | 1228 | il_get_cmd_string(pkt->hdr.cmd)); |
1229 | il_print_hex_dump(priv, IL_DL_RADIO, pkt->u.raw, len); | 1229 | il_print_hex_dump(il, IL_DL_RADIO, pkt->u.raw, len); |
1230 | } | 1230 | } |
1231 | EXPORT_SYMBOL(il_rx_pm_debug_statistics_notif); | 1231 | EXPORT_SYMBOL(il_rx_pm_debug_statistics_notif); |
1232 | 1232 | ||
1233 | void il_rx_reply_error(struct il_priv *priv, | 1233 | void il_rx_reply_error(struct il_priv *il, |
1234 | struct il_rx_mem_buffer *rxb) | 1234 | struct il_rx_mem_buffer *rxb) |
1235 | { | 1235 | { |
1236 | struct il_rx_packet *pkt = rxb_addr(rxb); | 1236 | struct il_rx_packet *pkt = rxb_addr(rxb); |
1237 | 1237 | ||
1238 | IL_ERR(priv, "Error Reply type 0x%08X cmd %s (0x%02X) " | 1238 | IL_ERR(il, "Error Reply type 0x%08X cmd %s (0x%02X) " |
1239 | "seq 0x%04X ser 0x%08X\n", | 1239 | "seq 0x%04X ser 0x%08X\n", |
1240 | le32_to_cpu(pkt->u.err_resp.error_type), | 1240 | le32_to_cpu(pkt->u.err_resp.error_type), |
1241 | il_get_cmd_string(pkt->u.err_resp.cmd_id), | 1241 | il_get_cmd_string(pkt->u.err_resp.cmd_id), |
@@ -1245,37 +1245,37 @@ void il_rx_reply_error(struct il_priv *priv, | |||
1245 | } | 1245 | } |
1246 | EXPORT_SYMBOL(il_rx_reply_error); | 1246 | EXPORT_SYMBOL(il_rx_reply_error); |
1247 | 1247 | ||
1248 | void il_clear_isr_stats(struct il_priv *priv) | 1248 | void il_clear_isr_stats(struct il_priv *il) |
1249 | { | 1249 | { |
1250 | memset(&priv->isr_stats, 0, sizeof(priv->isr_stats)); | 1250 | memset(&il->isr_stats, 0, sizeof(il->isr_stats)); |
1251 | } | 1251 | } |
1252 | 1252 | ||
1253 | int il_mac_conf_tx(struct ieee80211_hw *hw, | 1253 | int il_mac_conf_tx(struct ieee80211_hw *hw, |
1254 | struct ieee80211_vif *vif, u16 queue, | 1254 | struct ieee80211_vif *vif, u16 queue, |
1255 | const struct ieee80211_tx_queue_params *params) | 1255 | const struct ieee80211_tx_queue_params *params) |
1256 | { | 1256 | { |
1257 | struct il_priv *priv = hw->priv; | 1257 | struct il_priv *il = hw->priv; |
1258 | struct il_rxon_context *ctx; | 1258 | struct il_rxon_context *ctx; |
1259 | unsigned long flags; | 1259 | unsigned long flags; |
1260 | int q; | 1260 | int q; |
1261 | 1261 | ||
1262 | IL_DEBUG_MAC80211(priv, "enter\n"); | 1262 | IL_DEBUG_MAC80211(il, "enter\n"); |
1263 | 1263 | ||
1264 | if (!il_is_ready_rf(priv)) { | 1264 | if (!il_is_ready_rf(il)) { |
1265 | IL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); | 1265 | IL_DEBUG_MAC80211(il, "leave - RF not ready\n"); |
1266 | return -EIO; | 1266 | return -EIO; |
1267 | } | 1267 | } |
1268 | 1268 | ||
1269 | if (queue >= AC_NUM) { | 1269 | if (queue >= AC_NUM) { |
1270 | IL_DEBUG_MAC80211(priv, "leave - queue >= AC_NUM %d\n", queue); | 1270 | IL_DEBUG_MAC80211(il, "leave - queue >= AC_NUM %d\n", queue); |
1271 | return 0; | 1271 | return 0; |
1272 | } | 1272 | } |
1273 | 1273 | ||
1274 | q = AC_NUM - 1 - queue; | 1274 | q = AC_NUM - 1 - queue; |
1275 | 1275 | ||
1276 | spin_lock_irqsave(&priv->lock, flags); | 1276 | spin_lock_irqsave(&il->lock, flags); |
1277 | 1277 | ||
1278 | for_each_context(priv, ctx) { | 1278 | for_each_context(il, ctx) { |
1279 | ctx->qos_data.def_qos_parm.ac[q].cw_min = | 1279 | ctx->qos_data.def_qos_parm.ac[q].cw_min = |
1280 | cpu_to_le16(params->cw_min); | 1280 | cpu_to_le16(params->cw_min); |
1281 | ctx->qos_data.def_qos_parm.ac[q].cw_max = | 1281 | ctx->qos_data.def_qos_parm.ac[q].cw_max = |
@@ -1287,50 +1287,50 @@ int il_mac_conf_tx(struct ieee80211_hw *hw, | |||
1287 | ctx->qos_data.def_qos_parm.ac[q].reserved1 = 0; | 1287 | ctx->qos_data.def_qos_parm.ac[q].reserved1 = 0; |
1288 | } | 1288 | } |
1289 | 1289 | ||
1290 | spin_unlock_irqrestore(&priv->lock, flags); | 1290 | spin_unlock_irqrestore(&il->lock, flags); |
1291 | 1291 | ||
1292 | IL_DEBUG_MAC80211(priv, "leave\n"); | 1292 | IL_DEBUG_MAC80211(il, "leave\n"); |
1293 | return 0; | 1293 | return 0; |
1294 | } | 1294 | } |
1295 | EXPORT_SYMBOL(il_mac_conf_tx); | 1295 | EXPORT_SYMBOL(il_mac_conf_tx); |
1296 | 1296 | ||
1297 | int il_mac_tx_last_beacon(struct ieee80211_hw *hw) | 1297 | int il_mac_tx_last_beacon(struct ieee80211_hw *hw) |
1298 | { | 1298 | { |
1299 | struct il_priv *priv = hw->priv; | 1299 | struct il_priv *il = hw->priv; |
1300 | 1300 | ||
1301 | return priv->ibss_manager == IL_IBSS_MANAGER; | 1301 | return il->ibss_manager == IL_IBSS_MANAGER; |
1302 | } | 1302 | } |
1303 | EXPORT_SYMBOL_GPL(il_mac_tx_last_beacon); | 1303 | EXPORT_SYMBOL_GPL(il_mac_tx_last_beacon); |
1304 | 1304 | ||
1305 | static int | 1305 | static int |
1306 | il_set_mode(struct il_priv *priv, struct il_rxon_context *ctx) | 1306 | il_set_mode(struct il_priv *il, struct il_rxon_context *ctx) |
1307 | { | 1307 | { |
1308 | il_connection_init_rx_config(priv, ctx); | 1308 | il_connection_init_rx_config(il, ctx); |
1309 | 1309 | ||
1310 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 1310 | if (il->cfg->ops->hcmd->set_rxon_chain) |
1311 | priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); | 1311 | il->cfg->ops->hcmd->set_rxon_chain(il, ctx); |
1312 | 1312 | ||
1313 | return il_commit_rxon(priv, ctx); | 1313 | return il_commit_rxon(il, ctx); |
1314 | } | 1314 | } |
1315 | 1315 | ||
1316 | static int il_setup_interface(struct il_priv *priv, | 1316 | static int il_setup_interface(struct il_priv *il, |
1317 | struct il_rxon_context *ctx) | 1317 | struct il_rxon_context *ctx) |
1318 | { | 1318 | { |
1319 | struct ieee80211_vif *vif = ctx->vif; | 1319 | struct ieee80211_vif *vif = ctx->vif; |
1320 | int err; | 1320 | int err; |
1321 | 1321 | ||
1322 | lockdep_assert_held(&priv->mutex); | 1322 | lockdep_assert_held(&il->mutex); |
1323 | 1323 | ||
1324 | /* | 1324 | /* |
1325 | * This variable will be correct only when there's just | 1325 | * This variable will be correct only when there's just |
1326 | * a single context, but all code using it is for hardware | 1326 | * a single context, but all code using it is for hardware |
1327 | * that supports only one context. | 1327 | * that supports only one context. |
1328 | */ | 1328 | */ |
1329 | priv->iw_mode = vif->type; | 1329 | il->iw_mode = vif->type; |
1330 | 1330 | ||
1331 | ctx->is_active = true; | 1331 | ctx->is_active = true; |
1332 | 1332 | ||
1333 | err = il_set_mode(priv, ctx); | 1333 | err = il_set_mode(il, ctx); |
1334 | if (err) { | 1334 | if (err) { |
1335 | if (!ctx->always_active) | 1335 | if (!ctx->always_active) |
1336 | ctx->is_active = false; | 1336 | ctx->is_active = false; |
@@ -1343,23 +1343,23 @@ static int il_setup_interface(struct il_priv *priv, | |||
1343 | int | 1343 | int |
1344 | il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | 1344 | il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) |
1345 | { | 1345 | { |
1346 | struct il_priv *priv = hw->priv; | 1346 | struct il_priv *il = hw->priv; |
1347 | struct il_vif_priv *vif_priv = (void *)vif->drv_priv; | 1347 | struct il_vif_priv *vif_priv = (void *)vif->drv_priv; |
1348 | struct il_rxon_context *tmp, *ctx = NULL; | 1348 | struct il_rxon_context *tmp, *ctx = NULL; |
1349 | int err; | 1349 | int err; |
1350 | 1350 | ||
1351 | IL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", | 1351 | IL_DEBUG_MAC80211(il, "enter: type %d, addr %pM\n", |
1352 | vif->type, vif->addr); | 1352 | vif->type, vif->addr); |
1353 | 1353 | ||
1354 | mutex_lock(&priv->mutex); | 1354 | mutex_lock(&il->mutex); |
1355 | 1355 | ||
1356 | if (!il_is_ready_rf(priv)) { | 1356 | if (!il_is_ready_rf(il)) { |
1357 | IL_WARN(priv, "Try to add interface when device not ready\n"); | 1357 | IL_WARN(il, "Try to add interface when device not ready\n"); |
1358 | err = -EINVAL; | 1358 | err = -EINVAL; |
1359 | goto out; | 1359 | goto out; |
1360 | } | 1360 | } |
1361 | 1361 | ||
1362 | for_each_context(priv, tmp) { | 1362 | for_each_context(il, tmp) { |
1363 | u32 possible_modes = | 1363 | u32 possible_modes = |
1364 | tmp->interface_modes | tmp->exclusive_interface_modes; | 1364 | tmp->interface_modes | tmp->exclusive_interface_modes; |
1365 | 1365 | ||
@@ -1389,35 +1389,35 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | |||
1389 | vif_priv->ctx = ctx; | 1389 | vif_priv->ctx = ctx; |
1390 | ctx->vif = vif; | 1390 | ctx->vif = vif; |
1391 | 1391 | ||
1392 | err = il_setup_interface(priv, ctx); | 1392 | err = il_setup_interface(il, ctx); |
1393 | if (!err) | 1393 | if (!err) |
1394 | goto out; | 1394 | goto out; |
1395 | 1395 | ||
1396 | ctx->vif = NULL; | 1396 | ctx->vif = NULL; |
1397 | priv->iw_mode = NL80211_IFTYPE_STATION; | 1397 | il->iw_mode = NL80211_IFTYPE_STATION; |
1398 | out: | 1398 | out: |
1399 | mutex_unlock(&priv->mutex); | 1399 | mutex_unlock(&il->mutex); |
1400 | 1400 | ||
1401 | IL_DEBUG_MAC80211(priv, "leave\n"); | 1401 | IL_DEBUG_MAC80211(il, "leave\n"); |
1402 | return err; | 1402 | return err; |
1403 | } | 1403 | } |
1404 | EXPORT_SYMBOL(il_mac_add_interface); | 1404 | EXPORT_SYMBOL(il_mac_add_interface); |
1405 | 1405 | ||
1406 | static void il_teardown_interface(struct il_priv *priv, | 1406 | static void il_teardown_interface(struct il_priv *il, |
1407 | struct ieee80211_vif *vif, | 1407 | struct ieee80211_vif *vif, |
1408 | bool mode_change) | 1408 | bool mode_change) |
1409 | { | 1409 | { |
1410 | struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); | 1410 | struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); |
1411 | 1411 | ||
1412 | lockdep_assert_held(&priv->mutex); | 1412 | lockdep_assert_held(&il->mutex); |
1413 | 1413 | ||
1414 | if (priv->scan_vif == vif) { | 1414 | if (il->scan_vif == vif) { |
1415 | il_scan_cancel_timeout(priv, 200); | 1415 | il_scan_cancel_timeout(il, 200); |
1416 | il_force_scan_end(priv); | 1416 | il_force_scan_end(il); |
1417 | } | 1417 | } |
1418 | 1418 | ||
1419 | if (!mode_change) { | 1419 | if (!mode_change) { |
1420 | il_set_mode(priv, ctx); | 1420 | il_set_mode(il, ctx); |
1421 | if (!ctx->always_active) | 1421 | if (!ctx->always_active) |
1422 | ctx->is_active = false; | 1422 | ctx->is_active = false; |
1423 | } | 1423 | } |
@@ -1426,45 +1426,45 @@ static void il_teardown_interface(struct il_priv *priv, | |||
1426 | void il_mac_remove_interface(struct ieee80211_hw *hw, | 1426 | void il_mac_remove_interface(struct ieee80211_hw *hw, |
1427 | struct ieee80211_vif *vif) | 1427 | struct ieee80211_vif *vif) |
1428 | { | 1428 | { |
1429 | struct il_priv *priv = hw->priv; | 1429 | struct il_priv *il = hw->priv; |
1430 | struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); | 1430 | struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); |
1431 | 1431 | ||
1432 | IL_DEBUG_MAC80211(priv, "enter\n"); | 1432 | IL_DEBUG_MAC80211(il, "enter\n"); |
1433 | 1433 | ||
1434 | mutex_lock(&priv->mutex); | 1434 | mutex_lock(&il->mutex); |
1435 | 1435 | ||
1436 | WARN_ON(ctx->vif != vif); | 1436 | WARN_ON(ctx->vif != vif); |
1437 | ctx->vif = NULL; | 1437 | ctx->vif = NULL; |
1438 | 1438 | ||
1439 | il_teardown_interface(priv, vif, false); | 1439 | il_teardown_interface(il, vif, false); |
1440 | 1440 | ||
1441 | memset(priv->bssid, 0, ETH_ALEN); | 1441 | memset(il->bssid, 0, ETH_ALEN); |
1442 | mutex_unlock(&priv->mutex); | 1442 | mutex_unlock(&il->mutex); |
1443 | 1443 | ||
1444 | IL_DEBUG_MAC80211(priv, "leave\n"); | 1444 | IL_DEBUG_MAC80211(il, "leave\n"); |
1445 | 1445 | ||
1446 | } | 1446 | } |
1447 | EXPORT_SYMBOL(il_mac_remove_interface); | 1447 | EXPORT_SYMBOL(il_mac_remove_interface); |
1448 | 1448 | ||
1449 | int il_alloc_txq_mem(struct il_priv *priv) | 1449 | int il_alloc_txq_mem(struct il_priv *il) |
1450 | { | 1450 | { |
1451 | if (!priv->txq) | 1451 | if (!il->txq) |
1452 | priv->txq = kzalloc( | 1452 | il->txq = kzalloc( |
1453 | sizeof(struct il_tx_queue) * | 1453 | sizeof(struct il_tx_queue) * |
1454 | priv->cfg->base_params->num_of_queues, | 1454 | il->cfg->base_params->num_of_queues, |
1455 | GFP_KERNEL); | 1455 | GFP_KERNEL); |
1456 | if (!priv->txq) { | 1456 | if (!il->txq) { |
1457 | IL_ERR(priv, "Not enough memory for txq\n"); | 1457 | IL_ERR(il, "Not enough memory for txq\n"); |
1458 | return -ENOMEM; | 1458 | return -ENOMEM; |
1459 | } | 1459 | } |
1460 | return 0; | 1460 | return 0; |
1461 | } | 1461 | } |
1462 | EXPORT_SYMBOL(il_alloc_txq_mem); | 1462 | EXPORT_SYMBOL(il_alloc_txq_mem); |
1463 | 1463 | ||
1464 | void il_txq_mem(struct il_priv *priv) | 1464 | void il_txq_mem(struct il_priv *il) |
1465 | { | 1465 | { |
1466 | kfree(priv->txq); | 1466 | kfree(il->txq); |
1467 | priv->txq = NULL; | 1467 | il->txq = NULL; |
1468 | } | 1468 | } |
1469 | EXPORT_SYMBOL(il_txq_mem); | 1469 | EXPORT_SYMBOL(il_txq_mem); |
1470 | 1470 | ||
@@ -1472,52 +1472,52 @@ EXPORT_SYMBOL(il_txq_mem); | |||
1472 | 1472 | ||
1473 | #define IL_TRAFFIC_DUMP_SIZE (IL_TRAFFIC_ENTRY_SIZE * IL_TRAFFIC_ENTRIES) | 1473 | #define IL_TRAFFIC_DUMP_SIZE (IL_TRAFFIC_ENTRY_SIZE * IL_TRAFFIC_ENTRIES) |
1474 | 1474 | ||
1475 | void il_reset_traffic_log(struct il_priv *priv) | 1475 | void il_reset_traffic_log(struct il_priv *il) |
1476 | { | 1476 | { |
1477 | priv->tx_traffic_idx = 0; | 1477 | il->tx_traffic_idx = 0; |
1478 | priv->rx_traffic_idx = 0; | 1478 | il->rx_traffic_idx = 0; |
1479 | if (priv->tx_traffic) | 1479 | if (il->tx_traffic) |
1480 | memset(priv->tx_traffic, 0, IL_TRAFFIC_DUMP_SIZE); | 1480 | memset(il->tx_traffic, 0, IL_TRAFFIC_DUMP_SIZE); |
1481 | if (priv->rx_traffic) | 1481 | if (il->rx_traffic) |
1482 | memset(priv->rx_traffic, 0, IL_TRAFFIC_DUMP_SIZE); | 1482 | memset(il->rx_traffic, 0, IL_TRAFFIC_DUMP_SIZE); |
1483 | } | 1483 | } |
1484 | 1484 | ||
1485 | int il_alloc_traffic_mem(struct il_priv *priv) | 1485 | int il_alloc_traffic_mem(struct il_priv *il) |
1486 | { | 1486 | { |
1487 | u32 traffic_size = IL_TRAFFIC_DUMP_SIZE; | 1487 | u32 traffic_size = IL_TRAFFIC_DUMP_SIZE; |
1488 | 1488 | ||
1489 | if (iwlegacy_debug_level & IL_DL_TX) { | 1489 | if (iwlegacy_debug_level & IL_DL_TX) { |
1490 | if (!priv->tx_traffic) { | 1490 | if (!il->tx_traffic) { |
1491 | priv->tx_traffic = | 1491 | il->tx_traffic = |
1492 | kzalloc(traffic_size, GFP_KERNEL); | 1492 | kzalloc(traffic_size, GFP_KERNEL); |
1493 | if (!priv->tx_traffic) | 1493 | if (!il->tx_traffic) |
1494 | return -ENOMEM; | 1494 | return -ENOMEM; |
1495 | } | 1495 | } |
1496 | } | 1496 | } |
1497 | if (iwlegacy_debug_level & IL_DL_RX) { | 1497 | if (iwlegacy_debug_level & IL_DL_RX) { |
1498 | if (!priv->rx_traffic) { | 1498 | if (!il->rx_traffic) { |
1499 | priv->rx_traffic = | 1499 | il->rx_traffic = |
1500 | kzalloc(traffic_size, GFP_KERNEL); | 1500 | kzalloc(traffic_size, GFP_KERNEL); |
1501 | if (!priv->rx_traffic) | 1501 | if (!il->rx_traffic) |
1502 | return -ENOMEM; | 1502 | return -ENOMEM; |
1503 | } | 1503 | } |
1504 | } | 1504 | } |
1505 | il_reset_traffic_log(priv); | 1505 | il_reset_traffic_log(il); |
1506 | return 0; | 1506 | return 0; |
1507 | } | 1507 | } |
1508 | EXPORT_SYMBOL(il_alloc_traffic_mem); | 1508 | EXPORT_SYMBOL(il_alloc_traffic_mem); |
1509 | 1509 | ||
1510 | void il_free_traffic_mem(struct il_priv *priv) | 1510 | void il_free_traffic_mem(struct il_priv *il) |
1511 | { | 1511 | { |
1512 | kfree(priv->tx_traffic); | 1512 | kfree(il->tx_traffic); |
1513 | priv->tx_traffic = NULL; | 1513 | il->tx_traffic = NULL; |
1514 | 1514 | ||
1515 | kfree(priv->rx_traffic); | 1515 | kfree(il->rx_traffic); |
1516 | priv->rx_traffic = NULL; | 1516 | il->rx_traffic = NULL; |
1517 | } | 1517 | } |
1518 | EXPORT_SYMBOL(il_free_traffic_mem); | 1518 | EXPORT_SYMBOL(il_free_traffic_mem); |
1519 | 1519 | ||
1520 | void il_dbg_log_tx_data_frame(struct il_priv *priv, | 1520 | void il_dbg_log_tx_data_frame(struct il_priv *il, |
1521 | u16 length, struct ieee80211_hdr *header) | 1521 | u16 length, struct ieee80211_hdr *header) |
1522 | { | 1522 | { |
1523 | __le16 fc; | 1523 | __le16 fc; |
@@ -1526,23 +1526,23 @@ void il_dbg_log_tx_data_frame(struct il_priv *priv, | |||
1526 | if (likely(!(iwlegacy_debug_level & IL_DL_TX))) | 1526 | if (likely(!(iwlegacy_debug_level & IL_DL_TX))) |
1527 | return; | 1527 | return; |
1528 | 1528 | ||
1529 | if (!priv->tx_traffic) | 1529 | if (!il->tx_traffic) |
1530 | return; | 1530 | return; |
1531 | 1531 | ||
1532 | fc = header->frame_control; | 1532 | fc = header->frame_control; |
1533 | if (ieee80211_is_data(fc)) { | 1533 | if (ieee80211_is_data(fc)) { |
1534 | len = (length > IL_TRAFFIC_ENTRY_SIZE) | 1534 | len = (length > IL_TRAFFIC_ENTRY_SIZE) |
1535 | ? IL_TRAFFIC_ENTRY_SIZE : length; | 1535 | ? IL_TRAFFIC_ENTRY_SIZE : length; |
1536 | memcpy((priv->tx_traffic + | 1536 | memcpy((il->tx_traffic + |
1537 | (priv->tx_traffic_idx * IL_TRAFFIC_ENTRY_SIZE)), | 1537 | (il->tx_traffic_idx * IL_TRAFFIC_ENTRY_SIZE)), |
1538 | header, len); | 1538 | header, len); |
1539 | priv->tx_traffic_idx = | 1539 | il->tx_traffic_idx = |
1540 | (priv->tx_traffic_idx + 1) % IL_TRAFFIC_ENTRIES; | 1540 | (il->tx_traffic_idx + 1) % IL_TRAFFIC_ENTRIES; |
1541 | } | 1541 | } |
1542 | } | 1542 | } |
1543 | EXPORT_SYMBOL(il_dbg_log_tx_data_frame); | 1543 | EXPORT_SYMBOL(il_dbg_log_tx_data_frame); |
1544 | 1544 | ||
1545 | void il_dbg_log_rx_data_frame(struct il_priv *priv, | 1545 | void il_dbg_log_rx_data_frame(struct il_priv *il, |
1546 | u16 length, struct ieee80211_hdr *header) | 1546 | u16 length, struct ieee80211_hdr *header) |
1547 | { | 1547 | { |
1548 | __le16 fc; | 1548 | __le16 fc; |
@@ -1551,18 +1551,18 @@ void il_dbg_log_rx_data_frame(struct il_priv *priv, | |||
1551 | if (likely(!(iwlegacy_debug_level & IL_DL_RX))) | 1551 | if (likely(!(iwlegacy_debug_level & IL_DL_RX))) |
1552 | return; | 1552 | return; |
1553 | 1553 | ||
1554 | if (!priv->rx_traffic) | 1554 | if (!il->rx_traffic) |
1555 | return; | 1555 | return; |
1556 | 1556 | ||
1557 | fc = header->frame_control; | 1557 | fc = header->frame_control; |
1558 | if (ieee80211_is_data(fc)) { | 1558 | if (ieee80211_is_data(fc)) { |
1559 | len = (length > IL_TRAFFIC_ENTRY_SIZE) | 1559 | len = (length > IL_TRAFFIC_ENTRY_SIZE) |
1560 | ? IL_TRAFFIC_ENTRY_SIZE : length; | 1560 | ? IL_TRAFFIC_ENTRY_SIZE : length; |
1561 | memcpy((priv->rx_traffic + | 1561 | memcpy((il->rx_traffic + |
1562 | (priv->rx_traffic_idx * IL_TRAFFIC_ENTRY_SIZE)), | 1562 | (il->rx_traffic_idx * IL_TRAFFIC_ENTRY_SIZE)), |
1563 | header, len); | 1563 | header, len); |
1564 | priv->rx_traffic_idx = | 1564 | il->rx_traffic_idx = |
1565 | (priv->rx_traffic_idx + 1) % IL_TRAFFIC_ENTRIES; | 1565 | (il->rx_traffic_idx + 1) % IL_TRAFFIC_ENTRIES; |
1566 | } | 1566 | } |
1567 | } | 1567 | } |
1568 | EXPORT_SYMBOL(il_dbg_log_rx_data_frame); | 1568 | EXPORT_SYMBOL(il_dbg_log_rx_data_frame); |
@@ -1605,10 +1605,10 @@ const char *il_get_ctrl_string(int cmd) | |||
1605 | } | 1605 | } |
1606 | } | 1606 | } |
1607 | 1607 | ||
1608 | void il_clear_traffic_stats(struct il_priv *priv) | 1608 | void il_clear_traffic_stats(struct il_priv *il) |
1609 | { | 1609 | { |
1610 | memset(&priv->tx_stats, 0, sizeof(struct traffic_stats)); | 1610 | memset(&il->tx_stats, 0, sizeof(struct traffic_stats)); |
1611 | memset(&priv->rx_stats, 0, sizeof(struct traffic_stats)); | 1611 | memset(&il->rx_stats, 0, sizeof(struct traffic_stats)); |
1612 | } | 1612 | } |
1613 | 1613 | ||
1614 | /* | 1614 | /* |
@@ -1623,14 +1623,14 @@ void il_clear_traffic_stats(struct il_priv *priv) | |||
1623 | * | 1623 | * |
1624 | */ | 1624 | */ |
1625 | void | 1625 | void |
1626 | il_update_stats(struct il_priv *priv, bool is_tx, __le16 fc, u16 len) | 1626 | il_update_stats(struct il_priv *il, bool is_tx, __le16 fc, u16 len) |
1627 | { | 1627 | { |
1628 | struct traffic_stats *stats; | 1628 | struct traffic_stats *stats; |
1629 | 1629 | ||
1630 | if (is_tx) | 1630 | if (is_tx) |
1631 | stats = &priv->tx_stats; | 1631 | stats = &il->tx_stats; |
1632 | else | 1632 | else |
1633 | stats = &priv->rx_stats; | 1633 | stats = &il->rx_stats; |
1634 | 1634 | ||
1635 | if (ieee80211_is_mgmt(fc)) { | 1635 | if (ieee80211_is_mgmt(fc)) { |
1636 | switch (fc & cpu_to_le16(IEEE80211_FCTL_STYPE)) { | 1636 | 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) | |||
1707 | EXPORT_SYMBOL(il_update_stats); | 1707 | EXPORT_SYMBOL(il_update_stats); |
1708 | #endif | 1708 | #endif |
1709 | 1709 | ||
1710 | int il_force_reset(struct il_priv *priv, bool external) | 1710 | int il_force_reset(struct il_priv *il, bool external) |
1711 | { | 1711 | { |
1712 | struct il_force_reset *force_reset; | 1712 | struct il_force_reset *force_reset; |
1713 | 1713 | ||
1714 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 1714 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) |
1715 | return -EINVAL; | 1715 | return -EINVAL; |
1716 | 1716 | ||
1717 | force_reset = &priv->force_reset; | 1717 | force_reset = &il->force_reset; |
1718 | force_reset->reset_request_count++; | 1718 | force_reset->reset_request_count++; |
1719 | if (!external) { | 1719 | if (!external) { |
1720 | if (force_reset->last_force_reset_jiffies && | 1720 | if (force_reset->last_force_reset_jiffies && |
1721 | time_after(force_reset->last_force_reset_jiffies + | 1721 | time_after(force_reset->last_force_reset_jiffies + |
1722 | force_reset->reset_duration, jiffies)) { | 1722 | force_reset->reset_duration, jiffies)) { |
1723 | IL_DEBUG_INFO(priv, "force reset rejected\n"); | 1723 | IL_DEBUG_INFO(il, "force reset rejected\n"); |
1724 | force_reset->reset_reject_count++; | 1724 | force_reset->reset_reject_count++; |
1725 | return -EAGAIN; | 1725 | return -EAGAIN; |
1726 | } | 1726 | } |
@@ -1737,23 +1737,23 @@ int il_force_reset(struct il_priv *priv, bool external) | |||
1737 | * need to be check before performing firmware reload | 1737 | * need to be check before performing firmware reload |
1738 | */ | 1738 | */ |
1739 | 1739 | ||
1740 | if (!external && !priv->cfg->mod_params->restart_fw) { | 1740 | if (!external && !il->cfg->mod_params->restart_fw) { |
1741 | IL_DEBUG_INFO(priv, "Cancel firmware reload based on " | 1741 | IL_DEBUG_INFO(il, "Cancel firmware reload based on " |
1742 | "module parameter setting\n"); | 1742 | "module parameter setting\n"); |
1743 | return 0; | 1743 | return 0; |
1744 | } | 1744 | } |
1745 | 1745 | ||
1746 | IL_ERR(priv, "On demand firmware reload\n"); | 1746 | IL_ERR(il, "On demand firmware reload\n"); |
1747 | 1747 | ||
1748 | /* Set the FW error flag -- cleared on il_down */ | 1748 | /* Set the FW error flag -- cleared on il_down */ |
1749 | set_bit(STATUS_FW_ERROR, &priv->status); | 1749 | set_bit(STATUS_FW_ERROR, &il->status); |
1750 | wake_up(&priv->wait_command_queue); | 1750 | wake_up(&il->wait_command_queue); |
1751 | /* | 1751 | /* |
1752 | * Keep the restart process from trying to send host | 1752 | * Keep the restart process from trying to send host |
1753 | * commands by clearing the INIT status bit | 1753 | * commands by clearing the INIT status bit |
1754 | */ | 1754 | */ |
1755 | clear_bit(STATUS_READY, &priv->status); | 1755 | clear_bit(STATUS_READY, &il->status); |
1756 | queue_work(priv->workqueue, &priv->restart); | 1756 | queue_work(il->workqueue, &il->restart); |
1757 | 1757 | ||
1758 | return 0; | 1758 | return 0; |
1759 | } | 1759 | } |
@@ -1763,7 +1763,7 @@ il_mac_change_interface(struct ieee80211_hw *hw, | |||
1763 | struct ieee80211_vif *vif, | 1763 | struct ieee80211_vif *vif, |
1764 | enum nl80211_iftype newtype, bool newp2p) | 1764 | enum nl80211_iftype newtype, bool newp2p) |
1765 | { | 1765 | { |
1766 | struct il_priv *priv = hw->priv; | 1766 | struct il_priv *il = hw->priv; |
1767 | struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); | 1767 | struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); |
1768 | struct il_rxon_context *tmp; | 1768 | struct il_rxon_context *tmp; |
1769 | u32 interface_modes; | 1769 | u32 interface_modes; |
@@ -1771,9 +1771,9 @@ il_mac_change_interface(struct ieee80211_hw *hw, | |||
1771 | 1771 | ||
1772 | newtype = ieee80211_iftype_p2p(newtype, newp2p); | 1772 | newtype = ieee80211_iftype_p2p(newtype, newp2p); |
1773 | 1773 | ||
1774 | mutex_lock(&priv->mutex); | 1774 | mutex_lock(&il->mutex); |
1775 | 1775 | ||
1776 | if (!ctx->vif || !il_is_ready_rf(priv)) { | 1776 | if (!ctx->vif || !il_is_ready_rf(il)) { |
1777 | /* | 1777 | /* |
1778 | * Huh? But wait ... this can maybe happen when | 1778 | * Huh? But wait ... this can maybe happen when |
1779 | * we're in the middle of a firmware restart! | 1779 | * we're in the middle of a firmware restart! |
@@ -1790,7 +1790,7 @@ il_mac_change_interface(struct ieee80211_hw *hw, | |||
1790 | } | 1790 | } |
1791 | 1791 | ||
1792 | if (ctx->exclusive_interface_modes & BIT(newtype)) { | 1792 | if (ctx->exclusive_interface_modes & BIT(newtype)) { |
1793 | for_each_context(priv, tmp) { | 1793 | for_each_context(il, tmp) { |
1794 | if (ctx == tmp) | 1794 | if (ctx == tmp) |
1795 | continue; | 1795 | continue; |
1796 | 1796 | ||
@@ -1807,10 +1807,10 @@ il_mac_change_interface(struct ieee80211_hw *hw, | |||
1807 | } | 1807 | } |
1808 | 1808 | ||
1809 | /* success */ | 1809 | /* success */ |
1810 | il_teardown_interface(priv, vif, true); | 1810 | il_teardown_interface(il, vif, true); |
1811 | vif->type = newtype; | 1811 | vif->type = newtype; |
1812 | vif->p2p = newp2p; | 1812 | vif->p2p = newp2p; |
1813 | err = il_setup_interface(priv, ctx); | 1813 | err = il_setup_interface(il, ctx); |
1814 | WARN_ON(err); | 1814 | WARN_ON(err); |
1815 | /* | 1815 | /* |
1816 | * We've switched internally, but submitting to the | 1816 | * We've switched internally, but submitting to the |
@@ -1822,7 +1822,7 @@ il_mac_change_interface(struct ieee80211_hw *hw, | |||
1822 | err = 0; | 1822 | err = 0; |
1823 | 1823 | ||
1824 | out: | 1824 | out: |
1825 | mutex_unlock(&priv->mutex); | 1825 | mutex_unlock(&il->mutex); |
1826 | return err; | 1826 | return err; |
1827 | } | 1827 | } |
1828 | EXPORT_SYMBOL(il_mac_change_interface); | 1828 | EXPORT_SYMBOL(il_mac_change_interface); |
@@ -1831,9 +1831,9 @@ EXPORT_SYMBOL(il_mac_change_interface); | |||
1831 | * On every watchdog tick we check (latest) time stamp. If it does not | 1831 | * On every watchdog tick we check (latest) time stamp. If it does not |
1832 | * change during timeout period and queue is not empty we reset firmware. | 1832 | * change during timeout period and queue is not empty we reset firmware. |
1833 | */ | 1833 | */ |
1834 | static int il_check_stuck_queue(struct il_priv *priv, int cnt) | 1834 | static int il_check_stuck_queue(struct il_priv *il, int cnt) |
1835 | { | 1835 | { |
1836 | struct il_tx_queue *txq = &priv->txq[cnt]; | 1836 | struct il_tx_queue *txq = &il->txq[cnt]; |
1837 | struct il_queue *q = &txq->q; | 1837 | struct il_queue *q = &txq->q; |
1838 | unsigned long timeout; | 1838 | unsigned long timeout; |
1839 | int ret; | 1839 | int ret; |
@@ -1844,12 +1844,12 @@ static int il_check_stuck_queue(struct il_priv *priv, int cnt) | |||
1844 | } | 1844 | } |
1845 | 1845 | ||
1846 | timeout = txq->time_stamp + | 1846 | timeout = txq->time_stamp + |
1847 | msecs_to_jiffies(priv->cfg->base_params->wd_timeout); | 1847 | msecs_to_jiffies(il->cfg->base_params->wd_timeout); |
1848 | 1848 | ||
1849 | if (time_after(jiffies, timeout)) { | 1849 | if (time_after(jiffies, timeout)) { |
1850 | IL_ERR(priv, "Queue %d stuck for %u ms.\n", | 1850 | IL_ERR(il, "Queue %d stuck for %u ms.\n", |
1851 | q->id, priv->cfg->base_params->wd_timeout); | 1851 | q->id, il->cfg->base_params->wd_timeout); |
1852 | ret = il_force_reset(priv, false); | 1852 | ret = il_force_reset(il, false); |
1853 | return (ret == -EAGAIN) ? 0 : 1; | 1853 | return (ret == -EAGAIN) ? 0 : 1; |
1854 | } | 1854 | } |
1855 | 1855 | ||
@@ -1868,46 +1868,46 @@ static int il_check_stuck_queue(struct il_priv *priv, int cnt) | |||
1868 | */ | 1868 | */ |
1869 | void il_bg_watchdog(unsigned long data) | 1869 | void il_bg_watchdog(unsigned long data) |
1870 | { | 1870 | { |
1871 | struct il_priv *priv = (struct il_priv *)data; | 1871 | struct il_priv *il = (struct il_priv *)data; |
1872 | int cnt; | 1872 | int cnt; |
1873 | unsigned long timeout; | 1873 | unsigned long timeout; |
1874 | 1874 | ||
1875 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 1875 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) |
1876 | return; | 1876 | return; |
1877 | 1877 | ||
1878 | timeout = priv->cfg->base_params->wd_timeout; | 1878 | timeout = il->cfg->base_params->wd_timeout; |
1879 | if (timeout == 0) | 1879 | if (timeout == 0) |
1880 | return; | 1880 | return; |
1881 | 1881 | ||
1882 | /* monitor and check for stuck cmd queue */ | 1882 | /* monitor and check for stuck cmd queue */ |
1883 | if (il_check_stuck_queue(priv, priv->cmd_queue)) | 1883 | if (il_check_stuck_queue(il, il->cmd_queue)) |
1884 | return; | 1884 | return; |
1885 | 1885 | ||
1886 | /* monitor and check for other stuck queues */ | 1886 | /* monitor and check for other stuck queues */ |
1887 | if (il_is_any_associated(priv)) { | 1887 | if (il_is_any_associated(il)) { |
1888 | for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) { | 1888 | for (cnt = 0; cnt < il->hw_params.max_txq_num; cnt++) { |
1889 | /* skip as we already checked the command queue */ | 1889 | /* skip as we already checked the command queue */ |
1890 | if (cnt == priv->cmd_queue) | 1890 | if (cnt == il->cmd_queue) |
1891 | continue; | 1891 | continue; |
1892 | if (il_check_stuck_queue(priv, cnt)) | 1892 | if (il_check_stuck_queue(il, cnt)) |
1893 | return; | 1893 | return; |
1894 | } | 1894 | } |
1895 | } | 1895 | } |
1896 | 1896 | ||
1897 | mod_timer(&priv->watchdog, jiffies + | 1897 | mod_timer(&il->watchdog, jiffies + |
1898 | msecs_to_jiffies(IL_WD_TICK(timeout))); | 1898 | msecs_to_jiffies(IL_WD_TICK(timeout))); |
1899 | } | 1899 | } |
1900 | EXPORT_SYMBOL(il_bg_watchdog); | 1900 | EXPORT_SYMBOL(il_bg_watchdog); |
1901 | 1901 | ||
1902 | void il_setup_watchdog(struct il_priv *priv) | 1902 | void il_setup_watchdog(struct il_priv *il) |
1903 | { | 1903 | { |
1904 | unsigned int timeout = priv->cfg->base_params->wd_timeout; | 1904 | unsigned int timeout = il->cfg->base_params->wd_timeout; |
1905 | 1905 | ||
1906 | if (timeout) | 1906 | if (timeout) |
1907 | mod_timer(&priv->watchdog, | 1907 | mod_timer(&il->watchdog, |
1908 | jiffies + msecs_to_jiffies(IL_WD_TICK(timeout))); | 1908 | jiffies + msecs_to_jiffies(IL_WD_TICK(timeout))); |
1909 | else | 1909 | else |
1910 | del_timer(&priv->watchdog); | 1910 | del_timer(&il->watchdog); |
1911 | } | 1911 | } |
1912 | EXPORT_SYMBOL(il_setup_watchdog); | 1912 | EXPORT_SYMBOL(il_setup_watchdog); |
1913 | 1913 | ||
@@ -1918,7 +1918,7 @@ EXPORT_SYMBOL(il_setup_watchdog); | |||
1918 | * the internal part is the time in usec within one beacon interval | 1918 | * the internal part is the time in usec within one beacon interval |
1919 | */ | 1919 | */ |
1920 | u32 | 1920 | u32 |
1921 | il_usecs_to_beacons(struct il_priv *priv, | 1921 | il_usecs_to_beacons(struct il_priv *il, |
1922 | u32 usec, u32 beacon_interval) | 1922 | u32 usec, u32 beacon_interval) |
1923 | { | 1923 | { |
1924 | u32 quot; | 1924 | u32 quot; |
@@ -1929,39 +1929,39 @@ il_usecs_to_beacons(struct il_priv *priv, | |||
1929 | return 0; | 1929 | return 0; |
1930 | 1930 | ||
1931 | quot = (usec / interval) & | 1931 | quot = (usec / interval) & |
1932 | (il_beacon_time_mask_high(priv, | 1932 | (il_beacon_time_mask_high(il, |
1933 | priv->hw_params.beacon_time_tsf_bits) >> | 1933 | il->hw_params.beacon_time_tsf_bits) >> |
1934 | priv->hw_params.beacon_time_tsf_bits); | 1934 | il->hw_params.beacon_time_tsf_bits); |
1935 | rem = (usec % interval) & il_beacon_time_mask_low(priv, | 1935 | rem = (usec % interval) & il_beacon_time_mask_low(il, |
1936 | priv->hw_params.beacon_time_tsf_bits); | 1936 | il->hw_params.beacon_time_tsf_bits); |
1937 | 1937 | ||
1938 | return (quot << priv->hw_params.beacon_time_tsf_bits) + rem; | 1938 | return (quot << il->hw_params.beacon_time_tsf_bits) + rem; |
1939 | } | 1939 | } |
1940 | EXPORT_SYMBOL(il_usecs_to_beacons); | 1940 | EXPORT_SYMBOL(il_usecs_to_beacons); |
1941 | 1941 | ||
1942 | /* base is usually what we get from ucode with each received frame, | 1942 | /* base is usually what we get from ucode with each received frame, |
1943 | * the same as HW timer counter counting down | 1943 | * the same as HW timer counter counting down |
1944 | */ | 1944 | */ |
1945 | __le32 il_add_beacon_time(struct il_priv *priv, u32 base, | 1945 | __le32 il_add_beacon_time(struct il_priv *il, u32 base, |
1946 | u32 addon, u32 beacon_interval) | 1946 | u32 addon, u32 beacon_interval) |
1947 | { | 1947 | { |
1948 | u32 base_low = base & il_beacon_time_mask_low(priv, | 1948 | u32 base_low = base & il_beacon_time_mask_low(il, |
1949 | priv->hw_params.beacon_time_tsf_bits); | 1949 | il->hw_params.beacon_time_tsf_bits); |
1950 | u32 addon_low = addon & il_beacon_time_mask_low(priv, | 1950 | u32 addon_low = addon & il_beacon_time_mask_low(il, |
1951 | priv->hw_params.beacon_time_tsf_bits); | 1951 | il->hw_params.beacon_time_tsf_bits); |
1952 | u32 interval = beacon_interval * TIME_UNIT; | 1952 | u32 interval = beacon_interval * TIME_UNIT; |
1953 | u32 res = (base & il_beacon_time_mask_high(priv, | 1953 | u32 res = (base & il_beacon_time_mask_high(il, |
1954 | priv->hw_params.beacon_time_tsf_bits)) + | 1954 | il->hw_params.beacon_time_tsf_bits)) + |
1955 | (addon & il_beacon_time_mask_high(priv, | 1955 | (addon & il_beacon_time_mask_high(il, |
1956 | priv->hw_params.beacon_time_tsf_bits)); | 1956 | il->hw_params.beacon_time_tsf_bits)); |
1957 | 1957 | ||
1958 | if (base_low > addon_low) | 1958 | if (base_low > addon_low) |
1959 | res += base_low - addon_low; | 1959 | res += base_low - addon_low; |
1960 | else if (base_low < addon_low) { | 1960 | else if (base_low < addon_low) { |
1961 | res += interval + base_low - addon_low; | 1961 | res += interval + base_low - addon_low; |
1962 | res += (1 << priv->hw_params.beacon_time_tsf_bits); | 1962 | res += (1 << il->hw_params.beacon_time_tsf_bits); |
1963 | } else | 1963 | } else |
1964 | res += (1 << priv->hw_params.beacon_time_tsf_bits); | 1964 | res += (1 << il->hw_params.beacon_time_tsf_bits); |
1965 | 1965 | ||
1966 | return cpu_to_le32(res); | 1966 | return cpu_to_le32(res); |
1967 | } | 1967 | } |
@@ -1972,7 +1972,7 @@ EXPORT_SYMBOL(il_add_beacon_time); | |||
1972 | int il_pci_suspend(struct device *device) | 1972 | int il_pci_suspend(struct device *device) |
1973 | { | 1973 | { |
1974 | struct pci_dev *pdev = to_pci_dev(device); | 1974 | struct pci_dev *pdev = to_pci_dev(device); |
1975 | struct il_priv *priv = pci_get_drvdata(pdev); | 1975 | struct il_priv *il = pci_get_drvdata(pdev); |
1976 | 1976 | ||
1977 | /* | 1977 | /* |
1978 | * This function is called when system goes into suspend state | 1978 | * This function is called when system goes into suspend state |
@@ -1981,7 +1981,7 @@ int il_pci_suspend(struct device *device) | |||
1981 | * it will not call apm_ops.stop() to stop the DMA operation. | 1981 | * it will not call apm_ops.stop() to stop the DMA operation. |
1982 | * Calling apm_ops.stop here to make sure we stop the DMA. | 1982 | * Calling apm_ops.stop here to make sure we stop the DMA. |
1983 | */ | 1983 | */ |
1984 | il_apm_stop(priv); | 1984 | il_apm_stop(il); |
1985 | 1985 | ||
1986 | return 0; | 1986 | return 0; |
1987 | } | 1987 | } |
@@ -1990,7 +1990,7 @@ EXPORT_SYMBOL(il_pci_suspend); | |||
1990 | int il_pci_resume(struct device *device) | 1990 | int il_pci_resume(struct device *device) |
1991 | { | 1991 | { |
1992 | struct pci_dev *pdev = to_pci_dev(device); | 1992 | struct pci_dev *pdev = to_pci_dev(device); |
1993 | struct il_priv *priv = pci_get_drvdata(pdev); | 1993 | struct il_priv *il = pci_get_drvdata(pdev); |
1994 | bool hw_rfkill = false; | 1994 | bool hw_rfkill = false; |
1995 | 1995 | ||
1996 | /* | 1996 | /* |
@@ -1999,18 +1999,18 @@ int il_pci_resume(struct device *device) | |||
1999 | */ | 1999 | */ |
2000 | pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); | 2000 | pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); |
2001 | 2001 | ||
2002 | il_enable_interrupts(priv); | 2002 | il_enable_interrupts(il); |
2003 | 2003 | ||
2004 | if (!(il_read32(priv, CSR_GP_CNTRL) & | 2004 | if (!(il_read32(il, CSR_GP_CNTRL) & |
2005 | CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) | 2005 | CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) |
2006 | hw_rfkill = true; | 2006 | hw_rfkill = true; |
2007 | 2007 | ||
2008 | if (hw_rfkill) | 2008 | if (hw_rfkill) |
2009 | set_bit(STATUS_RF_KILL_HW, &priv->status); | 2009 | set_bit(STATUS_RF_KILL_HW, &il->status); |
2010 | else | 2010 | else |
2011 | clear_bit(STATUS_RF_KILL_HW, &priv->status); | 2011 | clear_bit(STATUS_RF_KILL_HW, &il->status); |
2012 | 2012 | ||
2013 | wiphy_rfkill_set_hw_state(priv->hw->wiphy, hw_rfkill); | 2013 | wiphy_rfkill_set_hw_state(il->hw->wiphy, hw_rfkill); |
2014 | 2014 | ||
2015 | return 0; | 2015 | return 0; |
2016 | } | 2016 | } |
@@ -2029,9 +2029,9 @@ EXPORT_SYMBOL(il_pm_ops); | |||
2029 | #endif /* CONFIG_PM */ | 2029 | #endif /* CONFIG_PM */ |
2030 | 2030 | ||
2031 | static void | 2031 | static void |
2032 | il_update_qos(struct il_priv *priv, struct il_rxon_context *ctx) | 2032 | il_update_qos(struct il_priv *il, struct il_rxon_context *ctx) |
2033 | { | 2033 | { |
2034 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 2034 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) |
2035 | return; | 2035 | return; |
2036 | 2036 | ||
2037 | if (!ctx->is_active) | 2037 | if (!ctx->is_active) |
@@ -2046,11 +2046,11 @@ il_update_qos(struct il_priv *priv, struct il_rxon_context *ctx) | |||
2046 | if (ctx->ht.enabled) | 2046 | if (ctx->ht.enabled) |
2047 | ctx->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TGN_MSK; | 2047 | ctx->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TGN_MSK; |
2048 | 2048 | ||
2049 | IL_DEBUG_QOS(priv, "send QoS cmd with Qos active=%d FLAGS=0x%X\n", | 2049 | IL_DEBUG_QOS(il, "send QoS cmd with Qos active=%d FLAGS=0x%X\n", |
2050 | ctx->qos_data.qos_active, | 2050 | ctx->qos_data.qos_active, |
2051 | ctx->qos_data.def_qos_parm.qos_flags); | 2051 | ctx->qos_data.def_qos_parm.qos_flags); |
2052 | 2052 | ||
2053 | il_send_cmd_pdu_async(priv, ctx->qos_cmd, | 2053 | il_send_cmd_pdu_async(il, ctx->qos_cmd, |
2054 | sizeof(struct il_qosparam_cmd), | 2054 | sizeof(struct il_qosparam_cmd), |
2055 | &ctx->qos_data.def_qos_parm, NULL); | 2055 | &ctx->qos_data.def_qos_parm, NULL); |
2056 | } | 2056 | } |
@@ -2060,11 +2060,11 @@ il_update_qos(struct il_priv *priv, struct il_rxon_context *ctx) | |||
2060 | */ | 2060 | */ |
2061 | int il_mac_config(struct ieee80211_hw *hw, u32 changed) | 2061 | int il_mac_config(struct ieee80211_hw *hw, u32 changed) |
2062 | { | 2062 | { |
2063 | struct il_priv *priv = hw->priv; | 2063 | struct il_priv *il = hw->priv; |
2064 | const struct il_channel_info *ch_info; | 2064 | const struct il_channel_info *ch_info; |
2065 | struct ieee80211_conf *conf = &hw->conf; | 2065 | struct ieee80211_conf *conf = &hw->conf; |
2066 | struct ieee80211_channel *channel = conf->channel; | 2066 | struct ieee80211_channel *channel = conf->channel; |
2067 | struct il_ht_config *ht_conf = &priv->current_ht_config; | 2067 | struct il_ht_config *ht_conf = &il->current_ht_config; |
2068 | struct il_rxon_context *ctx; | 2068 | struct il_rxon_context *ctx; |
2069 | unsigned long flags = 0; | 2069 | unsigned long flags = 0; |
2070 | int ret = 0; | 2070 | int ret = 0; |
@@ -2072,23 +2072,23 @@ int il_mac_config(struct ieee80211_hw *hw, u32 changed) | |||
2072 | int scan_active = 0; | 2072 | int scan_active = 0; |
2073 | bool ht_changed[NUM_IL_RXON_CTX] = {}; | 2073 | bool ht_changed[NUM_IL_RXON_CTX] = {}; |
2074 | 2074 | ||
2075 | if (WARN_ON(!priv->cfg->ops->legacy)) | 2075 | if (WARN_ON(!il->cfg->ops->legacy)) |
2076 | return -EOPNOTSUPP; | 2076 | return -EOPNOTSUPP; |
2077 | 2077 | ||
2078 | mutex_lock(&priv->mutex); | 2078 | mutex_lock(&il->mutex); |
2079 | 2079 | ||
2080 | IL_DEBUG_MAC80211(priv, "enter to channel %d changed 0x%X\n", | 2080 | IL_DEBUG_MAC80211(il, "enter to channel %d changed 0x%X\n", |
2081 | channel->hw_value, changed); | 2081 | channel->hw_value, changed); |
2082 | 2082 | ||
2083 | if (unlikely(test_bit(STATUS_SCANNING, &priv->status))) { | 2083 | if (unlikely(test_bit(STATUS_SCANNING, &il->status))) { |
2084 | scan_active = 1; | 2084 | scan_active = 1; |
2085 | IL_DEBUG_MAC80211(priv, "scan active\n"); | 2085 | IL_DEBUG_MAC80211(il, "scan active\n"); |
2086 | } | 2086 | } |
2087 | 2087 | ||
2088 | if (changed & (IEEE80211_CONF_CHANGE_SMPS | | 2088 | if (changed & (IEEE80211_CONF_CHANGE_SMPS | |
2089 | IEEE80211_CONF_CHANGE_CHANNEL)) { | 2089 | IEEE80211_CONF_CHANGE_CHANNEL)) { |
2090 | /* mac80211 uses static for non-HT which is what we want */ | 2090 | /* mac80211 uses static for non-HT which is what we want */ |
2091 | priv->current_ht_config.smps = conf->smps_mode; | 2091 | il->current_ht_config.smps = conf->smps_mode; |
2092 | 2092 | ||
2093 | /* | 2093 | /* |
2094 | * Recalculate chain counts. | 2094 | * Recalculate chain counts. |
@@ -2097,9 +2097,9 @@ int il_mac_config(struct ieee80211_hw *hw, u32 changed) | |||
2097 | * set up the SM PS mode to OFF if an HT channel is | 2097 | * set up the SM PS mode to OFF if an HT channel is |
2098 | * configured. | 2098 | * configured. |
2099 | */ | 2099 | */ |
2100 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 2100 | if (il->cfg->ops->hcmd->set_rxon_chain) |
2101 | for_each_context(priv, ctx) | 2101 | for_each_context(il, ctx) |
2102 | priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); | 2102 | il->cfg->ops->hcmd->set_rxon_chain(il, ctx); |
2103 | } | 2103 | } |
2104 | 2104 | ||
2105 | /* during scanning mac80211 will delay channel setting until | 2105 | /* during scanning mac80211 will delay channel setting until |
@@ -2110,23 +2110,23 @@ int il_mac_config(struct ieee80211_hw *hw, u32 changed) | |||
2110 | goto set_ch_out; | 2110 | goto set_ch_out; |
2111 | 2111 | ||
2112 | ch = channel->hw_value; | 2112 | ch = channel->hw_value; |
2113 | ch_info = il_get_channel_info(priv, channel->band, ch); | 2113 | ch_info = il_get_channel_info(il, channel->band, ch); |
2114 | if (!il_is_channel_valid(ch_info)) { | 2114 | if (!il_is_channel_valid(ch_info)) { |
2115 | IL_DEBUG_MAC80211(priv, "leave - invalid channel\n"); | 2115 | IL_DEBUG_MAC80211(il, "leave - invalid channel\n"); |
2116 | ret = -EINVAL; | 2116 | ret = -EINVAL; |
2117 | goto set_ch_out; | 2117 | goto set_ch_out; |
2118 | } | 2118 | } |
2119 | 2119 | ||
2120 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC && | 2120 | if (il->iw_mode == NL80211_IFTYPE_ADHOC && |
2121 | !il_is_channel_ibss(ch_info)) { | 2121 | !il_is_channel_ibss(ch_info)) { |
2122 | IL_DEBUG_MAC80211(priv, "leave - not IBSS channel\n"); | 2122 | IL_DEBUG_MAC80211(il, "leave - not IBSS channel\n"); |
2123 | ret = -EINVAL; | 2123 | ret = -EINVAL; |
2124 | goto set_ch_out; | 2124 | goto set_ch_out; |
2125 | } | 2125 | } |
2126 | 2126 | ||
2127 | spin_lock_irqsave(&priv->lock, flags); | 2127 | spin_lock_irqsave(&il->lock, flags); |
2128 | 2128 | ||
2129 | for_each_context(priv, ctx) { | 2129 | for_each_context(il, ctx) { |
2130 | /* Configure HT40 channels */ | 2130 | /* Configure HT40 channels */ |
2131 | if (ctx->ht.enabled != conf_is_ht(conf)) { | 2131 | if (ctx->ht.enabled != conf_is_ht(conf)) { |
2132 | ctx->ht.enabled = conf_is_ht(conf); | 2132 | ctx->ht.enabled = conf_is_ht(conf); |
@@ -2162,61 +2162,61 @@ int il_mac_config(struct ieee80211_hw *hw, u32 changed) | |||
2162 | if ((le16_to_cpu(ctx->staging.channel) != ch)) | 2162 | if ((le16_to_cpu(ctx->staging.channel) != ch)) |
2163 | ctx->staging.flags = 0; | 2163 | ctx->staging.flags = 0; |
2164 | 2164 | ||
2165 | il_set_rxon_channel(priv, channel, ctx); | 2165 | il_set_rxon_channel(il, channel, ctx); |
2166 | il_set_rxon_ht(priv, ht_conf); | 2166 | il_set_rxon_ht(il, ht_conf); |
2167 | 2167 | ||
2168 | il_set_flags_for_band(priv, ctx, channel->band, | 2168 | il_set_flags_for_band(il, ctx, channel->band, |
2169 | ctx->vif); | 2169 | ctx->vif); |
2170 | } | 2170 | } |
2171 | 2171 | ||
2172 | spin_unlock_irqrestore(&priv->lock, flags); | 2172 | spin_unlock_irqrestore(&il->lock, flags); |
2173 | 2173 | ||
2174 | if (priv->cfg->ops->legacy->update_bcast_stations) | 2174 | if (il->cfg->ops->legacy->update_bcast_stations) |
2175 | ret = | 2175 | ret = |
2176 | priv->cfg->ops->legacy->update_bcast_stations(priv); | 2176 | il->cfg->ops->legacy->update_bcast_stations(il); |
2177 | 2177 | ||
2178 | set_ch_out: | 2178 | set_ch_out: |
2179 | /* The list of supported rates and rate mask can be different | 2179 | /* The list of supported rates and rate mask can be different |
2180 | * for each band; since the band may have changed, reset | 2180 | * for each band; since the band may have changed, reset |
2181 | * the rate mask to what mac80211 lists */ | 2181 | * the rate mask to what mac80211 lists */ |
2182 | il_set_rate(priv); | 2182 | il_set_rate(il); |
2183 | } | 2183 | } |
2184 | 2184 | ||
2185 | if (changed & (IEEE80211_CONF_CHANGE_PS | | 2185 | if (changed & (IEEE80211_CONF_CHANGE_PS | |
2186 | IEEE80211_CONF_CHANGE_IDLE)) { | 2186 | IEEE80211_CONF_CHANGE_IDLE)) { |
2187 | ret = il_power_update_mode(priv, false); | 2187 | ret = il_power_update_mode(il, false); |
2188 | if (ret) | 2188 | if (ret) |
2189 | IL_DEBUG_MAC80211(priv, "Error setting sleep level\n"); | 2189 | IL_DEBUG_MAC80211(il, "Error setting sleep level\n"); |
2190 | } | 2190 | } |
2191 | 2191 | ||
2192 | if (changed & IEEE80211_CONF_CHANGE_POWER) { | 2192 | if (changed & IEEE80211_CONF_CHANGE_POWER) { |
2193 | IL_DEBUG_MAC80211(priv, "TX Power old=%d new=%d\n", | 2193 | IL_DEBUG_MAC80211(il, "TX Power old=%d new=%d\n", |
2194 | priv->tx_power_user_lmt, conf->power_level); | 2194 | il->tx_power_user_lmt, conf->power_level); |
2195 | 2195 | ||
2196 | il_set_tx_power(priv, conf->power_level, false); | 2196 | il_set_tx_power(il, conf->power_level, false); |
2197 | } | 2197 | } |
2198 | 2198 | ||
2199 | if (!il_is_ready(priv)) { | 2199 | if (!il_is_ready(il)) { |
2200 | IL_DEBUG_MAC80211(priv, "leave - not ready\n"); | 2200 | IL_DEBUG_MAC80211(il, "leave - not ready\n"); |
2201 | goto out; | 2201 | goto out; |
2202 | } | 2202 | } |
2203 | 2203 | ||
2204 | if (scan_active) | 2204 | if (scan_active) |
2205 | goto out; | 2205 | goto out; |
2206 | 2206 | ||
2207 | for_each_context(priv, ctx) { | 2207 | for_each_context(il, ctx) { |
2208 | if (memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging))) | 2208 | if (memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging))) |
2209 | il_commit_rxon(priv, ctx); | 2209 | il_commit_rxon(il, ctx); |
2210 | else | 2210 | else |
2211 | IL_DEBUG_INFO(priv, | 2211 | IL_DEBUG_INFO(il, |
2212 | "Not re-sending same RXON configuration.\n"); | 2212 | "Not re-sending same RXON configuration.\n"); |
2213 | if (ht_changed[ctx->ctxid]) | 2213 | if (ht_changed[ctx->ctxid]) |
2214 | il_update_qos(priv, ctx); | 2214 | il_update_qos(il, ctx); |
2215 | } | 2215 | } |
2216 | 2216 | ||
2217 | out: | 2217 | out: |
2218 | IL_DEBUG_MAC80211(priv, "leave\n"); | 2218 | IL_DEBUG_MAC80211(il, "leave\n"); |
2219 | mutex_unlock(&priv->mutex); | 2219 | mutex_unlock(&il->mutex); |
2220 | return ret; | 2220 | return ret; |
2221 | } | 2221 | } |
2222 | EXPORT_SYMBOL(il_mac_config); | 2222 | EXPORT_SYMBOL(il_mac_config); |
@@ -2224,37 +2224,37 @@ EXPORT_SYMBOL(il_mac_config); | |||
2224 | void il_mac_reset_tsf(struct ieee80211_hw *hw, | 2224 | void il_mac_reset_tsf(struct ieee80211_hw *hw, |
2225 | struct ieee80211_vif *vif) | 2225 | struct ieee80211_vif *vif) |
2226 | { | 2226 | { |
2227 | struct il_priv *priv = hw->priv; | 2227 | struct il_priv *il = hw->priv; |
2228 | unsigned long flags; | 2228 | unsigned long flags; |
2229 | /* IBSS can only be the IL_RXON_CTX_BSS context */ | 2229 | /* IBSS can only be the IL_RXON_CTX_BSS context */ |
2230 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 2230 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
2231 | 2231 | ||
2232 | if (WARN_ON(!priv->cfg->ops->legacy)) | 2232 | if (WARN_ON(!il->cfg->ops->legacy)) |
2233 | return; | 2233 | return; |
2234 | 2234 | ||
2235 | mutex_lock(&priv->mutex); | 2235 | mutex_lock(&il->mutex); |
2236 | IL_DEBUG_MAC80211(priv, "enter\n"); | 2236 | IL_DEBUG_MAC80211(il, "enter\n"); |
2237 | 2237 | ||
2238 | spin_lock_irqsave(&priv->lock, flags); | 2238 | spin_lock_irqsave(&il->lock, flags); |
2239 | memset(&priv->current_ht_config, 0, sizeof(struct il_ht_config)); | 2239 | memset(&il->current_ht_config, 0, sizeof(struct il_ht_config)); |
2240 | spin_unlock_irqrestore(&priv->lock, flags); | 2240 | spin_unlock_irqrestore(&il->lock, flags); |
2241 | 2241 | ||
2242 | spin_lock_irqsave(&priv->lock, flags); | 2242 | spin_lock_irqsave(&il->lock, flags); |
2243 | 2243 | ||
2244 | /* new association get rid of ibss beacon skb */ | 2244 | /* new association get rid of ibss beacon skb */ |
2245 | if (priv->beacon_skb) | 2245 | if (il->beacon_skb) |
2246 | dev_kfree_skb(priv->beacon_skb); | 2246 | dev_kfree_skb(il->beacon_skb); |
2247 | 2247 | ||
2248 | priv->beacon_skb = NULL; | 2248 | il->beacon_skb = NULL; |
2249 | 2249 | ||
2250 | priv->timestamp = 0; | 2250 | il->timestamp = 0; |
2251 | 2251 | ||
2252 | spin_unlock_irqrestore(&priv->lock, flags); | 2252 | spin_unlock_irqrestore(&il->lock, flags); |
2253 | 2253 | ||
2254 | il_scan_cancel_timeout(priv, 100); | 2254 | il_scan_cancel_timeout(il, 100); |
2255 | if (!il_is_ready_rf(priv)) { | 2255 | if (!il_is_ready_rf(il)) { |
2256 | IL_DEBUG_MAC80211(priv, "leave - not ready\n"); | 2256 | IL_DEBUG_MAC80211(il, "leave - not ready\n"); |
2257 | mutex_unlock(&priv->mutex); | 2257 | mutex_unlock(&il->mutex); |
2258 | return; | 2258 | return; |
2259 | } | 2259 | } |
2260 | 2260 | ||
@@ -2262,25 +2262,25 @@ void il_mac_reset_tsf(struct ieee80211_hw *hw, | |||
2262 | * clear RXON_FILTER_ASSOC_MSK bit | 2262 | * clear RXON_FILTER_ASSOC_MSK bit |
2263 | */ | 2263 | */ |
2264 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 2264 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
2265 | il_commit_rxon(priv, ctx); | 2265 | il_commit_rxon(il, ctx); |
2266 | 2266 | ||
2267 | il_set_rate(priv); | 2267 | il_set_rate(il); |
2268 | 2268 | ||
2269 | mutex_unlock(&priv->mutex); | 2269 | mutex_unlock(&il->mutex); |
2270 | 2270 | ||
2271 | IL_DEBUG_MAC80211(priv, "leave\n"); | 2271 | IL_DEBUG_MAC80211(il, "leave\n"); |
2272 | } | 2272 | } |
2273 | EXPORT_SYMBOL(il_mac_reset_tsf); | 2273 | EXPORT_SYMBOL(il_mac_reset_tsf); |
2274 | 2274 | ||
2275 | static void il_ht_conf(struct il_priv *priv, | 2275 | static void il_ht_conf(struct il_priv *il, |
2276 | struct ieee80211_vif *vif) | 2276 | struct ieee80211_vif *vif) |
2277 | { | 2277 | { |
2278 | struct il_ht_config *ht_conf = &priv->current_ht_config; | 2278 | struct il_ht_config *ht_conf = &il->current_ht_config; |
2279 | struct ieee80211_sta *sta; | 2279 | struct ieee80211_sta *sta; |
2280 | struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; | 2280 | struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; |
2281 | struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); | 2281 | struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); |
2282 | 2282 | ||
2283 | IL_DEBUG_ASSOC(priv, "enter:\n"); | 2283 | IL_DEBUG_ASSOC(il, "enter:\n"); |
2284 | 2284 | ||
2285 | if (!ctx->ht.enabled) | 2285 | if (!ctx->ht.enabled) |
2286 | return; | 2286 | return; |
@@ -2329,10 +2329,10 @@ static void il_ht_conf(struct il_priv *priv, | |||
2329 | break; | 2329 | break; |
2330 | } | 2330 | } |
2331 | 2331 | ||
2332 | IL_DEBUG_ASSOC(priv, "leave\n"); | 2332 | IL_DEBUG_ASSOC(il, "leave\n"); |
2333 | } | 2333 | } |
2334 | 2334 | ||
2335 | static inline void il_set_no_assoc(struct il_priv *priv, | 2335 | static inline void il_set_no_assoc(struct il_priv *il, |
2336 | struct ieee80211_vif *vif) | 2336 | struct ieee80211_vif *vif) |
2337 | { | 2337 | { |
2338 | struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); | 2338 | 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, | |||
2344 | */ | 2344 | */ |
2345 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 2345 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
2346 | ctx->staging.assoc_id = 0; | 2346 | ctx->staging.assoc_id = 0; |
2347 | il_commit_rxon(priv, ctx); | 2347 | il_commit_rxon(il, ctx); |
2348 | } | 2348 | } |
2349 | 2349 | ||
2350 | static void il_beacon_update(struct ieee80211_hw *hw, | 2350 | static void il_beacon_update(struct ieee80211_hw *hw, |
2351 | struct ieee80211_vif *vif) | 2351 | struct ieee80211_vif *vif) |
2352 | { | 2352 | { |
2353 | struct il_priv *priv = hw->priv; | 2353 | struct il_priv *il = hw->priv; |
2354 | unsigned long flags; | 2354 | unsigned long flags; |
2355 | __le64 timestamp; | 2355 | __le64 timestamp; |
2356 | struct sk_buff *skb = ieee80211_beacon_get(hw, vif); | 2356 | struct sk_buff *skb = ieee80211_beacon_get(hw, vif); |
@@ -2358,35 +2358,35 @@ static void il_beacon_update(struct ieee80211_hw *hw, | |||
2358 | if (!skb) | 2358 | if (!skb) |
2359 | return; | 2359 | return; |
2360 | 2360 | ||
2361 | IL_DEBUG_MAC80211(priv, "enter\n"); | 2361 | IL_DEBUG_MAC80211(il, "enter\n"); |
2362 | 2362 | ||
2363 | lockdep_assert_held(&priv->mutex); | 2363 | lockdep_assert_held(&il->mutex); |
2364 | 2364 | ||
2365 | if (!priv->beacon_ctx) { | 2365 | if (!il->beacon_ctx) { |
2366 | IL_ERR(priv, "update beacon but no beacon context!\n"); | 2366 | IL_ERR(il, "update beacon but no beacon context!\n"); |
2367 | dev_kfree_skb(skb); | 2367 | dev_kfree_skb(skb); |
2368 | return; | 2368 | return; |
2369 | } | 2369 | } |
2370 | 2370 | ||
2371 | spin_lock_irqsave(&priv->lock, flags); | 2371 | spin_lock_irqsave(&il->lock, flags); |
2372 | 2372 | ||
2373 | if (priv->beacon_skb) | 2373 | if (il->beacon_skb) |
2374 | dev_kfree_skb(priv->beacon_skb); | 2374 | dev_kfree_skb(il->beacon_skb); |
2375 | 2375 | ||
2376 | priv->beacon_skb = skb; | 2376 | il->beacon_skb = skb; |
2377 | 2377 | ||
2378 | timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp; | 2378 | timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp; |
2379 | priv->timestamp = le64_to_cpu(timestamp); | 2379 | il->timestamp = le64_to_cpu(timestamp); |
2380 | 2380 | ||
2381 | IL_DEBUG_MAC80211(priv, "leave\n"); | 2381 | IL_DEBUG_MAC80211(il, "leave\n"); |
2382 | spin_unlock_irqrestore(&priv->lock, flags); | 2382 | spin_unlock_irqrestore(&il->lock, flags); |
2383 | 2383 | ||
2384 | if (!il_is_ready_rf(priv)) { | 2384 | if (!il_is_ready_rf(il)) { |
2385 | IL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); | 2385 | IL_DEBUG_MAC80211(il, "leave - RF not ready\n"); |
2386 | return; | 2386 | return; |
2387 | } | 2387 | } |
2388 | 2388 | ||
2389 | priv->cfg->ops->legacy->post_associate(priv); | 2389 | il->cfg->ops->legacy->post_associate(il); |
2390 | } | 2390 | } |
2391 | 2391 | ||
2392 | void il_mac_bss_info_changed(struct ieee80211_hw *hw, | 2392 | void il_mac_bss_info_changed(struct ieee80211_hw *hw, |
@@ -2394,29 +2394,29 @@ void il_mac_bss_info_changed(struct ieee80211_hw *hw, | |||
2394 | struct ieee80211_bss_conf *bss_conf, | 2394 | struct ieee80211_bss_conf *bss_conf, |
2395 | u32 changes) | 2395 | u32 changes) |
2396 | { | 2396 | { |
2397 | struct il_priv *priv = hw->priv; | 2397 | struct il_priv *il = hw->priv; |
2398 | struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); | 2398 | struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); |
2399 | int ret; | 2399 | int ret; |
2400 | 2400 | ||
2401 | if (WARN_ON(!priv->cfg->ops->legacy)) | 2401 | if (WARN_ON(!il->cfg->ops->legacy)) |
2402 | return; | 2402 | return; |
2403 | 2403 | ||
2404 | IL_DEBUG_MAC80211(priv, "changes = 0x%X\n", changes); | 2404 | IL_DEBUG_MAC80211(il, "changes = 0x%X\n", changes); |
2405 | 2405 | ||
2406 | mutex_lock(&priv->mutex); | 2406 | mutex_lock(&il->mutex); |
2407 | 2407 | ||
2408 | if (!il_is_alive(priv)) { | 2408 | if (!il_is_alive(il)) { |
2409 | mutex_unlock(&priv->mutex); | 2409 | mutex_unlock(&il->mutex); |
2410 | return; | 2410 | return; |
2411 | } | 2411 | } |
2412 | 2412 | ||
2413 | if (changes & BSS_CHANGED_QOS) { | 2413 | if (changes & BSS_CHANGED_QOS) { |
2414 | unsigned long flags; | 2414 | unsigned long flags; |
2415 | 2415 | ||
2416 | spin_lock_irqsave(&priv->lock, flags); | 2416 | spin_lock_irqsave(&il->lock, flags); |
2417 | ctx->qos_data.qos_active = bss_conf->qos; | 2417 | ctx->qos_data.qos_active = bss_conf->qos; |
2418 | il_update_qos(priv, ctx); | 2418 | il_update_qos(il, ctx); |
2419 | spin_unlock_irqrestore(&priv->lock, flags); | 2419 | spin_unlock_irqrestore(&il->lock, flags); |
2420 | } | 2420 | } |
2421 | 2421 | ||
2422 | if (changes & BSS_CHANGED_BEACON_ENABLED) { | 2422 | if (changes & BSS_CHANGED_BEACON_ENABLED) { |
@@ -2426,25 +2426,25 @@ void il_mac_bss_info_changed(struct ieee80211_hw *hw, | |||
2426 | * any time. | 2426 | * any time. |
2427 | */ | 2427 | */ |
2428 | if (vif->bss_conf.enable_beacon) | 2428 | if (vif->bss_conf.enable_beacon) |
2429 | priv->beacon_ctx = ctx; | 2429 | il->beacon_ctx = ctx; |
2430 | else | 2430 | else |
2431 | priv->beacon_ctx = NULL; | 2431 | il->beacon_ctx = NULL; |
2432 | } | 2432 | } |
2433 | 2433 | ||
2434 | if (changes & BSS_CHANGED_BSSID) { | 2434 | if (changes & BSS_CHANGED_BSSID) { |
2435 | IL_DEBUG_MAC80211(priv, "BSSID %pM\n", bss_conf->bssid); | 2435 | IL_DEBUG_MAC80211(il, "BSSID %pM\n", bss_conf->bssid); |
2436 | 2436 | ||
2437 | /* | 2437 | /* |
2438 | * If there is currently a HW scan going on in the | 2438 | * If there is currently a HW scan going on in the |
2439 | * background then we need to cancel it else the RXON | 2439 | * background then we need to cancel it else the RXON |
2440 | * below/in post_associate will fail. | 2440 | * below/in post_associate will fail. |
2441 | */ | 2441 | */ |
2442 | if (il_scan_cancel_timeout(priv, 100)) { | 2442 | if (il_scan_cancel_timeout(il, 100)) { |
2443 | IL_WARN(priv, | 2443 | IL_WARN(il, |
2444 | "Aborted scan still in progress after 100ms\n"); | 2444 | "Aborted scan still in progress after 100ms\n"); |
2445 | IL_DEBUG_MAC80211(priv, | 2445 | IL_DEBUG_MAC80211(il, |
2446 | "leaving - scan abort failed.\n"); | 2446 | "leaving - scan abort failed.\n"); |
2447 | mutex_unlock(&priv->mutex); | 2447 | mutex_unlock(&il->mutex); |
2448 | return; | 2448 | return; |
2449 | } | 2449 | } |
2450 | 2450 | ||
@@ -2454,7 +2454,7 @@ void il_mac_bss_info_changed(struct ieee80211_hw *hw, | |||
2454 | bss_conf->bssid, ETH_ALEN); | 2454 | bss_conf->bssid, ETH_ALEN); |
2455 | 2455 | ||
2456 | /* currently needed in a few places */ | 2456 | /* currently needed in a few places */ |
2457 | memcpy(priv->bssid, bss_conf->bssid, ETH_ALEN); | 2457 | memcpy(il->bssid, bss_conf->bssid, ETH_ALEN); |
2458 | } else { | 2458 | } else { |
2459 | ctx->staging.filter_flags &= | 2459 | ctx->staging.filter_flags &= |
2460 | ~RXON_FILTER_ASSOC_MSK; | 2460 | ~RXON_FILTER_ASSOC_MSK; |
@@ -2471,7 +2471,7 @@ void il_mac_bss_info_changed(struct ieee80211_hw *hw, | |||
2471 | il_beacon_update(hw, vif); | 2471 | il_beacon_update(hw, vif); |
2472 | 2472 | ||
2473 | if (changes & BSS_CHANGED_ERP_PREAMBLE) { | 2473 | if (changes & BSS_CHANGED_ERP_PREAMBLE) { |
2474 | IL_DEBUG_MAC80211(priv, "ERP_PREAMBLE %d\n", | 2474 | IL_DEBUG_MAC80211(il, "ERP_PREAMBLE %d\n", |
2475 | bss_conf->use_short_preamble); | 2475 | bss_conf->use_short_preamble); |
2476 | if (bss_conf->use_short_preamble) | 2476 | if (bss_conf->use_short_preamble) |
2477 | ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; | 2477 | ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; |
@@ -2480,10 +2480,10 @@ void il_mac_bss_info_changed(struct ieee80211_hw *hw, | |||
2480 | } | 2480 | } |
2481 | 2481 | ||
2482 | if (changes & BSS_CHANGED_ERP_CTS_PROT) { | 2482 | if (changes & BSS_CHANGED_ERP_CTS_PROT) { |
2483 | IL_DEBUG_MAC80211(priv, | 2483 | IL_DEBUG_MAC80211(il, |
2484 | "ERP_CTS %d\n", bss_conf->use_cts_prot); | 2484 | "ERP_CTS %d\n", bss_conf->use_cts_prot); |
2485 | if (bss_conf->use_cts_prot && | 2485 | if (bss_conf->use_cts_prot && |
2486 | (priv->band != IEEE80211_BAND_5GHZ)) | 2486 | (il->band != IEEE80211_BAND_5GHZ)) |
2487 | ctx->staging.flags |= RXON_FLG_TGG_PROTECT_MSK; | 2487 | ctx->staging.flags |= RXON_FLG_TGG_PROTECT_MSK; |
2488 | else | 2488 | else |
2489 | ctx->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK; | 2489 | ctx->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK; |
@@ -2511,27 +2511,27 @@ void il_mac_bss_info_changed(struct ieee80211_hw *hw, | |||
2511 | } | 2511 | } |
2512 | 2512 | ||
2513 | if (changes & BSS_CHANGED_HT) { | 2513 | if (changes & BSS_CHANGED_HT) { |
2514 | il_ht_conf(priv, vif); | 2514 | il_ht_conf(il, vif); |
2515 | 2515 | ||
2516 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 2516 | if (il->cfg->ops->hcmd->set_rxon_chain) |
2517 | priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); | 2517 | il->cfg->ops->hcmd->set_rxon_chain(il, ctx); |
2518 | } | 2518 | } |
2519 | 2519 | ||
2520 | if (changes & BSS_CHANGED_ASSOC) { | 2520 | if (changes & BSS_CHANGED_ASSOC) { |
2521 | IL_DEBUG_MAC80211(priv, "ASSOC %d\n", bss_conf->assoc); | 2521 | IL_DEBUG_MAC80211(il, "ASSOC %d\n", bss_conf->assoc); |
2522 | if (bss_conf->assoc) { | 2522 | if (bss_conf->assoc) { |
2523 | priv->timestamp = bss_conf->timestamp; | 2523 | il->timestamp = bss_conf->timestamp; |
2524 | 2524 | ||
2525 | if (!il_is_rfkill(priv)) | 2525 | if (!il_is_rfkill(il)) |
2526 | priv->cfg->ops->legacy->post_associate(priv); | 2526 | il->cfg->ops->legacy->post_associate(il); |
2527 | } else | 2527 | } else |
2528 | il_set_no_assoc(priv, vif); | 2528 | il_set_no_assoc(il, vif); |
2529 | } | 2529 | } |
2530 | 2530 | ||
2531 | if (changes && il_is_associated_ctx(ctx) && bss_conf->aid) { | 2531 | if (changes && il_is_associated_ctx(ctx) && bss_conf->aid) { |
2532 | IL_DEBUG_MAC80211(priv, "Changes (%#x) while associated\n", | 2532 | IL_DEBUG_MAC80211(il, "Changes (%#x) while associated\n", |
2533 | changes); | 2533 | changes); |
2534 | ret = il_send_rxon_assoc(priv, ctx); | 2534 | ret = il_send_rxon_assoc(il, ctx); |
2535 | if (!ret) { | 2535 | if (!ret) { |
2536 | /* Sync active_rxon with latest change. */ | 2536 | /* Sync active_rxon with latest change. */ |
2537 | memcpy((void *)&ctx->active, | 2537 | memcpy((void *)&ctx->active, |
@@ -2544,54 +2544,54 @@ void il_mac_bss_info_changed(struct ieee80211_hw *hw, | |||
2544 | if (vif->bss_conf.enable_beacon) { | 2544 | if (vif->bss_conf.enable_beacon) { |
2545 | memcpy(ctx->staging.bssid_addr, | 2545 | memcpy(ctx->staging.bssid_addr, |
2546 | bss_conf->bssid, ETH_ALEN); | 2546 | bss_conf->bssid, ETH_ALEN); |
2547 | memcpy(priv->bssid, bss_conf->bssid, ETH_ALEN); | 2547 | memcpy(il->bssid, bss_conf->bssid, ETH_ALEN); |
2548 | priv->cfg->ops->legacy->config_ap(priv); | 2548 | il->cfg->ops->legacy->config_ap(il); |
2549 | } else | 2549 | } else |
2550 | il_set_no_assoc(priv, vif); | 2550 | il_set_no_assoc(il, vif); |
2551 | } | 2551 | } |
2552 | 2552 | ||
2553 | if (changes & BSS_CHANGED_IBSS) { | 2553 | if (changes & BSS_CHANGED_IBSS) { |
2554 | ret = priv->cfg->ops->legacy->manage_ibss_station(priv, vif, | 2554 | ret = il->cfg->ops->legacy->manage_ibss_station(il, vif, |
2555 | bss_conf->ibss_joined); | 2555 | bss_conf->ibss_joined); |
2556 | if (ret) | 2556 | if (ret) |
2557 | IL_ERR(priv, "failed to %s IBSS station %pM\n", | 2557 | IL_ERR(il, "failed to %s IBSS station %pM\n", |
2558 | bss_conf->ibss_joined ? "add" : "remove", | 2558 | bss_conf->ibss_joined ? "add" : "remove", |
2559 | bss_conf->bssid); | 2559 | bss_conf->bssid); |
2560 | } | 2560 | } |
2561 | 2561 | ||
2562 | mutex_unlock(&priv->mutex); | 2562 | mutex_unlock(&il->mutex); |
2563 | 2563 | ||
2564 | IL_DEBUG_MAC80211(priv, "leave\n"); | 2564 | IL_DEBUG_MAC80211(il, "leave\n"); |
2565 | } | 2565 | } |
2566 | EXPORT_SYMBOL(il_mac_bss_info_changed); | 2566 | EXPORT_SYMBOL(il_mac_bss_info_changed); |
2567 | 2567 | ||
2568 | irqreturn_t il_isr(int irq, void *data) | 2568 | irqreturn_t il_isr(int irq, void *data) |
2569 | { | 2569 | { |
2570 | struct il_priv *priv = data; | 2570 | struct il_priv *il = data; |
2571 | u32 inta, inta_mask; | 2571 | u32 inta, inta_mask; |
2572 | u32 inta_fh; | 2572 | u32 inta_fh; |
2573 | unsigned long flags; | 2573 | unsigned long flags; |
2574 | if (!priv) | 2574 | if (!il) |
2575 | return IRQ_NONE; | 2575 | return IRQ_NONE; |
2576 | 2576 | ||
2577 | spin_lock_irqsave(&priv->lock, flags); | 2577 | spin_lock_irqsave(&il->lock, flags); |
2578 | 2578 | ||
2579 | /* Disable (but don't clear!) interrupts here to avoid | 2579 | /* Disable (but don't clear!) interrupts here to avoid |
2580 | * back-to-back ISRs and sporadic interrupts from our NIC. | 2580 | * back-to-back ISRs and sporadic interrupts from our NIC. |
2581 | * If we have something to service, the tasklet will re-enable ints. | 2581 | * If we have something to service, the tasklet will re-enable ints. |
2582 | * If we *don't* have something, we'll re-enable before leaving here. */ | 2582 | * If we *don't* have something, we'll re-enable before leaving here. */ |
2583 | inta_mask = il_read32(priv, CSR_INT_MASK); /* just for debug */ | 2583 | inta_mask = il_read32(il, CSR_INT_MASK); /* just for debug */ |
2584 | il_write32(priv, CSR_INT_MASK, 0x00000000); | 2584 | il_write32(il, CSR_INT_MASK, 0x00000000); |
2585 | 2585 | ||
2586 | /* Discover which interrupts are active/pending */ | 2586 | /* Discover which interrupts are active/pending */ |
2587 | inta = il_read32(priv, CSR_INT); | 2587 | inta = il_read32(il, CSR_INT); |
2588 | inta_fh = il_read32(priv, CSR_FH_INT_STATUS); | 2588 | inta_fh = il_read32(il, CSR_FH_INT_STATUS); |
2589 | 2589 | ||
2590 | /* Ignore interrupt if there's nothing in NIC to service. | 2590 | /* Ignore interrupt if there's nothing in NIC to service. |
2591 | * This may be due to IRQ shared with another device, | 2591 | * This may be due to IRQ shared with another device, |
2592 | * or due to sporadic interrupts thrown from our NIC. */ | 2592 | * or due to sporadic interrupts thrown from our NIC. */ |
2593 | if (!inta && !inta_fh) { | 2593 | if (!inta && !inta_fh) { |
2594 | IL_DEBUG_ISR(priv, | 2594 | IL_DEBUG_ISR(il, |
2595 | "Ignore interrupt, inta == 0, inta_fh == 0\n"); | 2595 | "Ignore interrupt, inta == 0, inta_fh == 0\n"); |
2596 | goto none; | 2596 | goto none; |
2597 | } | 2597 | } |
@@ -2599,29 +2599,29 @@ irqreturn_t il_isr(int irq, void *data) | |||
2599 | if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) { | 2599 | if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) { |
2600 | /* Hardware disappeared. It might have already raised | 2600 | /* Hardware disappeared. It might have already raised |
2601 | * an interrupt */ | 2601 | * an interrupt */ |
2602 | IL_WARN(priv, "HARDWARE GONE?? INTA == 0x%08x\n", inta); | 2602 | IL_WARN(il, "HARDWARE GONE?? INTA == 0x%08x\n", inta); |
2603 | goto unplugged; | 2603 | goto unplugged; |
2604 | } | 2604 | } |
2605 | 2605 | ||
2606 | IL_DEBUG_ISR(priv, "ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", | 2606 | IL_DEBUG_ISR(il, "ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", |
2607 | inta, inta_mask, inta_fh); | 2607 | inta, inta_mask, inta_fh); |
2608 | 2608 | ||
2609 | inta &= ~CSR_INT_BIT_SCD; | 2609 | inta &= ~CSR_INT_BIT_SCD; |
2610 | 2610 | ||
2611 | /* il_irq_tasklet() will service interrupts and re-enable them */ | 2611 | /* il_irq_tasklet() will service interrupts and re-enable them */ |
2612 | if (likely(inta || inta_fh)) | 2612 | if (likely(inta || inta_fh)) |
2613 | tasklet_schedule(&priv->irq_tasklet); | 2613 | tasklet_schedule(&il->irq_tasklet); |
2614 | 2614 | ||
2615 | unplugged: | 2615 | unplugged: |
2616 | spin_unlock_irqrestore(&priv->lock, flags); | 2616 | spin_unlock_irqrestore(&il->lock, flags); |
2617 | return IRQ_HANDLED; | 2617 | return IRQ_HANDLED; |
2618 | 2618 | ||
2619 | none: | 2619 | none: |
2620 | /* re-enable interrupts here since we don't have anything to service. */ | 2620 | /* re-enable interrupts here since we don't have anything to service. */ |
2621 | /* only Re-enable if disabled by irq */ | 2621 | /* only Re-enable if disabled by irq */ |
2622 | if (test_bit(STATUS_INT_ENABLED, &priv->status)) | 2622 | if (test_bit(STATUS_INT_ENABLED, &il->status)) |
2623 | il_enable_interrupts(priv); | 2623 | il_enable_interrupts(il); |
2624 | spin_unlock_irqrestore(&priv->lock, flags); | 2624 | spin_unlock_irqrestore(&il->lock, flags); |
2625 | return IRQ_NONE; | 2625 | return IRQ_NONE; |
2626 | } | 2626 | } |
2627 | EXPORT_SYMBOL(il_isr); | 2627 | EXPORT_SYMBOL(il_isr); |
@@ -2630,7 +2630,7 @@ EXPORT_SYMBOL(il_isr); | |||
2630 | * il_tx_cmd_protection: Set rts/cts. 3945 and 4965 only share this | 2630 | * il_tx_cmd_protection: Set rts/cts. 3945 and 4965 only share this |
2631 | * function. | 2631 | * function. |
2632 | */ | 2632 | */ |
2633 | void il_tx_cmd_protection(struct il_priv *priv, | 2633 | void il_tx_cmd_protection(struct il_priv *il, |
2634 | struct ieee80211_tx_info *info, | 2634 | struct ieee80211_tx_info *info, |
2635 | __le16 fc, __le32 *tx_flags) | 2635 | __le16 fc, __le32 *tx_flags) |
2636 | { | 2636 | { |
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.h b/drivers/net/wireless/iwlegacy/iwl-core.h index 92f37c98179..1803954cbc5 100644 --- a/drivers/net/wireless/iwlegacy/iwl-core.h +++ b/drivers/net/wireless/iwlegacy/iwl-core.h | |||
@@ -88,9 +88,9 @@ struct il_cmd; | |||
88 | #define IL_CMD(x) case x: return #x | 88 | #define IL_CMD(x) case x: return #x |
89 | 89 | ||
90 | struct il_hcmd_ops { | 90 | struct il_hcmd_ops { |
91 | int (*rxon_assoc)(struct il_priv *priv, struct il_rxon_context *ctx); | 91 | int (*rxon_assoc)(struct il_priv *il, struct il_rxon_context *ctx); |
92 | int (*commit_rxon)(struct il_priv *priv, struct il_rxon_context *ctx); | 92 | int (*commit_rxon)(struct il_priv *il, struct il_rxon_context *ctx); |
93 | void (*set_rxon_chain)(struct il_priv *priv, | 93 | void (*set_rxon_chain)(struct il_priv *il, |
94 | struct il_rxon_context *ctx); | 94 | struct il_rxon_context *ctx); |
95 | }; | 95 | }; |
96 | 96 | ||
@@ -98,13 +98,13 @@ struct il_hcmd_utils_ops { | |||
98 | u16 (*get_hcmd_size)(u8 cmd_id, u16 len); | 98 | u16 (*get_hcmd_size)(u8 cmd_id, u16 len); |
99 | u16 (*build_addsta_hcmd)(const struct il_addsta_cmd *cmd, | 99 | u16 (*build_addsta_hcmd)(const struct il_addsta_cmd *cmd, |
100 | u8 *data); | 100 | u8 *data); |
101 | int (*request_scan)(struct il_priv *priv, struct ieee80211_vif *vif); | 101 | int (*request_scan)(struct il_priv *il, struct ieee80211_vif *vif); |
102 | void (*post_scan)(struct il_priv *priv); | 102 | void (*post_scan)(struct il_priv *il); |
103 | }; | 103 | }; |
104 | 104 | ||
105 | struct il_apm_ops { | 105 | struct il_apm_ops { |
106 | int (*init)(struct il_priv *priv); | 106 | int (*init)(struct il_priv *il); |
107 | void (*config)(struct il_priv *priv); | 107 | void (*config)(struct il_priv *il); |
108 | }; | 108 | }; |
109 | 109 | ||
110 | struct il_debugfs_ops { | 110 | struct il_debugfs_ops { |
@@ -117,43 +117,43 @@ struct il_debugfs_ops { | |||
117 | }; | 117 | }; |
118 | 118 | ||
119 | struct il_temp_ops { | 119 | struct il_temp_ops { |
120 | void (*temperature)(struct il_priv *priv); | 120 | void (*temperature)(struct il_priv *il); |
121 | }; | 121 | }; |
122 | 122 | ||
123 | struct il_lib_ops { | 123 | struct il_lib_ops { |
124 | /* set hw dependent parameters */ | 124 | /* set hw dependent parameters */ |
125 | int (*set_hw_params)(struct il_priv *priv); | 125 | int (*set_hw_params)(struct il_priv *il); |
126 | /* Handling TX */ | 126 | /* Handling TX */ |
127 | void (*txq_update_byte_cnt_tbl)(struct il_priv *priv, | 127 | void (*txq_update_byte_cnt_tbl)(struct il_priv *il, |
128 | struct il_tx_queue *txq, | 128 | struct il_tx_queue *txq, |
129 | u16 byte_cnt); | 129 | u16 byte_cnt); |
130 | int (*txq_attach_buf_to_tfd)(struct il_priv *priv, | 130 | int (*txq_attach_buf_to_tfd)(struct il_priv *il, |
131 | struct il_tx_queue *txq, | 131 | struct il_tx_queue *txq, |
132 | dma_addr_t addr, | 132 | dma_addr_t addr, |
133 | u16 len, u8 reset, u8 pad); | 133 | u16 len, u8 reset, u8 pad); |
134 | void (*txq_free_tfd)(struct il_priv *priv, | 134 | void (*txq_free_tfd)(struct il_priv *il, |
135 | struct il_tx_queue *txq); | 135 | struct il_tx_queue *txq); |
136 | int (*txq_init)(struct il_priv *priv, | 136 | int (*txq_init)(struct il_priv *il, |
137 | struct il_tx_queue *txq); | 137 | struct il_tx_queue *txq); |
138 | /* setup Rx handler */ | 138 | /* setup Rx handler */ |
139 | void (*rx_handler_setup)(struct il_priv *priv); | 139 | void (*rx_handler_setup)(struct il_priv *il); |
140 | /* alive notification after init uCode load */ | 140 | /* alive notification after init uCode load */ |
141 | void (*init_alive_start)(struct il_priv *priv); | 141 | void (*init_alive_start)(struct il_priv *il); |
142 | /* check validity of rtc data address */ | 142 | /* check validity of rtc data address */ |
143 | int (*is_valid_rtc_data_addr)(u32 addr); | 143 | int (*is_valid_rtc_data_addr)(u32 addr); |
144 | /* 1st ucode load */ | 144 | /* 1st ucode load */ |
145 | int (*load_ucode)(struct il_priv *priv); | 145 | int (*load_ucode)(struct il_priv *il); |
146 | 146 | ||
147 | void (*dump_nic_error_log)(struct il_priv *priv); | 147 | void (*dump_nic_error_log)(struct il_priv *il); |
148 | int (*dump_fh)(struct il_priv *priv, char **buf, bool display); | 148 | int (*dump_fh)(struct il_priv *il, char **buf, bool display); |
149 | int (*set_channel_switch)(struct il_priv *priv, | 149 | int (*set_channel_switch)(struct il_priv *il, |
150 | struct ieee80211_channel_switch *ch_switch); | 150 | struct ieee80211_channel_switch *ch_switch); |
151 | /* power management */ | 151 | /* power management */ |
152 | struct il_apm_ops apm_ops; | 152 | struct il_apm_ops apm_ops; |
153 | 153 | ||
154 | /* power */ | 154 | /* power */ |
155 | int (*send_tx_power) (struct il_priv *priv); | 155 | int (*send_tx_power) (struct il_priv *il); |
156 | void (*update_chain_flags)(struct il_priv *priv); | 156 | void (*update_chain_flags)(struct il_priv *il); |
157 | 157 | ||
158 | /* eeprom operations (as defined in iwl-eeprom.h) */ | 158 | /* eeprom operations (as defined in iwl-eeprom.h) */ |
159 | struct il_eeprom_ops eeprom_ops; | 159 | struct il_eeprom_ops eeprom_ops; |
@@ -166,15 +166,15 @@ struct il_lib_ops { | |||
166 | }; | 166 | }; |
167 | 167 | ||
168 | struct il_led_ops { | 168 | struct il_led_ops { |
169 | int (*cmd)(struct il_priv *priv, struct il_led_cmd *led_cmd); | 169 | int (*cmd)(struct il_priv *il, struct il_led_cmd *led_cmd); |
170 | }; | 170 | }; |
171 | 171 | ||
172 | struct il_legacy_ops { | 172 | struct il_legacy_ops { |
173 | void (*post_associate)(struct il_priv *priv); | 173 | void (*post_associate)(struct il_priv *il); |
174 | void (*config_ap)(struct il_priv *priv); | 174 | void (*config_ap)(struct il_priv *il); |
175 | /* station management */ | 175 | /* station management */ |
176 | int (*update_bcast_stations)(struct il_priv *priv); | 176 | int (*update_bcast_stations)(struct il_priv *il); |
177 | int (*manage_ibss_station)(struct il_priv *priv, | 177 | int (*manage_ibss_station)(struct il_priv *il, |
178 | struct ieee80211_vif *vif, bool add); | 178 | struct ieee80211_vif *vif, bool add); |
179 | }; | 179 | }; |
180 | 180 | ||
@@ -247,7 +247,7 @@ struct il_base_params { | |||
247 | * on firmware version used. | 247 | * on firmware version used. |
248 | * | 248 | * |
249 | * For example, | 249 | * For example, |
250 | * if (IL_UCODE_API(priv->ucode_ver) >= 2) { | 250 | * if (IL_UCODE_API(il->ucode_ver) >= 2) { |
251 | * Driver interacts with Firmware API version >= 2. | 251 | * Driver interacts with Firmware API version >= 2. |
252 | * } else { | 252 | * } else { |
253 | * Driver interacts with Firmware API version 1. | 253 | * Driver interacts with Firmware API version 1. |
@@ -290,35 +290,35 @@ int il_mac_conf_tx(struct ieee80211_hw *hw, | |||
290 | struct ieee80211_vif *vif, u16 queue, | 290 | struct ieee80211_vif *vif, u16 queue, |
291 | const struct ieee80211_tx_queue_params *params); | 291 | const struct ieee80211_tx_queue_params *params); |
292 | int il_mac_tx_last_beacon(struct ieee80211_hw *hw); | 292 | int il_mac_tx_last_beacon(struct ieee80211_hw *hw); |
293 | void il_set_rxon_hwcrypto(struct il_priv *priv, | 293 | void il_set_rxon_hwcrypto(struct il_priv *il, |
294 | struct il_rxon_context *ctx, | 294 | struct il_rxon_context *ctx, |
295 | int hw_decrypt); | 295 | int hw_decrypt); |
296 | int il_check_rxon_cmd(struct il_priv *priv, | 296 | int il_check_rxon_cmd(struct il_priv *il, |
297 | struct il_rxon_context *ctx); | 297 | struct il_rxon_context *ctx); |
298 | int il_full_rxon_required(struct il_priv *priv, | 298 | int il_full_rxon_required(struct il_priv *il, |
299 | struct il_rxon_context *ctx); | 299 | struct il_rxon_context *ctx); |
300 | int il_set_rxon_channel(struct il_priv *priv, | 300 | int il_set_rxon_channel(struct il_priv *il, |
301 | struct ieee80211_channel *ch, | 301 | struct ieee80211_channel *ch, |
302 | struct il_rxon_context *ctx); | 302 | struct il_rxon_context *ctx); |
303 | void il_set_flags_for_band(struct il_priv *priv, | 303 | void il_set_flags_for_band(struct il_priv *il, |
304 | struct il_rxon_context *ctx, | 304 | struct il_rxon_context *ctx, |
305 | enum ieee80211_band band, | 305 | enum ieee80211_band band, |
306 | struct ieee80211_vif *vif); | 306 | struct ieee80211_vif *vif); |
307 | u8 il_get_single_channel_number(struct il_priv *priv, | 307 | u8 il_get_single_channel_number(struct il_priv *il, |
308 | enum ieee80211_band band); | 308 | enum ieee80211_band band); |
309 | void il_set_rxon_ht(struct il_priv *priv, | 309 | void il_set_rxon_ht(struct il_priv *il, |
310 | struct il_ht_config *ht_conf); | 310 | struct il_ht_config *ht_conf); |
311 | bool il_is_ht40_tx_allowed(struct il_priv *priv, | 311 | bool il_is_ht40_tx_allowed(struct il_priv *il, |
312 | struct il_rxon_context *ctx, | 312 | struct il_rxon_context *ctx, |
313 | struct ieee80211_sta_ht_cap *ht_cap); | 313 | struct ieee80211_sta_ht_cap *ht_cap); |
314 | void il_connection_init_rx_config(struct il_priv *priv, | 314 | void il_connection_init_rx_config(struct il_priv *il, |
315 | struct il_rxon_context *ctx); | 315 | struct il_rxon_context *ctx); |
316 | void il_set_rate(struct il_priv *priv); | 316 | void il_set_rate(struct il_priv *il); |
317 | int il_set_decrypted_flag(struct il_priv *priv, | 317 | int il_set_decrypted_flag(struct il_priv *il, |
318 | struct ieee80211_hdr *hdr, | 318 | struct ieee80211_hdr *hdr, |
319 | u32 decrypt_res, | 319 | u32 decrypt_res, |
320 | struct ieee80211_rx_status *stats); | 320 | struct ieee80211_rx_status *stats); |
321 | void il_irq_handle_error(struct il_priv *priv); | 321 | void il_irq_handle_error(struct il_priv *il); |
322 | int il_mac_add_interface(struct ieee80211_hw *hw, | 322 | int il_mac_add_interface(struct ieee80211_hw *hw, |
323 | struct ieee80211_vif *vif); | 323 | struct ieee80211_vif *vif); |
324 | void il_mac_remove_interface(struct ieee80211_hw *hw, | 324 | void il_mac_remove_interface(struct ieee80211_hw *hw, |
@@ -326,42 +326,42 @@ void il_mac_remove_interface(struct ieee80211_hw *hw, | |||
326 | int il_mac_change_interface(struct ieee80211_hw *hw, | 326 | int il_mac_change_interface(struct ieee80211_hw *hw, |
327 | struct ieee80211_vif *vif, | 327 | struct ieee80211_vif *vif, |
328 | enum nl80211_iftype newtype, bool newp2p); | 328 | enum nl80211_iftype newtype, bool newp2p); |
329 | int il_alloc_txq_mem(struct il_priv *priv); | 329 | int il_alloc_txq_mem(struct il_priv *il); |
330 | void il_txq_mem(struct il_priv *priv); | 330 | void il_txq_mem(struct il_priv *il); |
331 | 331 | ||
332 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS | 332 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS |
333 | int il_alloc_traffic_mem(struct il_priv *priv); | 333 | int il_alloc_traffic_mem(struct il_priv *il); |
334 | void il_free_traffic_mem(struct il_priv *priv); | 334 | void il_free_traffic_mem(struct il_priv *il); |
335 | void il_reset_traffic_log(struct il_priv *priv); | 335 | void il_reset_traffic_log(struct il_priv *il); |
336 | void il_dbg_log_tx_data_frame(struct il_priv *priv, | 336 | void il_dbg_log_tx_data_frame(struct il_priv *il, |
337 | u16 length, struct ieee80211_hdr *header); | 337 | u16 length, struct ieee80211_hdr *header); |
338 | void il_dbg_log_rx_data_frame(struct il_priv *priv, | 338 | void il_dbg_log_rx_data_frame(struct il_priv *il, |
339 | u16 length, struct ieee80211_hdr *header); | 339 | u16 length, struct ieee80211_hdr *header); |
340 | const char *il_get_mgmt_string(int cmd); | 340 | const char *il_get_mgmt_string(int cmd); |
341 | const char *il_get_ctrl_string(int cmd); | 341 | const char *il_get_ctrl_string(int cmd); |
342 | void il_clear_traffic_stats(struct il_priv *priv); | 342 | void il_clear_traffic_stats(struct il_priv *il); |
343 | void il_update_stats(struct il_priv *priv, bool is_tx, __le16 fc, | 343 | void il_update_stats(struct il_priv *il, bool is_tx, __le16 fc, |
344 | u16 len); | 344 | u16 len); |
345 | #else | 345 | #else |
346 | static inline int il_alloc_traffic_mem(struct il_priv *priv) | 346 | static inline int il_alloc_traffic_mem(struct il_priv *il) |
347 | { | 347 | { |
348 | return 0; | 348 | return 0; |
349 | } | 349 | } |
350 | static inline void il_free_traffic_mem(struct il_priv *priv) | 350 | static inline void il_free_traffic_mem(struct il_priv *il) |
351 | { | 351 | { |
352 | } | 352 | } |
353 | static inline void il_reset_traffic_log(struct il_priv *priv) | 353 | static inline void il_reset_traffic_log(struct il_priv *il) |
354 | { | 354 | { |
355 | } | 355 | } |
356 | static inline void il_dbg_log_tx_data_frame(struct il_priv *priv, | 356 | static inline void il_dbg_log_tx_data_frame(struct il_priv *il, |
357 | u16 length, struct ieee80211_hdr *header) | 357 | u16 length, struct ieee80211_hdr *header) |
358 | { | 358 | { |
359 | } | 359 | } |
360 | static inline void il_dbg_log_rx_data_frame(struct il_priv *priv, | 360 | static inline void il_dbg_log_rx_data_frame(struct il_priv *il, |
361 | u16 length, struct ieee80211_hdr *header) | 361 | u16 length, struct ieee80211_hdr *header) |
362 | { | 362 | { |
363 | } | 363 | } |
364 | static inline void il_update_stats(struct il_priv *priv, bool is_tx, | 364 | static inline void il_update_stats(struct il_priv *il, bool is_tx, |
365 | __le16 fc, u16 len) | 365 | __le16 fc, u16 len) |
366 | { | 366 | { |
367 | } | 367 | } |
@@ -369,83 +369,83 @@ static inline void il_update_stats(struct il_priv *priv, bool is_tx, | |||
369 | /***************************************************** | 369 | /***************************************************** |
370 | * RX handlers. | 370 | * RX handlers. |
371 | * **************************************************/ | 371 | * **************************************************/ |
372 | void il_rx_pm_sleep_notif(struct il_priv *priv, | 372 | void il_rx_pm_sleep_notif(struct il_priv *il, |
373 | struct il_rx_mem_buffer *rxb); | 373 | struct il_rx_mem_buffer *rxb); |
374 | void il_rx_pm_debug_statistics_notif(struct il_priv *priv, | 374 | void il_rx_pm_debug_statistics_notif(struct il_priv *il, |
375 | struct il_rx_mem_buffer *rxb); | 375 | struct il_rx_mem_buffer *rxb); |
376 | void il_rx_reply_error(struct il_priv *priv, | 376 | void il_rx_reply_error(struct il_priv *il, |
377 | struct il_rx_mem_buffer *rxb); | 377 | struct il_rx_mem_buffer *rxb); |
378 | 378 | ||
379 | /***************************************************** | 379 | /***************************************************** |
380 | * RX | 380 | * RX |
381 | ******************************************************/ | 381 | ******************************************************/ |
382 | void il_cmd_queue_unmap(struct il_priv *priv); | 382 | void il_cmd_queue_unmap(struct il_priv *il); |
383 | void il_cmd_queue_free(struct il_priv *priv); | 383 | void il_cmd_queue_free(struct il_priv *il); |
384 | int il_rx_queue_alloc(struct il_priv *priv); | 384 | int il_rx_queue_alloc(struct il_priv *il); |
385 | void il_rx_queue_update_write_ptr(struct il_priv *priv, | 385 | void il_rx_queue_update_write_ptr(struct il_priv *il, |
386 | struct il_rx_queue *q); | 386 | struct il_rx_queue *q); |
387 | int il_rx_queue_space(const struct il_rx_queue *q); | 387 | int il_rx_queue_space(const struct il_rx_queue *q); |
388 | void il_tx_cmd_complete(struct il_priv *priv, | 388 | void il_tx_cmd_complete(struct il_priv *il, |
389 | struct il_rx_mem_buffer *rxb); | 389 | struct il_rx_mem_buffer *rxb); |
390 | /* Handlers */ | 390 | /* Handlers */ |
391 | void il_rx_spectrum_measure_notif(struct il_priv *priv, | 391 | void il_rx_spectrum_measure_notif(struct il_priv *il, |
392 | struct il_rx_mem_buffer *rxb); | 392 | struct il_rx_mem_buffer *rxb); |
393 | void il_recover_from_statistics(struct il_priv *priv, | 393 | void il_recover_from_statistics(struct il_priv *il, |
394 | struct il_rx_packet *pkt); | 394 | struct il_rx_packet *pkt); |
395 | void il_chswitch_done(struct il_priv *priv, bool is_success); | 395 | void il_chswitch_done(struct il_priv *il, bool is_success); |
396 | void il_rx_csa(struct il_priv *priv, struct il_rx_mem_buffer *rxb); | 396 | void il_rx_csa(struct il_priv *il, struct il_rx_mem_buffer *rxb); |
397 | 397 | ||
398 | /* TX helpers */ | 398 | /* TX helpers */ |
399 | 399 | ||
400 | /***************************************************** | 400 | /***************************************************** |
401 | * TX | 401 | * TX |
402 | ******************************************************/ | 402 | ******************************************************/ |
403 | void il_txq_update_write_ptr(struct il_priv *priv, | 403 | void il_txq_update_write_ptr(struct il_priv *il, |
404 | struct il_tx_queue *txq); | 404 | struct il_tx_queue *txq); |
405 | int il_tx_queue_init(struct il_priv *priv, struct il_tx_queue *txq, | 405 | int il_tx_queue_init(struct il_priv *il, struct il_tx_queue *txq, |
406 | int slots_num, u32 txq_id); | 406 | int slots_num, u32 txq_id); |
407 | void il_tx_queue_reset(struct il_priv *priv, | 407 | void il_tx_queue_reset(struct il_priv *il, |
408 | struct il_tx_queue *txq, | 408 | struct il_tx_queue *txq, |
409 | int slots_num, u32 txq_id); | 409 | int slots_num, u32 txq_id); |
410 | void il_tx_queue_unmap(struct il_priv *priv, int txq_id); | 410 | void il_tx_queue_unmap(struct il_priv *il, int txq_id); |
411 | void il_tx_queue_free(struct il_priv *priv, int txq_id); | 411 | void il_tx_queue_free(struct il_priv *il, int txq_id); |
412 | void il_setup_watchdog(struct il_priv *priv); | 412 | void il_setup_watchdog(struct il_priv *il); |
413 | /***************************************************** | 413 | /***************************************************** |
414 | * TX power | 414 | * TX power |
415 | ****************************************************/ | 415 | ****************************************************/ |
416 | int il_set_tx_power(struct il_priv *priv, s8 tx_power, bool force); | 416 | int il_set_tx_power(struct il_priv *il, s8 tx_power, bool force); |
417 | 417 | ||
418 | /******************************************************************************* | 418 | /******************************************************************************* |
419 | * Rate | 419 | * Rate |
420 | ******************************************************************************/ | 420 | ******************************************************************************/ |
421 | 421 | ||
422 | u8 il_get_lowest_plcp(struct il_priv *priv, | 422 | u8 il_get_lowest_plcp(struct il_priv *il, |
423 | struct il_rxon_context *ctx); | 423 | struct il_rxon_context *ctx); |
424 | 424 | ||
425 | /******************************************************************************* | 425 | /******************************************************************************* |
426 | * Scanning | 426 | * Scanning |
427 | ******************************************************************************/ | 427 | ******************************************************************************/ |
428 | void il_init_scan_params(struct il_priv *priv); | 428 | void il_init_scan_params(struct il_priv *il); |
429 | int il_scan_cancel(struct il_priv *priv); | 429 | int il_scan_cancel(struct il_priv *il); |
430 | int il_scan_cancel_timeout(struct il_priv *priv, unsigned long ms); | 430 | int il_scan_cancel_timeout(struct il_priv *il, unsigned long ms); |
431 | void il_force_scan_end(struct il_priv *priv); | 431 | void il_force_scan_end(struct il_priv *il); |
432 | int il_mac_hw_scan(struct ieee80211_hw *hw, | 432 | int il_mac_hw_scan(struct ieee80211_hw *hw, |
433 | struct ieee80211_vif *vif, | 433 | struct ieee80211_vif *vif, |
434 | struct cfg80211_scan_request *req); | 434 | struct cfg80211_scan_request *req); |
435 | void il_internal_short_hw_scan(struct il_priv *priv); | 435 | void il_internal_short_hw_scan(struct il_priv *il); |
436 | int il_force_reset(struct il_priv *priv, bool external); | 436 | int il_force_reset(struct il_priv *il, bool external); |
437 | u16 il_fill_probe_req(struct il_priv *priv, | 437 | u16 il_fill_probe_req(struct il_priv *il, |
438 | struct ieee80211_mgmt *frame, | 438 | struct ieee80211_mgmt *frame, |
439 | const u8 *ta, const u8 *ie, int ie_len, int left); | 439 | const u8 *ta, const u8 *ie, int ie_len, int left); |
440 | void il_setup_rx_scan_handlers(struct il_priv *priv); | 440 | void il_setup_rx_scan_handlers(struct il_priv *il); |
441 | u16 il_get_active_dwell_time(struct il_priv *priv, | 441 | u16 il_get_active_dwell_time(struct il_priv *il, |
442 | enum ieee80211_band band, | 442 | enum ieee80211_band band, |
443 | u8 n_probes); | 443 | u8 n_probes); |
444 | u16 il_get_passive_dwell_time(struct il_priv *priv, | 444 | u16 il_get_passive_dwell_time(struct il_priv *il, |
445 | enum ieee80211_band band, | 445 | enum ieee80211_band band, |
446 | struct ieee80211_vif *vif); | 446 | struct ieee80211_vif *vif); |
447 | void il_setup_scan_deferred_work(struct il_priv *priv); | 447 | void il_setup_scan_deferred_work(struct il_priv *il); |
448 | void il_cancel_scan_deferred_work(struct il_priv *priv); | 448 | void il_cancel_scan_deferred_work(struct il_priv *il); |
449 | 449 | ||
450 | /* For faster active scanning, scan will move to the next channel if fewer than | 450 | /* For faster active scanning, scan will move to the next channel if fewer than |
451 | * PLCP_QUIET_THRESH packets are heard on this channel within | 451 | * PLCP_QUIET_THRESH packets are heard on this channel within |
@@ -463,37 +463,37 @@ void il_cancel_scan_deferred_work(struct il_priv *priv); | |||
463 | *****************************************************/ | 463 | *****************************************************/ |
464 | 464 | ||
465 | const char *il_get_cmd_string(u8 cmd); | 465 | const char *il_get_cmd_string(u8 cmd); |
466 | int __must_check il_send_cmd_sync(struct il_priv *priv, | 466 | int __must_check il_send_cmd_sync(struct il_priv *il, |
467 | struct il_host_cmd *cmd); | 467 | struct il_host_cmd *cmd); |
468 | int il_send_cmd(struct il_priv *priv, struct il_host_cmd *cmd); | 468 | int il_send_cmd(struct il_priv *il, struct il_host_cmd *cmd); |
469 | int __must_check il_send_cmd_pdu(struct il_priv *priv, u8 id, | 469 | int __must_check il_send_cmd_pdu(struct il_priv *il, u8 id, |
470 | u16 len, const void *data); | 470 | u16 len, const void *data); |
471 | int il_send_cmd_pdu_async(struct il_priv *priv, u8 id, u16 len, | 471 | int il_send_cmd_pdu_async(struct il_priv *il, u8 id, u16 len, |
472 | const void *data, | 472 | const void *data, |
473 | void (*callback)(struct il_priv *priv, | 473 | void (*callback)(struct il_priv *il, |
474 | struct il_device_cmd *cmd, | 474 | struct il_device_cmd *cmd, |
475 | struct il_rx_packet *pkt)); | 475 | struct il_rx_packet *pkt)); |
476 | 476 | ||
477 | int il_enqueue_hcmd(struct il_priv *priv, struct il_host_cmd *cmd); | 477 | int il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd); |
478 | 478 | ||
479 | 479 | ||
480 | /***************************************************** | 480 | /***************************************************** |
481 | * PCI * | 481 | * PCI * |
482 | *****************************************************/ | 482 | *****************************************************/ |
483 | 483 | ||
484 | static inline u16 il_pcie_link_ctl(struct il_priv *priv) | 484 | static inline u16 il_pcie_link_ctl(struct il_priv *il) |
485 | { | 485 | { |
486 | int pos; | 486 | int pos; |
487 | u16 pci_lnk_ctl; | 487 | u16 pci_lnk_ctl; |
488 | pos = pci_pcie_cap(priv->pci_dev); | 488 | pos = pci_pcie_cap(il->pci_dev); |
489 | pci_read_config_word(priv->pci_dev, pos + PCI_EXP_LNKCTL, &pci_lnk_ctl); | 489 | pci_read_config_word(il->pci_dev, pos + PCI_EXP_LNKCTL, &pci_lnk_ctl); |
490 | return pci_lnk_ctl; | 490 | return pci_lnk_ctl; |
491 | } | 491 | } |
492 | 492 | ||
493 | void il_bg_watchdog(unsigned long data); | 493 | void il_bg_watchdog(unsigned long data); |
494 | u32 il_usecs_to_beacons(struct il_priv *priv, | 494 | u32 il_usecs_to_beacons(struct il_priv *il, |
495 | u32 usec, u32 beacon_interval); | 495 | u32 usec, u32 beacon_interval); |
496 | __le32 il_add_beacon_time(struct il_priv *priv, u32 base, | 496 | __le32 il_add_beacon_time(struct il_priv *il, u32 base, |
497 | u32 addon, u32 beacon_interval); | 497 | u32 addon, u32 beacon_interval); |
498 | 498 | ||
499 | #ifdef CONFIG_PM | 499 | #ifdef CONFIG_PM |
@@ -512,24 +512,24 @@ extern const struct dev_pm_ops il_pm_ops; | |||
512 | /***************************************************** | 512 | /***************************************************** |
513 | * Error Handling Debugging | 513 | * Error Handling Debugging |
514 | ******************************************************/ | 514 | ******************************************************/ |
515 | void il4965_dump_nic_error_log(struct il_priv *priv); | 515 | void il4965_dump_nic_error_log(struct il_priv *il); |
516 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 516 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
517 | void il_print_rx_config_cmd(struct il_priv *priv, | 517 | void il_print_rx_config_cmd(struct il_priv *il, |
518 | struct il_rxon_context *ctx); | 518 | struct il_rxon_context *ctx); |
519 | #else | 519 | #else |
520 | static inline void il_print_rx_config_cmd(struct il_priv *priv, | 520 | static inline void il_print_rx_config_cmd(struct il_priv *il, |
521 | struct il_rxon_context *ctx) | 521 | struct il_rxon_context *ctx) |
522 | { | 522 | { |
523 | } | 523 | } |
524 | #endif | 524 | #endif |
525 | 525 | ||
526 | void il_clear_isr_stats(struct il_priv *priv); | 526 | void il_clear_isr_stats(struct il_priv *il); |
527 | 527 | ||
528 | /***************************************************** | 528 | /***************************************************** |
529 | * GEOS | 529 | * GEOS |
530 | ******************************************************/ | 530 | ******************************************************/ |
531 | int il_init_geos(struct il_priv *priv); | 531 | int il_init_geos(struct il_priv *il); |
532 | void il_free_geos(struct il_priv *priv); | 532 | void il_free_geos(struct il_priv *il); |
533 | 533 | ||
534 | /*************** DRIVER STATUS FUNCTIONS *****/ | 534 | /*************** DRIVER STATUS FUNCTIONS *****/ |
535 | 535 | ||
@@ -552,71 +552,71 @@ void il_free_geos(struct il_priv *priv); | |||
552 | #define STATUS_FW_ERROR 17 | 552 | #define STATUS_FW_ERROR 17 |
553 | #define STATUS_CHANNEL_SWITCH_PENDING 18 | 553 | #define STATUS_CHANNEL_SWITCH_PENDING 18 |
554 | 554 | ||
555 | static inline int il_is_ready(struct il_priv *priv) | 555 | static inline int il_is_ready(struct il_priv *il) |
556 | { | 556 | { |
557 | /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are | 557 | /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are |
558 | * set but EXIT_PENDING is not */ | 558 | * set but EXIT_PENDING is not */ |
559 | return test_bit(STATUS_READY, &priv->status) && | 559 | return test_bit(STATUS_READY, &il->status) && |
560 | test_bit(STATUS_GEO_CONFIGURED, &priv->status) && | 560 | test_bit(STATUS_GEO_CONFIGURED, &il->status) && |
561 | !test_bit(STATUS_EXIT_PENDING, &priv->status); | 561 | !test_bit(STATUS_EXIT_PENDING, &il->status); |
562 | } | 562 | } |
563 | 563 | ||
564 | static inline int il_is_alive(struct il_priv *priv) | 564 | static inline int il_is_alive(struct il_priv *il) |
565 | { | 565 | { |
566 | return test_bit(STATUS_ALIVE, &priv->status); | 566 | return test_bit(STATUS_ALIVE, &il->status); |
567 | } | 567 | } |
568 | 568 | ||
569 | static inline int il_is_init(struct il_priv *priv) | 569 | static inline int il_is_init(struct il_priv *il) |
570 | { | 570 | { |
571 | return test_bit(STATUS_INIT, &priv->status); | 571 | return test_bit(STATUS_INIT, &il->status); |
572 | } | 572 | } |
573 | 573 | ||
574 | static inline int il_is_rfkill_hw(struct il_priv *priv) | 574 | static inline int il_is_rfkill_hw(struct il_priv *il) |
575 | { | 575 | { |
576 | return test_bit(STATUS_RF_KILL_HW, &priv->status); | 576 | return test_bit(STATUS_RF_KILL_HW, &il->status); |
577 | } | 577 | } |
578 | 578 | ||
579 | static inline int il_is_rfkill(struct il_priv *priv) | 579 | static inline int il_is_rfkill(struct il_priv *il) |
580 | { | 580 | { |
581 | return il_is_rfkill_hw(priv); | 581 | return il_is_rfkill_hw(il); |
582 | } | 582 | } |
583 | 583 | ||
584 | static inline int il_is_ctkill(struct il_priv *priv) | 584 | static inline int il_is_ctkill(struct il_priv *il) |
585 | { | 585 | { |
586 | return test_bit(STATUS_CT_KILL, &priv->status); | 586 | return test_bit(STATUS_CT_KILL, &il->status); |
587 | } | 587 | } |
588 | 588 | ||
589 | static inline int il_is_ready_rf(struct il_priv *priv) | 589 | static inline int il_is_ready_rf(struct il_priv *il) |
590 | { | 590 | { |
591 | 591 | ||
592 | if (il_is_rfkill(priv)) | 592 | if (il_is_rfkill(il)) |
593 | return 0; | 593 | return 0; |
594 | 594 | ||
595 | return il_is_ready(priv); | 595 | return il_is_ready(il); |
596 | } | 596 | } |
597 | 597 | ||
598 | extern void il_send_bt_config(struct il_priv *priv); | 598 | extern void il_send_bt_config(struct il_priv *il); |
599 | extern int il_send_statistics_request(struct il_priv *priv, | 599 | extern int il_send_statistics_request(struct il_priv *il, |
600 | u8 flags, bool clear); | 600 | u8 flags, bool clear); |
601 | void il_apm_stop(struct il_priv *priv); | 601 | void il_apm_stop(struct il_priv *il); |
602 | int il_apm_init(struct il_priv *priv); | 602 | int il_apm_init(struct il_priv *il); |
603 | 603 | ||
604 | int il_send_rxon_timing(struct il_priv *priv, | 604 | int il_send_rxon_timing(struct il_priv *il, |
605 | struct il_rxon_context *ctx); | 605 | struct il_rxon_context *ctx); |
606 | static inline int il_send_rxon_assoc(struct il_priv *priv, | 606 | static inline int il_send_rxon_assoc(struct il_priv *il, |
607 | struct il_rxon_context *ctx) | 607 | struct il_rxon_context *ctx) |
608 | { | 608 | { |
609 | return priv->cfg->ops->hcmd->rxon_assoc(priv, ctx); | 609 | return il->cfg->ops->hcmd->rxon_assoc(il, ctx); |
610 | } | 610 | } |
611 | static inline int il_commit_rxon(struct il_priv *priv, | 611 | static inline int il_commit_rxon(struct il_priv *il, |
612 | struct il_rxon_context *ctx) | 612 | struct il_rxon_context *ctx) |
613 | { | 613 | { |
614 | return priv->cfg->ops->hcmd->commit_rxon(priv, ctx); | 614 | return il->cfg->ops->hcmd->commit_rxon(il, ctx); |
615 | } | 615 | } |
616 | static inline const struct ieee80211_supported_band *il_get_hw_mode( | 616 | static inline const struct ieee80211_supported_band *il_get_hw_mode( |
617 | struct il_priv *priv, enum ieee80211_band band) | 617 | struct il_priv *il, enum ieee80211_band band) |
618 | { | 618 | { |
619 | return priv->hw->wiphy->bands[band]; | 619 | return il->hw->wiphy->bands[band]; |
620 | } | 620 | } |
621 | 621 | ||
622 | /* mac80211 handlers */ | 622 | /* mac80211 handlers */ |
@@ -627,7 +627,7 @@ void il_mac_bss_info_changed(struct ieee80211_hw *hw, | |||
627 | struct ieee80211_vif *vif, | 627 | struct ieee80211_vif *vif, |
628 | struct ieee80211_bss_conf *bss_conf, | 628 | struct ieee80211_bss_conf *bss_conf, |
629 | u32 changes); | 629 | u32 changes); |
630 | void il_tx_cmd_protection(struct il_priv *priv, | 630 | void il_tx_cmd_protection(struct il_priv *il, |
631 | struct ieee80211_tx_info *info, | 631 | struct ieee80211_tx_info *info, |
632 | __le16 fc, __le32 *tx_flags); | 632 | __le16 fc, __le32 *tx_flags); |
633 | 633 | ||
diff --git a/drivers/net/wireless/iwlegacy/iwl-debug.h b/drivers/net/wireless/iwlegacy/iwl-debug.h index 1bbad766aac..657da25a235 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; | |||
37 | #define IL_INFO(p, f, a...) dev_info(&((p)->pci_dev->dev), f, ## a) | 37 | #define IL_INFO(p, f, a...) dev_info(&((p)->pci_dev->dev), f, ## a) |
38 | #define IL_CRIT(p, f, a...) dev_crit(&((p)->pci_dev->dev), f, ## a) | 38 | #define IL_CRIT(p, f, a...) dev_crit(&((p)->pci_dev->dev), f, ## a) |
39 | 39 | ||
40 | #define il_print_hex_error(priv, p, len) \ | 40 | #define il_print_hex_error(il, p, len) \ |
41 | do { \ | 41 | do { \ |
42 | print_hex_dump(KERN_ERR, "iwl data: ", \ | 42 | print_hex_dump(KERN_ERR, "iwl data: ", \ |
43 | DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ | 43 | DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ |
@@ -60,9 +60,9 @@ do { \ | |||
60 | __func__ , ## args); \ | 60 | __func__ , ## args); \ |
61 | } while (0) | 61 | } while (0) |
62 | 62 | ||
63 | #define il_print_hex_dump(priv, level, p, len) \ | 63 | #define il_print_hex_dump(il, level, p, len) \ |
64 | do { \ | 64 | do { \ |
65 | if (il_get_debug_level(priv) & level) \ | 65 | if (il_get_debug_level(il) & level) \ |
66 | print_hex_dump(KERN_DEBUG, "iwl data: ", \ | 66 | print_hex_dump(KERN_DEBUG, "iwl data: ", \ |
67 | DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ | 67 | DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ |
68 | } while (0) | 68 | } while (0) |
@@ -70,21 +70,21 @@ do { \ | |||
70 | #else | 70 | #else |
71 | #define IL_DEBUG(__priv, level, fmt, args...) | 71 | #define IL_DEBUG(__priv, level, fmt, args...) |
72 | #define IL_DEBUG_LIMIT(__priv, level, fmt, args...) | 72 | #define IL_DEBUG_LIMIT(__priv, level, fmt, args...) |
73 | static inline void il_print_hex_dump(struct il_priv *priv, int level, | 73 | static inline void il_print_hex_dump(struct il_priv *il, int level, |
74 | const void *p, u32 len) | 74 | const void *p, u32 len) |
75 | {} | 75 | {} |
76 | #endif /* CONFIG_IWLWIFI_LEGACY_DEBUG */ | 76 | #endif /* CONFIG_IWLWIFI_LEGACY_DEBUG */ |
77 | 77 | ||
78 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS | 78 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUGFS |
79 | int il_dbgfs_register(struct il_priv *priv, const char *name); | 79 | int il_dbgfs_register(struct il_priv *il, const char *name); |
80 | void il_dbgfs_unregister(struct il_priv *priv); | 80 | void il_dbgfs_unregister(struct il_priv *il); |
81 | #else | 81 | #else |
82 | static inline int | 82 | static inline int |
83 | il_dbgfs_register(struct il_priv *priv, const char *name) | 83 | il_dbgfs_register(struct il_priv *il, const char *name) |
84 | { | 84 | { |
85 | return 0; | 85 | return 0; |
86 | } | 86 | } |
87 | static inline void il_dbgfs_unregister(struct il_priv *priv) | 87 | static inline void il_dbgfs_unregister(struct il_priv *il) |
88 | { | 88 | { |
89 | } | 89 | } |
90 | #endif /* CONFIG_IWLWIFI_LEGACY_DEBUGFS */ | 90 | #endif /* CONFIG_IWLWIFI_LEGACY_DEBUGFS */ |
diff --git a/drivers/net/wireless/iwlegacy/iwl-debugfs.c b/drivers/net/wireless/iwlegacy/iwl-debugfs.c index 057dec5b178..f2f2eba7d3e 100644 --- a/drivers/net/wireless/iwlegacy/iwl-debugfs.c +++ b/drivers/net/wireless/iwlegacy/iwl-debugfs.c | |||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | /* create and remove of files */ | 37 | /* create and remove of files */ |
38 | #define DEBUGFS_ADD_FILE(name, parent, mode) do { \ | 38 | #define DEBUGFS_ADD_FILE(name, parent, mode) do { \ |
39 | if (!debugfs_create_file(#name, mode, parent, priv, \ | 39 | if (!debugfs_create_file(#name, mode, parent, il, \ |
40 | &il_dbgfs_##name##_ops)) \ | 40 | &il_dbgfs_##name##_ops)) \ |
41 | goto err; \ | 41 | goto err; \ |
42 | } while (0) | 42 | } while (0) |
@@ -106,7 +106,7 @@ static ssize_t il_dbgfs_tx_statistics_read(struct file *file, | |||
106 | char __user *user_buf, | 106 | char __user *user_buf, |
107 | size_t count, loff_t *ppos) { | 107 | size_t count, loff_t *ppos) { |
108 | 108 | ||
109 | struct il_priv *priv = file->private_data; | 109 | struct il_priv *il = file->private_data; |
110 | char *buf; | 110 | char *buf; |
111 | int pos = 0; | 111 | int pos = 0; |
112 | 112 | ||
@@ -122,20 +122,20 @@ static ssize_t il_dbgfs_tx_statistics_read(struct file *file, | |||
122 | pos += scnprintf(buf + pos, bufsz - pos, | 122 | pos += scnprintf(buf + pos, bufsz - pos, |
123 | "\t%25s\t\t: %u\n", | 123 | "\t%25s\t\t: %u\n", |
124 | il_get_mgmt_string(cnt), | 124 | il_get_mgmt_string(cnt), |
125 | priv->tx_stats.mgmt[cnt]); | 125 | il->tx_stats.mgmt[cnt]); |
126 | } | 126 | } |
127 | pos += scnprintf(buf + pos, bufsz - pos, "Control\n"); | 127 | pos += scnprintf(buf + pos, bufsz - pos, "Control\n"); |
128 | for (cnt = 0; cnt < CONTROL_MAX; cnt++) { | 128 | for (cnt = 0; cnt < CONTROL_MAX; cnt++) { |
129 | pos += scnprintf(buf + pos, bufsz - pos, | 129 | pos += scnprintf(buf + pos, bufsz - pos, |
130 | "\t%25s\t\t: %u\n", | 130 | "\t%25s\t\t: %u\n", |
131 | il_get_ctrl_string(cnt), | 131 | il_get_ctrl_string(cnt), |
132 | priv->tx_stats.ctrl[cnt]); | 132 | il->tx_stats.ctrl[cnt]); |
133 | } | 133 | } |
134 | pos += scnprintf(buf + pos, bufsz - pos, "Data:\n"); | 134 | pos += scnprintf(buf + pos, bufsz - pos, "Data:\n"); |
135 | pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n", | 135 | pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n", |
136 | priv->tx_stats.data_cnt); | 136 | il->tx_stats.data_cnt); |
137 | pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n", | 137 | pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n", |
138 | priv->tx_stats.data_bytes); | 138 | il->tx_stats.data_bytes); |
139 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 139 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
140 | kfree(buf); | 140 | kfree(buf); |
141 | return ret; | 141 | return ret; |
@@ -146,7 +146,7 @@ il_dbgfs_clear_traffic_statistics_write(struct file *file, | |||
146 | const char __user *user_buf, | 146 | const char __user *user_buf, |
147 | size_t count, loff_t *ppos) | 147 | size_t count, loff_t *ppos) |
148 | { | 148 | { |
149 | struct il_priv *priv = file->private_data; | 149 | struct il_priv *il = file->private_data; |
150 | u32 clear_flag; | 150 | u32 clear_flag; |
151 | char buf[8]; | 151 | char buf[8]; |
152 | int buf_size; | 152 | int buf_size; |
@@ -157,7 +157,7 @@ il_dbgfs_clear_traffic_statistics_write(struct file *file, | |||
157 | return -EFAULT; | 157 | return -EFAULT; |
158 | if (sscanf(buf, "%x", &clear_flag) != 1) | 158 | if (sscanf(buf, "%x", &clear_flag) != 1) |
159 | return -EFAULT; | 159 | return -EFAULT; |
160 | il_clear_traffic_stats(priv); | 160 | il_clear_traffic_stats(il); |
161 | 161 | ||
162 | return count; | 162 | return count; |
163 | } | 163 | } |
@@ -166,7 +166,7 @@ static ssize_t il_dbgfs_rx_statistics_read(struct file *file, | |||
166 | char __user *user_buf, | 166 | char __user *user_buf, |
167 | size_t count, loff_t *ppos) { | 167 | size_t count, loff_t *ppos) { |
168 | 168 | ||
169 | struct il_priv *priv = file->private_data; | 169 | struct il_priv *il = file->private_data; |
170 | char *buf; | 170 | char *buf; |
171 | int pos = 0; | 171 | int pos = 0; |
172 | int cnt; | 172 | int cnt; |
@@ -182,20 +182,20 @@ static ssize_t il_dbgfs_rx_statistics_read(struct file *file, | |||
182 | pos += scnprintf(buf + pos, bufsz - pos, | 182 | pos += scnprintf(buf + pos, bufsz - pos, |
183 | "\t%25s\t\t: %u\n", | 183 | "\t%25s\t\t: %u\n", |
184 | il_get_mgmt_string(cnt), | 184 | il_get_mgmt_string(cnt), |
185 | priv->rx_stats.mgmt[cnt]); | 185 | il->rx_stats.mgmt[cnt]); |
186 | } | 186 | } |
187 | pos += scnprintf(buf + pos, bufsz - pos, "Control:\n"); | 187 | pos += scnprintf(buf + pos, bufsz - pos, "Control:\n"); |
188 | for (cnt = 0; cnt < CONTROL_MAX; cnt++) { | 188 | for (cnt = 0; cnt < CONTROL_MAX; cnt++) { |
189 | pos += scnprintf(buf + pos, bufsz - pos, | 189 | pos += scnprintf(buf + pos, bufsz - pos, |
190 | "\t%25s\t\t: %u\n", | 190 | "\t%25s\t\t: %u\n", |
191 | il_get_ctrl_string(cnt), | 191 | il_get_ctrl_string(cnt), |
192 | priv->rx_stats.ctrl[cnt]); | 192 | il->rx_stats.ctrl[cnt]); |
193 | } | 193 | } |
194 | pos += scnprintf(buf + pos, bufsz - pos, "Data:\n"); | 194 | pos += scnprintf(buf + pos, bufsz - pos, "Data:\n"); |
195 | pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n", | 195 | pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n", |
196 | priv->rx_stats.data_cnt); | 196 | il->rx_stats.data_cnt); |
197 | pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n", | 197 | pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n", |
198 | priv->rx_stats.data_bytes); | 198 | il->rx_stats.data_bytes); |
199 | 199 | ||
200 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 200 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
201 | kfree(buf); | 201 | kfree(buf); |
@@ -214,28 +214,28 @@ static ssize_t il_dbgfs_sram_read(struct file *file, | |||
214 | ssize_t ret; | 214 | ssize_t ret; |
215 | int i; | 215 | int i; |
216 | int pos = 0; | 216 | int pos = 0; |
217 | struct il_priv *priv = file->private_data; | 217 | struct il_priv *il = file->private_data; |
218 | size_t bufsz; | 218 | size_t bufsz; |
219 | 219 | ||
220 | /* default is to dump the entire data segment */ | 220 | /* default is to dump the entire data segment */ |
221 | if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) { | 221 | if (!il->dbgfs_sram_offset && !il->dbgfs_sram_len) { |
222 | priv->dbgfs_sram_offset = 0x800000; | 222 | il->dbgfs_sram_offset = 0x800000; |
223 | if (priv->ucode_type == UCODE_INIT) | 223 | if (il->ucode_type == UCODE_INIT) |
224 | priv->dbgfs_sram_len = priv->ucode_init_data.len; | 224 | il->dbgfs_sram_len = il->ucode_init_data.len; |
225 | else | 225 | else |
226 | priv->dbgfs_sram_len = priv->ucode_data.len; | 226 | il->dbgfs_sram_len = il->ucode_data.len; |
227 | } | 227 | } |
228 | bufsz = 30 + priv->dbgfs_sram_len * sizeof(char) * 10; | 228 | bufsz = 30 + il->dbgfs_sram_len * sizeof(char) * 10; |
229 | buf = kmalloc(bufsz, GFP_KERNEL); | 229 | buf = kmalloc(bufsz, GFP_KERNEL); |
230 | if (!buf) | 230 | if (!buf) |
231 | return -ENOMEM; | 231 | return -ENOMEM; |
232 | pos += scnprintf(buf + pos, bufsz - pos, "sram_len: 0x%x\n", | 232 | pos += scnprintf(buf + pos, bufsz - pos, "sram_len: 0x%x\n", |
233 | priv->dbgfs_sram_len); | 233 | il->dbgfs_sram_len); |
234 | pos += scnprintf(buf + pos, bufsz - pos, "sram_offset: 0x%x\n", | 234 | pos += scnprintf(buf + pos, bufsz - pos, "sram_offset: 0x%x\n", |
235 | priv->dbgfs_sram_offset); | 235 | il->dbgfs_sram_offset); |
236 | for (i = priv->dbgfs_sram_len; i > 0; i -= 4) { | 236 | for (i = il->dbgfs_sram_len; i > 0; i -= 4) { |
237 | val = il_read_targ_mem(priv, priv->dbgfs_sram_offset + \ | 237 | val = il_read_targ_mem(il, il->dbgfs_sram_offset + \ |
238 | priv->dbgfs_sram_len - i); | 238 | il->dbgfs_sram_len - i); |
239 | if (i < 4) { | 239 | if (i < 4) { |
240 | switch (i) { | 240 | switch (i) { |
241 | case 1: | 241 | case 1: |
@@ -264,7 +264,7 @@ static ssize_t il_dbgfs_sram_write(struct file *file, | |||
264 | const char __user *user_buf, | 264 | const char __user *user_buf, |
265 | size_t count, loff_t *ppos) | 265 | size_t count, loff_t *ppos) |
266 | { | 266 | { |
267 | struct il_priv *priv = file->private_data; | 267 | struct il_priv *il = file->private_data; |
268 | char buf[64]; | 268 | char buf[64]; |
269 | int buf_size; | 269 | int buf_size; |
270 | u32 offset, len; | 270 | u32 offset, len; |
@@ -275,11 +275,11 @@ static ssize_t il_dbgfs_sram_write(struct file *file, | |||
275 | return -EFAULT; | 275 | return -EFAULT; |
276 | 276 | ||
277 | if (sscanf(buf, "%x,%x", &offset, &len) == 2) { | 277 | if (sscanf(buf, "%x,%x", &offset, &len) == 2) { |
278 | priv->dbgfs_sram_offset = offset; | 278 | il->dbgfs_sram_offset = offset; |
279 | priv->dbgfs_sram_len = len; | 279 | il->dbgfs_sram_len = len; |
280 | } else { | 280 | } else { |
281 | priv->dbgfs_sram_offset = 0; | 281 | il->dbgfs_sram_offset = 0; |
282 | priv->dbgfs_sram_len = 0; | 282 | il->dbgfs_sram_len = 0; |
283 | } | 283 | } |
284 | 284 | ||
285 | return count; | 285 | return count; |
@@ -289,24 +289,24 @@ static ssize_t | |||
289 | il_dbgfs_stations_read(struct file *file, char __user *user_buf, | 289 | il_dbgfs_stations_read(struct file *file, char __user *user_buf, |
290 | size_t count, loff_t *ppos) | 290 | size_t count, loff_t *ppos) |
291 | { | 291 | { |
292 | struct il_priv *priv = file->private_data; | 292 | struct il_priv *il = file->private_data; |
293 | struct il_station_entry *station; | 293 | struct il_station_entry *station; |
294 | int max_sta = priv->hw_params.max_stations; | 294 | int max_sta = il->hw_params.max_stations; |
295 | char *buf; | 295 | char *buf; |
296 | int i, j, pos = 0; | 296 | int i, j, pos = 0; |
297 | ssize_t ret; | 297 | ssize_t ret; |
298 | /* Add 30 for initial string */ | 298 | /* Add 30 for initial string */ |
299 | const size_t bufsz = 30 + sizeof(char) * 500 * (priv->num_stations); | 299 | const size_t bufsz = 30 + sizeof(char) * 500 * (il->num_stations); |
300 | 300 | ||
301 | buf = kmalloc(bufsz, GFP_KERNEL); | 301 | buf = kmalloc(bufsz, GFP_KERNEL); |
302 | if (!buf) | 302 | if (!buf) |
303 | return -ENOMEM; | 303 | return -ENOMEM; |
304 | 304 | ||
305 | pos += scnprintf(buf + pos, bufsz - pos, "num of stations: %d\n\n", | 305 | pos += scnprintf(buf + pos, bufsz - pos, "num of stations: %d\n\n", |
306 | priv->num_stations); | 306 | il->num_stations); |
307 | 307 | ||
308 | for (i = 0; i < max_sta; i++) { | 308 | for (i = 0; i < max_sta; i++) { |
309 | station = &priv->stations[i]; | 309 | station = &il->stations[i]; |
310 | if (!station->used) | 310 | if (!station->used) |
311 | continue; | 311 | continue; |
312 | pos += scnprintf(buf + pos, bufsz - pos, | 312 | pos += scnprintf(buf + pos, bufsz - pos, |
@@ -349,32 +349,32 @@ static ssize_t il_dbgfs_nvm_read(struct file *file, | |||
349 | loff_t *ppos) | 349 | loff_t *ppos) |
350 | { | 350 | { |
351 | ssize_t ret; | 351 | ssize_t ret; |
352 | struct il_priv *priv = file->private_data; | 352 | struct il_priv *il = file->private_data; |
353 | int pos = 0, ofs = 0, buf_size = 0; | 353 | int pos = 0, ofs = 0, buf_size = 0; |
354 | const u8 *ptr; | 354 | const u8 *ptr; |
355 | char *buf; | 355 | char *buf; |
356 | u16 eeprom_ver; | 356 | u16 eeprom_ver; |
357 | size_t eeprom_len = priv->cfg->base_params->eeprom_size; | 357 | size_t eeprom_len = il->cfg->base_params->eeprom_size; |
358 | buf_size = 4 * eeprom_len + 256; | 358 | buf_size = 4 * eeprom_len + 256; |
359 | 359 | ||
360 | if (eeprom_len % 16) { | 360 | if (eeprom_len % 16) { |
361 | IL_ERR(priv, "NVM size is not multiple of 16.\n"); | 361 | IL_ERR(il, "NVM size is not multiple of 16.\n"); |
362 | return -ENODATA; | 362 | return -ENODATA; |
363 | } | 363 | } |
364 | 364 | ||
365 | ptr = priv->eeprom; | 365 | ptr = il->eeprom; |
366 | if (!ptr) { | 366 | if (!ptr) { |
367 | IL_ERR(priv, "Invalid EEPROM memory\n"); | 367 | IL_ERR(il, "Invalid EEPROM memory\n"); |
368 | return -ENOMEM; | 368 | return -ENOMEM; |
369 | } | 369 | } |
370 | 370 | ||
371 | /* 4 characters for byte 0xYY */ | 371 | /* 4 characters for byte 0xYY */ |
372 | buf = kzalloc(buf_size, GFP_KERNEL); | 372 | buf = kzalloc(buf_size, GFP_KERNEL); |
373 | if (!buf) { | 373 | if (!buf) { |
374 | IL_ERR(priv, "Can not allocate Buffer\n"); | 374 | IL_ERR(il, "Can not allocate Buffer\n"); |
375 | return -ENOMEM; | 375 | return -ENOMEM; |
376 | } | 376 | } |
377 | eeprom_ver = il_eeprom_query16(priv, EEPROM_VERSION); | 377 | eeprom_ver = il_eeprom_query16(il, EEPROM_VERSION); |
378 | pos += scnprintf(buf + pos, buf_size - pos, "EEPROM " | 378 | pos += scnprintf(buf + pos, buf_size - pos, "EEPROM " |
379 | "version: 0x%x\n", eeprom_ver); | 379 | "version: 0x%x\n", eeprom_ver); |
380 | for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) { | 380 | for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) { |
@@ -395,23 +395,23 @@ static ssize_t | |||
395 | il_dbgfs_channels_read(struct file *file, char __user *user_buf, | 395 | il_dbgfs_channels_read(struct file *file, char __user *user_buf, |
396 | size_t count, loff_t *ppos) | 396 | size_t count, loff_t *ppos) |
397 | { | 397 | { |
398 | struct il_priv *priv = file->private_data; | 398 | struct il_priv *il = file->private_data; |
399 | struct ieee80211_channel *channels = NULL; | 399 | struct ieee80211_channel *channels = NULL; |
400 | const struct ieee80211_supported_band *supp_band = NULL; | 400 | const struct ieee80211_supported_band *supp_band = NULL; |
401 | int pos = 0, i, bufsz = PAGE_SIZE; | 401 | int pos = 0, i, bufsz = PAGE_SIZE; |
402 | char *buf; | 402 | char *buf; |
403 | ssize_t ret; | 403 | ssize_t ret; |
404 | 404 | ||
405 | if (!test_bit(STATUS_GEO_CONFIGURED, &priv->status)) | 405 | if (!test_bit(STATUS_GEO_CONFIGURED, &il->status)) |
406 | return -EAGAIN; | 406 | return -EAGAIN; |
407 | 407 | ||
408 | buf = kzalloc(bufsz, GFP_KERNEL); | 408 | buf = kzalloc(bufsz, GFP_KERNEL); |
409 | if (!buf) { | 409 | if (!buf) { |
410 | IL_ERR(priv, "Can not allocate Buffer\n"); | 410 | IL_ERR(il, "Can not allocate Buffer\n"); |
411 | return -ENOMEM; | 411 | return -ENOMEM; |
412 | } | 412 | } |
413 | 413 | ||
414 | supp_band = il_get_hw_mode(priv, IEEE80211_BAND_2GHZ); | 414 | supp_band = il_get_hw_mode(il, IEEE80211_BAND_2GHZ); |
415 | if (supp_band) { | 415 | if (supp_band) { |
416 | channels = supp_band->channels; | 416 | channels = supp_band->channels; |
417 | 417 | ||
@@ -434,7 +434,7 @@ il_dbgfs_channels_read(struct file *file, char __user *user_buf, | |||
434 | IEEE80211_CHAN_PASSIVE_SCAN ? | 434 | IEEE80211_CHAN_PASSIVE_SCAN ? |
435 | "passive only" : "active/passive"); | 435 | "passive only" : "active/passive"); |
436 | } | 436 | } |
437 | supp_band = il_get_hw_mode(priv, IEEE80211_BAND_5GHZ); | 437 | supp_band = il_get_hw_mode(il, IEEE80211_BAND_5GHZ); |
438 | if (supp_band) { | 438 | if (supp_band) { |
439 | channels = supp_band->channels; | 439 | channels = supp_band->channels; |
440 | 440 | ||
@@ -466,43 +466,43 @@ static ssize_t il_dbgfs_status_read(struct file *file, | |||
466 | char __user *user_buf, | 466 | char __user *user_buf, |
467 | size_t count, loff_t *ppos) { | 467 | size_t count, loff_t *ppos) { |
468 | 468 | ||
469 | struct il_priv *priv = file->private_data; | 469 | struct il_priv *il = file->private_data; |
470 | char buf[512]; | 470 | char buf[512]; |
471 | int pos = 0; | 471 | int pos = 0; |
472 | const size_t bufsz = sizeof(buf); | 472 | const size_t bufsz = sizeof(buf); |
473 | 473 | ||
474 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_HCMD_ACTIVE:\t %d\n", | 474 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_HCMD_ACTIVE:\t %d\n", |
475 | test_bit(STATUS_HCMD_ACTIVE, &priv->status)); | 475 | test_bit(STATUS_HCMD_ACTIVE, &il->status)); |
476 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INT_ENABLED:\t %d\n", | 476 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INT_ENABLED:\t %d\n", |
477 | test_bit(STATUS_INT_ENABLED, &priv->status)); | 477 | test_bit(STATUS_INT_ENABLED, &il->status)); |
478 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n", | 478 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n", |
479 | test_bit(STATUS_RF_KILL_HW, &priv->status)); | 479 | test_bit(STATUS_RF_KILL_HW, &il->status)); |
480 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_CT_KILL:\t\t %d\n", | 480 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_CT_KILL:\t\t %d\n", |
481 | test_bit(STATUS_CT_KILL, &priv->status)); | 481 | test_bit(STATUS_CT_KILL, &il->status)); |
482 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INIT:\t\t %d\n", | 482 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INIT:\t\t %d\n", |
483 | test_bit(STATUS_INIT, &priv->status)); | 483 | test_bit(STATUS_INIT, &il->status)); |
484 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_ALIVE:\t\t %d\n", | 484 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_ALIVE:\t\t %d\n", |
485 | test_bit(STATUS_ALIVE, &priv->status)); | 485 | test_bit(STATUS_ALIVE, &il->status)); |
486 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_READY:\t\t %d\n", | 486 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_READY:\t\t %d\n", |
487 | test_bit(STATUS_READY, &priv->status)); | 487 | test_bit(STATUS_READY, &il->status)); |
488 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_TEMPERATURE:\t %d\n", | 488 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_TEMPERATURE:\t %d\n", |
489 | test_bit(STATUS_TEMPERATURE, &priv->status)); | 489 | test_bit(STATUS_TEMPERATURE, &il->status)); |
490 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_GEO_CONFIGURED:\t %d\n", | 490 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_GEO_CONFIGURED:\t %d\n", |
491 | test_bit(STATUS_GEO_CONFIGURED, &priv->status)); | 491 | test_bit(STATUS_GEO_CONFIGURED, &il->status)); |
492 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_EXIT_PENDING:\t %d\n", | 492 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_EXIT_PENDING:\t %d\n", |
493 | test_bit(STATUS_EXIT_PENDING, &priv->status)); | 493 | test_bit(STATUS_EXIT_PENDING, &il->status)); |
494 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_STATISTICS:\t %d\n", | 494 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_STATISTICS:\t %d\n", |
495 | test_bit(STATUS_STATISTICS, &priv->status)); | 495 | test_bit(STATUS_STATISTICS, &il->status)); |
496 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCANNING:\t %d\n", | 496 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCANNING:\t %d\n", |
497 | test_bit(STATUS_SCANNING, &priv->status)); | 497 | test_bit(STATUS_SCANNING, &il->status)); |
498 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_ABORTING:\t %d\n", | 498 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_ABORTING:\t %d\n", |
499 | test_bit(STATUS_SCAN_ABORTING, &priv->status)); | 499 | test_bit(STATUS_SCAN_ABORTING, &il->status)); |
500 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_HW:\t\t %d\n", | 500 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_HW:\t\t %d\n", |
501 | test_bit(STATUS_SCAN_HW, &priv->status)); | 501 | test_bit(STATUS_SCAN_HW, &il->status)); |
502 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_POWER_PMI:\t %d\n", | 502 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_POWER_PMI:\t %d\n", |
503 | test_bit(STATUS_POWER_PMI, &priv->status)); | 503 | test_bit(STATUS_POWER_PMI, &il->status)); |
504 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_FW_ERROR:\t %d\n", | 504 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_FW_ERROR:\t %d\n", |
505 | test_bit(STATUS_FW_ERROR, &priv->status)); | 505 | test_bit(STATUS_FW_ERROR, &il->status)); |
506 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 506 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
507 | } | 507 | } |
508 | 508 | ||
@@ -510,7 +510,7 @@ static ssize_t il_dbgfs_interrupt_read(struct file *file, | |||
510 | char __user *user_buf, | 510 | char __user *user_buf, |
511 | size_t count, loff_t *ppos) { | 511 | size_t count, loff_t *ppos) { |
512 | 512 | ||
513 | struct il_priv *priv = file->private_data; | 513 | struct il_priv *il = file->private_data; |
514 | int pos = 0; | 514 | int pos = 0; |
515 | int cnt = 0; | 515 | int cnt = 0; |
516 | char *buf; | 516 | char *buf; |
@@ -519,7 +519,7 @@ static ssize_t il_dbgfs_interrupt_read(struct file *file, | |||
519 | 519 | ||
520 | buf = kzalloc(bufsz, GFP_KERNEL); | 520 | buf = kzalloc(bufsz, GFP_KERNEL); |
521 | if (!buf) { | 521 | if (!buf) { |
522 | IL_ERR(priv, "Can not allocate Buffer\n"); | 522 | IL_ERR(il, "Can not allocate Buffer\n"); |
523 | return -ENOMEM; | 523 | return -ENOMEM; |
524 | } | 524 | } |
525 | 525 | ||
@@ -527,46 +527,46 @@ static ssize_t il_dbgfs_interrupt_read(struct file *file, | |||
527 | "Interrupt Statistics Report:\n"); | 527 | "Interrupt Statistics Report:\n"); |
528 | 528 | ||
529 | pos += scnprintf(buf + pos, bufsz - pos, "HW Error:\t\t\t %u\n", | 529 | pos += scnprintf(buf + pos, bufsz - pos, "HW Error:\t\t\t %u\n", |
530 | priv->isr_stats.hw); | 530 | il->isr_stats.hw); |
531 | pos += scnprintf(buf + pos, bufsz - pos, "SW Error:\t\t\t %u\n", | 531 | pos += scnprintf(buf + pos, bufsz - pos, "SW Error:\t\t\t %u\n", |
532 | priv->isr_stats.sw); | 532 | il->isr_stats.sw); |
533 | if (priv->isr_stats.sw || priv->isr_stats.hw) { | 533 | if (il->isr_stats.sw || il->isr_stats.hw) { |
534 | pos += scnprintf(buf + pos, bufsz - pos, | 534 | pos += scnprintf(buf + pos, bufsz - pos, |
535 | "\tLast Restarting Code: 0x%X\n", | 535 | "\tLast Restarting Code: 0x%X\n", |
536 | priv->isr_stats.err_code); | 536 | il->isr_stats.err_code); |
537 | } | 537 | } |
538 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 538 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
539 | pos += scnprintf(buf + pos, bufsz - pos, "Frame transmitted:\t\t %u\n", | 539 | pos += scnprintf(buf + pos, bufsz - pos, "Frame transmitted:\t\t %u\n", |
540 | priv->isr_stats.sch); | 540 | il->isr_stats.sch); |
541 | pos += scnprintf(buf + pos, bufsz - pos, "Alive interrupt:\t\t %u\n", | 541 | pos += scnprintf(buf + pos, bufsz - pos, "Alive interrupt:\t\t %u\n", |
542 | priv->isr_stats.alive); | 542 | il->isr_stats.alive); |
543 | #endif | 543 | #endif |
544 | pos += scnprintf(buf + pos, bufsz - pos, | 544 | pos += scnprintf(buf + pos, bufsz - pos, |
545 | "HW RF KILL switch toggled:\t %u\n", | 545 | "HW RF KILL switch toggled:\t %u\n", |
546 | priv->isr_stats.rfkill); | 546 | il->isr_stats.rfkill); |
547 | 547 | ||
548 | pos += scnprintf(buf + pos, bufsz - pos, "CT KILL:\t\t\t %u\n", | 548 | pos += scnprintf(buf + pos, bufsz - pos, "CT KILL:\t\t\t %u\n", |
549 | priv->isr_stats.ctkill); | 549 | il->isr_stats.ctkill); |
550 | 550 | ||
551 | pos += scnprintf(buf + pos, bufsz - pos, "Wakeup Interrupt:\t\t %u\n", | 551 | pos += scnprintf(buf + pos, bufsz - pos, "Wakeup Interrupt:\t\t %u\n", |
552 | priv->isr_stats.wakeup); | 552 | il->isr_stats.wakeup); |
553 | 553 | ||
554 | pos += scnprintf(buf + pos, bufsz - pos, | 554 | pos += scnprintf(buf + pos, bufsz - pos, |
555 | "Rx command responses:\t\t %u\n", | 555 | "Rx command responses:\t\t %u\n", |
556 | priv->isr_stats.rx); | 556 | il->isr_stats.rx); |
557 | for (cnt = 0; cnt < REPLY_MAX; cnt++) { | 557 | for (cnt = 0; cnt < REPLY_MAX; cnt++) { |
558 | if (priv->isr_stats.rx_handlers[cnt] > 0) | 558 | if (il->isr_stats.rx_handlers[cnt] > 0) |
559 | pos += scnprintf(buf + pos, bufsz - pos, | 559 | pos += scnprintf(buf + pos, bufsz - pos, |
560 | "\tRx handler[%36s]:\t\t %u\n", | 560 | "\tRx handler[%36s]:\t\t %u\n", |
561 | il_get_cmd_string(cnt), | 561 | il_get_cmd_string(cnt), |
562 | priv->isr_stats.rx_handlers[cnt]); | 562 | il->isr_stats.rx_handlers[cnt]); |
563 | } | 563 | } |
564 | 564 | ||
565 | pos += scnprintf(buf + pos, bufsz - pos, "Tx/FH interrupt:\t\t %u\n", | 565 | pos += scnprintf(buf + pos, bufsz - pos, "Tx/FH interrupt:\t\t %u\n", |
566 | priv->isr_stats.tx); | 566 | il->isr_stats.tx); |
567 | 567 | ||
568 | pos += scnprintf(buf + pos, bufsz - pos, "Unexpected INTA:\t\t %u\n", | 568 | pos += scnprintf(buf + pos, bufsz - pos, "Unexpected INTA:\t\t %u\n", |
569 | priv->isr_stats.unhandled); | 569 | il->isr_stats.unhandled); |
570 | 570 | ||
571 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 571 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
572 | kfree(buf); | 572 | kfree(buf); |
@@ -577,7 +577,7 @@ static ssize_t il_dbgfs_interrupt_write(struct file *file, | |||
577 | const char __user *user_buf, | 577 | const char __user *user_buf, |
578 | size_t count, loff_t *ppos) | 578 | size_t count, loff_t *ppos) |
579 | { | 579 | { |
580 | struct il_priv *priv = file->private_data; | 580 | struct il_priv *il = file->private_data; |
581 | char buf[8]; | 581 | char buf[8]; |
582 | int buf_size; | 582 | int buf_size; |
583 | u32 reset_flag; | 583 | u32 reset_flag; |
@@ -589,7 +589,7 @@ static ssize_t il_dbgfs_interrupt_write(struct file *file, | |||
589 | if (sscanf(buf, "%x", &reset_flag) != 1) | 589 | if (sscanf(buf, "%x", &reset_flag) != 1) |
590 | return -EFAULT; | 590 | return -EFAULT; |
591 | if (reset_flag == 0) | 591 | if (reset_flag == 0) |
592 | il_clear_isr_stats(priv); | 592 | il_clear_isr_stats(il); |
593 | 593 | ||
594 | return count; | 594 | return count; |
595 | } | 595 | } |
@@ -598,13 +598,13 @@ static ssize_t | |||
598 | il_dbgfs_qos_read(struct file *file, char __user *user_buf, | 598 | il_dbgfs_qos_read(struct file *file, char __user *user_buf, |
599 | size_t count, loff_t *ppos) | 599 | size_t count, loff_t *ppos) |
600 | { | 600 | { |
601 | struct il_priv *priv = file->private_data; | 601 | struct il_priv *il = file->private_data; |
602 | struct il_rxon_context *ctx; | 602 | struct il_rxon_context *ctx; |
603 | int pos = 0, i; | 603 | int pos = 0, i; |
604 | char buf[256 * NUM_IL_RXON_CTX]; | 604 | char buf[256 * NUM_IL_RXON_CTX]; |
605 | const size_t bufsz = sizeof(buf); | 605 | const size_t bufsz = sizeof(buf); |
606 | 606 | ||
607 | for_each_context(priv, ctx) { | 607 | for_each_context(il, ctx) { |
608 | pos += scnprintf(buf + pos, bufsz - pos, "context %d:\n", | 608 | pos += scnprintf(buf + pos, bufsz - pos, "context %d:\n", |
609 | ctx->ctxid); | 609 | ctx->ctxid); |
610 | for (i = 0; i < AC_NUM; i++) { | 610 | for (i = 0; i < AC_NUM; i++) { |
@@ -626,7 +626,7 @@ static ssize_t il_dbgfs_disable_ht40_write(struct file *file, | |||
626 | const char __user *user_buf, | 626 | const char __user *user_buf, |
627 | size_t count, loff_t *ppos) | 627 | size_t count, loff_t *ppos) |
628 | { | 628 | { |
629 | struct il_priv *priv = file->private_data; | 629 | struct il_priv *il = file->private_data; |
630 | char buf[8]; | 630 | char buf[8]; |
631 | int buf_size; | 631 | int buf_size; |
632 | int ht40; | 632 | int ht40; |
@@ -637,10 +637,10 @@ static ssize_t il_dbgfs_disable_ht40_write(struct file *file, | |||
637 | return -EFAULT; | 637 | return -EFAULT; |
638 | if (sscanf(buf, "%d", &ht40) != 1) | 638 | if (sscanf(buf, "%d", &ht40) != 1) |
639 | return -EFAULT; | 639 | return -EFAULT; |
640 | if (!il_is_any_associated(priv)) | 640 | if (!il_is_any_associated(il)) |
641 | priv->disable_ht40 = ht40 ? true : false; | 641 | il->disable_ht40 = ht40 ? true : false; |
642 | else { | 642 | else { |
643 | IL_ERR(priv, "Sta associated with AP - " | 643 | IL_ERR(il, "Sta associated with AP - " |
644 | "Change to 40MHz channel support is not allowed\n"); | 644 | "Change to 40MHz channel support is not allowed\n"); |
645 | return -EINVAL; | 645 | return -EINVAL; |
646 | } | 646 | } |
@@ -652,14 +652,14 @@ static ssize_t il_dbgfs_disable_ht40_read(struct file *file, | |||
652 | char __user *user_buf, | 652 | char __user *user_buf, |
653 | size_t count, loff_t *ppos) | 653 | size_t count, loff_t *ppos) |
654 | { | 654 | { |
655 | struct il_priv *priv = file->private_data; | 655 | struct il_priv *il = file->private_data; |
656 | char buf[100]; | 656 | char buf[100]; |
657 | int pos = 0; | 657 | int pos = 0; |
658 | const size_t bufsz = sizeof(buf); | 658 | const size_t bufsz = sizeof(buf); |
659 | 659 | ||
660 | pos += scnprintf(buf + pos, bufsz - pos, | 660 | pos += scnprintf(buf + pos, bufsz - pos, |
661 | "11n 40MHz Mode: %s\n", | 661 | "11n 40MHz Mode: %s\n", |
662 | priv->disable_ht40 ? "Disabled" : "Enabled"); | 662 | il->disable_ht40 ? "Disabled" : "Enabled"); |
663 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 663 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
664 | } | 664 | } |
665 | 665 | ||
@@ -676,39 +676,39 @@ static ssize_t il_dbgfs_traffic_log_read(struct file *file, | |||
676 | char __user *user_buf, | 676 | char __user *user_buf, |
677 | size_t count, loff_t *ppos) | 677 | size_t count, loff_t *ppos) |
678 | { | 678 | { |
679 | struct il_priv *priv = file->private_data; | 679 | struct il_priv *il = file->private_data; |
680 | int pos = 0, ofs = 0; | 680 | int pos = 0, ofs = 0; |
681 | int cnt = 0, entry; | 681 | int cnt = 0, entry; |
682 | struct il_tx_queue *txq; | 682 | struct il_tx_queue *txq; |
683 | struct il_queue *q; | 683 | struct il_queue *q; |
684 | struct il_rx_queue *rxq = &priv->rxq; | 684 | struct il_rx_queue *rxq = &il->rxq; |
685 | char *buf; | 685 | char *buf; |
686 | int bufsz = ((IL_TRAFFIC_ENTRIES * IL_TRAFFIC_ENTRY_SIZE * 64) * 2) + | 686 | int bufsz = ((IL_TRAFFIC_ENTRIES * IL_TRAFFIC_ENTRY_SIZE * 64) * 2) + |
687 | (priv->cfg->base_params->num_of_queues * 32 * 8) + 400; | 687 | (il->cfg->base_params->num_of_queues * 32 * 8) + 400; |
688 | const u8 *ptr; | 688 | const u8 *ptr; |
689 | ssize_t ret; | 689 | ssize_t ret; |
690 | 690 | ||
691 | if (!priv->txq) { | 691 | if (!il->txq) { |
692 | IL_ERR(priv, "txq not ready\n"); | 692 | IL_ERR(il, "txq not ready\n"); |
693 | return -EAGAIN; | 693 | return -EAGAIN; |
694 | } | 694 | } |
695 | buf = kzalloc(bufsz, GFP_KERNEL); | 695 | buf = kzalloc(bufsz, GFP_KERNEL); |
696 | if (!buf) { | 696 | if (!buf) { |
697 | IL_ERR(priv, "Can not allocate buffer\n"); | 697 | IL_ERR(il, "Can not allocate buffer\n"); |
698 | return -ENOMEM; | 698 | return -ENOMEM; |
699 | } | 699 | } |
700 | pos += scnprintf(buf + pos, bufsz - pos, "Tx Queue\n"); | 700 | pos += scnprintf(buf + pos, bufsz - pos, "Tx Queue\n"); |
701 | for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) { | 701 | for (cnt = 0; cnt < il->hw_params.max_txq_num; cnt++) { |
702 | txq = &priv->txq[cnt]; | 702 | txq = &il->txq[cnt]; |
703 | q = &txq->q; | 703 | q = &txq->q; |
704 | pos += scnprintf(buf + pos, bufsz - pos, | 704 | pos += scnprintf(buf + pos, bufsz - pos, |
705 | "q[%d]: read_ptr: %u, write_ptr: %u\n", | 705 | "q[%d]: read_ptr: %u, write_ptr: %u\n", |
706 | cnt, q->read_ptr, q->write_ptr); | 706 | cnt, q->read_ptr, q->write_ptr); |
707 | } | 707 | } |
708 | if (priv->tx_traffic && (iwlegacy_debug_level & IL_DL_TX)) { | 708 | if (il->tx_traffic && (iwlegacy_debug_level & IL_DL_TX)) { |
709 | ptr = priv->tx_traffic; | 709 | ptr = il->tx_traffic; |
710 | pos += scnprintf(buf + pos, bufsz - pos, | 710 | pos += scnprintf(buf + pos, bufsz - pos, |
711 | "Tx Traffic idx: %u\n", priv->tx_traffic_idx); | 711 | "Tx Traffic idx: %u\n", il->tx_traffic_idx); |
712 | for (cnt = 0, ofs = 0; cnt < IL_TRAFFIC_ENTRIES; cnt++) { | 712 | for (cnt = 0, ofs = 0; cnt < IL_TRAFFIC_ENTRIES; cnt++) { |
713 | for (entry = 0; entry < IL_TRAFFIC_ENTRY_SIZE / 16; | 713 | for (entry = 0; entry < IL_TRAFFIC_ENTRY_SIZE / 16; |
714 | entry++, ofs += 16) { | 714 | entry++, ofs += 16) { |
@@ -728,10 +728,10 @@ static ssize_t il_dbgfs_traffic_log_read(struct file *file, | |||
728 | "read: %u, write: %u\n", | 728 | "read: %u, write: %u\n", |
729 | rxq->read, rxq->write); | 729 | rxq->read, rxq->write); |
730 | 730 | ||
731 | if (priv->rx_traffic && (iwlegacy_debug_level & IL_DL_RX)) { | 731 | if (il->rx_traffic && (iwlegacy_debug_level & IL_DL_RX)) { |
732 | ptr = priv->rx_traffic; | 732 | ptr = il->rx_traffic; |
733 | pos += scnprintf(buf + pos, bufsz - pos, | 733 | pos += scnprintf(buf + pos, bufsz - pos, |
734 | "Rx Traffic idx: %u\n", priv->rx_traffic_idx); | 734 | "Rx Traffic idx: %u\n", il->rx_traffic_idx); |
735 | for (cnt = 0, ofs = 0; cnt < IL_TRAFFIC_ENTRIES; cnt++) { | 735 | for (cnt = 0, ofs = 0; cnt < IL_TRAFFIC_ENTRIES; cnt++) { |
736 | for (entry = 0; entry < IL_TRAFFIC_ENTRY_SIZE / 16; | 736 | for (entry = 0; entry < IL_TRAFFIC_ENTRY_SIZE / 16; |
737 | entry++, ofs += 16) { | 737 | entry++, ofs += 16) { |
@@ -755,7 +755,7 @@ static ssize_t il_dbgfs_traffic_log_write(struct file *file, | |||
755 | const char __user *user_buf, | 755 | const char __user *user_buf, |
756 | size_t count, loff_t *ppos) | 756 | size_t count, loff_t *ppos) |
757 | { | 757 | { |
758 | struct il_priv *priv = file->private_data; | 758 | struct il_priv *il = file->private_data; |
759 | char buf[8]; | 759 | char buf[8]; |
760 | int buf_size; | 760 | int buf_size; |
761 | int traffic_log; | 761 | int traffic_log; |
@@ -767,7 +767,7 @@ static ssize_t il_dbgfs_traffic_log_write(struct file *file, | |||
767 | if (sscanf(buf, "%d", &traffic_log) != 1) | 767 | if (sscanf(buf, "%d", &traffic_log) != 1) |
768 | return -EFAULT; | 768 | return -EFAULT; |
769 | if (traffic_log == 0) | 769 | if (traffic_log == 0) |
770 | il_reset_traffic_log(priv); | 770 | il_reset_traffic_log(il); |
771 | 771 | ||
772 | return count; | 772 | return count; |
773 | } | 773 | } |
@@ -776,7 +776,7 @@ static ssize_t il_dbgfs_tx_queue_read(struct file *file, | |||
776 | char __user *user_buf, | 776 | char __user *user_buf, |
777 | size_t count, loff_t *ppos) { | 777 | size_t count, loff_t *ppos) { |
778 | 778 | ||
779 | struct il_priv *priv = file->private_data; | 779 | struct il_priv *il = file->private_data; |
780 | struct il_tx_queue *txq; | 780 | struct il_tx_queue *txq; |
781 | struct il_queue *q; | 781 | struct il_queue *q; |
782 | char *buf; | 782 | char *buf; |
@@ -784,24 +784,24 @@ static ssize_t il_dbgfs_tx_queue_read(struct file *file, | |||
784 | int cnt; | 784 | int cnt; |
785 | int ret; | 785 | int ret; |
786 | const size_t bufsz = sizeof(char) * 64 * | 786 | const size_t bufsz = sizeof(char) * 64 * |
787 | priv->cfg->base_params->num_of_queues; | 787 | il->cfg->base_params->num_of_queues; |
788 | 788 | ||
789 | if (!priv->txq) { | 789 | if (!il->txq) { |
790 | IL_ERR(priv, "txq not ready\n"); | 790 | IL_ERR(il, "txq not ready\n"); |
791 | return -EAGAIN; | 791 | return -EAGAIN; |
792 | } | 792 | } |
793 | buf = kzalloc(bufsz, GFP_KERNEL); | 793 | buf = kzalloc(bufsz, GFP_KERNEL); |
794 | if (!buf) | 794 | if (!buf) |
795 | return -ENOMEM; | 795 | return -ENOMEM; |
796 | 796 | ||
797 | for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) { | 797 | for (cnt = 0; cnt < il->hw_params.max_txq_num; cnt++) { |
798 | txq = &priv->txq[cnt]; | 798 | txq = &il->txq[cnt]; |
799 | q = &txq->q; | 799 | q = &txq->q; |
800 | pos += scnprintf(buf + pos, bufsz - pos, | 800 | pos += scnprintf(buf + pos, bufsz - pos, |
801 | "hwq %.2d: read=%u write=%u stop=%d" | 801 | "hwq %.2d: read=%u write=%u stop=%d" |
802 | " swq_id=%#.2x (ac %d/hwq %d)\n", | 802 | " swq_id=%#.2x (ac %d/hwq %d)\n", |
803 | cnt, q->read_ptr, q->write_ptr, | 803 | cnt, q->read_ptr, q->write_ptr, |
804 | !!test_bit(cnt, priv->queue_stopped), | 804 | !!test_bit(cnt, il->queue_stopped), |
805 | txq->swq_id, txq->swq_id & 3, | 805 | txq->swq_id, txq->swq_id & 3, |
806 | (txq->swq_id >> 2) & 0x1f); | 806 | (txq->swq_id >> 2) & 0x1f); |
807 | if (cnt >= 4) | 807 | if (cnt >= 4) |
@@ -809,7 +809,7 @@ static ssize_t il_dbgfs_tx_queue_read(struct file *file, | |||
809 | /* for the ACs, display the stop count too */ | 809 | /* for the ACs, display the stop count too */ |
810 | pos += scnprintf(buf + pos, bufsz - pos, | 810 | pos += scnprintf(buf + pos, bufsz - pos, |
811 | " stop-count: %d\n", | 811 | " stop-count: %d\n", |
812 | atomic_read(&priv->queue_stop_count[cnt])); | 812 | atomic_read(&il->queue_stop_count[cnt])); |
813 | } | 813 | } |
814 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 814 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
815 | kfree(buf); | 815 | kfree(buf); |
@@ -820,8 +820,8 @@ static ssize_t il_dbgfs_rx_queue_read(struct file *file, | |||
820 | char __user *user_buf, | 820 | char __user *user_buf, |
821 | size_t count, loff_t *ppos) { | 821 | size_t count, loff_t *ppos) { |
822 | 822 | ||
823 | struct il_priv *priv = file->private_data; | 823 | struct il_priv *il = file->private_data; |
824 | struct il_rx_queue *rxq = &priv->rxq; | 824 | struct il_rx_queue *rxq = &il->rxq; |
825 | char buf[256]; | 825 | char buf[256]; |
826 | int pos = 0; | 826 | int pos = 0; |
827 | const size_t bufsz = sizeof(buf); | 827 | const size_t bufsz = sizeof(buf); |
@@ -846,8 +846,8 @@ static ssize_t il_dbgfs_ucode_rx_stats_read(struct file *file, | |||
846 | char __user *user_buf, | 846 | char __user *user_buf, |
847 | size_t count, loff_t *ppos) | 847 | size_t count, loff_t *ppos) |
848 | { | 848 | { |
849 | struct il_priv *priv = file->private_data; | 849 | struct il_priv *il = file->private_data; |
850 | return priv->cfg->ops->lib->debugfs_ops.rx_stats_read(file, | 850 | return il->cfg->ops->lib->debugfs_ops.rx_stats_read(file, |
851 | user_buf, count, ppos); | 851 | user_buf, count, ppos); |
852 | } | 852 | } |
853 | 853 | ||
@@ -855,8 +855,8 @@ static ssize_t il_dbgfs_ucode_tx_stats_read(struct file *file, | |||
855 | char __user *user_buf, | 855 | char __user *user_buf, |
856 | size_t count, loff_t *ppos) | 856 | size_t count, loff_t *ppos) |
857 | { | 857 | { |
858 | struct il_priv *priv = file->private_data; | 858 | struct il_priv *il = file->private_data; |
859 | return priv->cfg->ops->lib->debugfs_ops.tx_stats_read(file, | 859 | return il->cfg->ops->lib->debugfs_ops.tx_stats_read(file, |
860 | user_buf, count, ppos); | 860 | user_buf, count, ppos); |
861 | } | 861 | } |
862 | 862 | ||
@@ -864,8 +864,8 @@ static ssize_t il_dbgfs_ucode_general_stats_read(struct file *file, | |||
864 | char __user *user_buf, | 864 | char __user *user_buf, |
865 | size_t count, loff_t *ppos) | 865 | size_t count, loff_t *ppos) |
866 | { | 866 | { |
867 | struct il_priv *priv = file->private_data; | 867 | struct il_priv *il = file->private_data; |
868 | return priv->cfg->ops->lib->debugfs_ops.general_stats_read(file, | 868 | return il->cfg->ops->lib->debugfs_ops.general_stats_read(file, |
869 | user_buf, count, ppos); | 869 | user_buf, count, ppos); |
870 | } | 870 | } |
871 | 871 | ||
@@ -873,7 +873,7 @@ static ssize_t il_dbgfs_sensitivity_read(struct file *file, | |||
873 | char __user *user_buf, | 873 | char __user *user_buf, |
874 | size_t count, loff_t *ppos) { | 874 | size_t count, loff_t *ppos) { |
875 | 875 | ||
876 | struct il_priv *priv = file->private_data; | 876 | struct il_priv *il = file->private_data; |
877 | int pos = 0; | 877 | int pos = 0; |
878 | int cnt = 0; | 878 | int cnt = 0; |
879 | char *buf; | 879 | char *buf; |
@@ -881,10 +881,10 @@ static ssize_t il_dbgfs_sensitivity_read(struct file *file, | |||
881 | ssize_t ret; | 881 | ssize_t ret; |
882 | struct il_sensitivity_data *data; | 882 | struct il_sensitivity_data *data; |
883 | 883 | ||
884 | data = &priv->sensitivity_data; | 884 | data = &il->sensitivity_data; |
885 | buf = kzalloc(bufsz, GFP_KERNEL); | 885 | buf = kzalloc(bufsz, GFP_KERNEL); |
886 | if (!buf) { | 886 | if (!buf) { |
887 | IL_ERR(priv, "Can not allocate Buffer\n"); | 887 | IL_ERR(il, "Can not allocate Buffer\n"); |
888 | return -ENOMEM; | 888 | return -ENOMEM; |
889 | } | 889 | } |
890 | 890 | ||
@@ -954,7 +954,7 @@ static ssize_t il_dbgfs_chain_noise_read(struct file *file, | |||
954 | char __user *user_buf, | 954 | char __user *user_buf, |
955 | size_t count, loff_t *ppos) { | 955 | size_t count, loff_t *ppos) { |
956 | 956 | ||
957 | struct il_priv *priv = file->private_data; | 957 | struct il_priv *il = file->private_data; |
958 | int pos = 0; | 958 | int pos = 0; |
959 | int cnt = 0; | 959 | int cnt = 0; |
960 | char *buf; | 960 | char *buf; |
@@ -962,10 +962,10 @@ static ssize_t il_dbgfs_chain_noise_read(struct file *file, | |||
962 | ssize_t ret; | 962 | ssize_t ret; |
963 | struct il_chain_noise_data *data; | 963 | struct il_chain_noise_data *data; |
964 | 964 | ||
965 | data = &priv->chain_noise_data; | 965 | data = &il->chain_noise_data; |
966 | buf = kzalloc(bufsz, GFP_KERNEL); | 966 | buf = kzalloc(bufsz, GFP_KERNEL); |
967 | if (!buf) { | 967 | if (!buf) { |
968 | IL_ERR(priv, "Can not allocate Buffer\n"); | 968 | IL_ERR(il, "Can not allocate Buffer\n"); |
969 | return -ENOMEM; | 969 | return -ENOMEM; |
970 | } | 970 | } |
971 | 971 | ||
@@ -1012,13 +1012,13 @@ static ssize_t il_dbgfs_power_save_status_read(struct file *file, | |||
1012 | char __user *user_buf, | 1012 | char __user *user_buf, |
1013 | size_t count, loff_t *ppos) | 1013 | size_t count, loff_t *ppos) |
1014 | { | 1014 | { |
1015 | struct il_priv *priv = file->private_data; | 1015 | struct il_priv *il = file->private_data; |
1016 | char buf[60]; | 1016 | char buf[60]; |
1017 | int pos = 0; | 1017 | int pos = 0; |
1018 | const size_t bufsz = sizeof(buf); | 1018 | const size_t bufsz = sizeof(buf); |
1019 | u32 pwrsave_status; | 1019 | u32 pwrsave_status; |
1020 | 1020 | ||
1021 | pwrsave_status = il_read32(priv, CSR_GP_CNTRL) & | 1021 | pwrsave_status = il_read32(il, CSR_GP_CNTRL) & |
1022 | CSR_GP_REG_POWER_SAVE_STATUS_MSK; | 1022 | CSR_GP_REG_POWER_SAVE_STATUS_MSK; |
1023 | 1023 | ||
1024 | pos += scnprintf(buf + pos, bufsz - pos, "Power Save Status: "); | 1024 | pos += scnprintf(buf + pos, bufsz - pos, "Power Save Status: "); |
@@ -1035,7 +1035,7 @@ static ssize_t il_dbgfs_clear_ucode_statistics_write(struct file *file, | |||
1035 | const char __user *user_buf, | 1035 | const char __user *user_buf, |
1036 | size_t count, loff_t *ppos) | 1036 | size_t count, loff_t *ppos) |
1037 | { | 1037 | { |
1038 | struct il_priv *priv = file->private_data; | 1038 | struct il_priv *il = file->private_data; |
1039 | char buf[8]; | 1039 | char buf[8]; |
1040 | int buf_size; | 1040 | int buf_size; |
1041 | int clear; | 1041 | int clear; |
@@ -1048,9 +1048,9 @@ static ssize_t il_dbgfs_clear_ucode_statistics_write(struct file *file, | |||
1048 | return -EFAULT; | 1048 | return -EFAULT; |
1049 | 1049 | ||
1050 | /* make request to uCode to retrieve statistics information */ | 1050 | /* make request to uCode to retrieve statistics information */ |
1051 | mutex_lock(&priv->mutex); | 1051 | mutex_lock(&il->mutex); |
1052 | il_send_statistics_request(priv, CMD_SYNC, true); | 1052 | il_send_statistics_request(il, CMD_SYNC, true); |
1053 | mutex_unlock(&priv->mutex); | 1053 | mutex_unlock(&il->mutex); |
1054 | 1054 | ||
1055 | return count; | 1055 | return count; |
1056 | } | 1056 | } |
@@ -1059,12 +1059,12 @@ static ssize_t il_dbgfs_rxon_flags_read(struct file *file, | |||
1059 | char __user *user_buf, | 1059 | char __user *user_buf, |
1060 | size_t count, loff_t *ppos) { | 1060 | size_t count, loff_t *ppos) { |
1061 | 1061 | ||
1062 | struct il_priv *priv = file->private_data; | 1062 | struct il_priv *il = file->private_data; |
1063 | int len = 0; | 1063 | int len = 0; |
1064 | char buf[20]; | 1064 | char buf[20]; |
1065 | 1065 | ||
1066 | len = sprintf(buf, "0x%04X\n", | 1066 | len = sprintf(buf, "0x%04X\n", |
1067 | le32_to_cpu(priv->contexts[IL_RXON_CTX_BSS].active.flags)); | 1067 | le32_to_cpu(il->contexts[IL_RXON_CTX_BSS].active.flags)); |
1068 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | 1068 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
1069 | } | 1069 | } |
1070 | 1070 | ||
@@ -1072,12 +1072,12 @@ static ssize_t il_dbgfs_rxon_filter_flags_read(struct file *file, | |||
1072 | char __user *user_buf, | 1072 | char __user *user_buf, |
1073 | size_t count, loff_t *ppos) { | 1073 | size_t count, loff_t *ppos) { |
1074 | 1074 | ||
1075 | struct il_priv *priv = file->private_data; | 1075 | struct il_priv *il = file->private_data; |
1076 | int len = 0; | 1076 | int len = 0; |
1077 | char buf[20]; | 1077 | char buf[20]; |
1078 | 1078 | ||
1079 | len = sprintf(buf, "0x%04X\n", | 1079 | len = sprintf(buf, "0x%04X\n", |
1080 | le32_to_cpu(priv->contexts[IL_RXON_CTX_BSS].active.filter_flags)); | 1080 | le32_to_cpu(il->contexts[IL_RXON_CTX_BSS].active.filter_flags)); |
1081 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | 1081 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
1082 | } | 1082 | } |
1083 | 1083 | ||
@@ -1085,13 +1085,13 @@ static ssize_t il_dbgfs_fh_reg_read(struct file *file, | |||
1085 | char __user *user_buf, | 1085 | char __user *user_buf, |
1086 | size_t count, loff_t *ppos) | 1086 | size_t count, loff_t *ppos) |
1087 | { | 1087 | { |
1088 | struct il_priv *priv = file->private_data; | 1088 | struct il_priv *il = file->private_data; |
1089 | char *buf; | 1089 | char *buf; |
1090 | int pos = 0; | 1090 | int pos = 0; |
1091 | ssize_t ret = -EFAULT; | 1091 | ssize_t ret = -EFAULT; |
1092 | 1092 | ||
1093 | if (priv->cfg->ops->lib->dump_fh) { | 1093 | if (il->cfg->ops->lib->dump_fh) { |
1094 | ret = pos = priv->cfg->ops->lib->dump_fh(priv, &buf, true); | 1094 | ret = pos = il->cfg->ops->lib->dump_fh(il, &buf, true); |
1095 | if (buf) { | 1095 | if (buf) { |
1096 | ret = simple_read_from_buffer(user_buf, | 1096 | ret = simple_read_from_buffer(user_buf, |
1097 | count, ppos, buf, pos); | 1097 | count, ppos, buf, pos); |
@@ -1106,13 +1106,13 @@ static ssize_t il_dbgfs_missed_beacon_read(struct file *file, | |||
1106 | char __user *user_buf, | 1106 | char __user *user_buf, |
1107 | size_t count, loff_t *ppos) { | 1107 | size_t count, loff_t *ppos) { |
1108 | 1108 | ||
1109 | struct il_priv *priv = file->private_data; | 1109 | struct il_priv *il = file->private_data; |
1110 | int pos = 0; | 1110 | int pos = 0; |
1111 | char buf[12]; | 1111 | char buf[12]; |
1112 | const size_t bufsz = sizeof(buf); | 1112 | const size_t bufsz = sizeof(buf); |
1113 | 1113 | ||
1114 | pos += scnprintf(buf + pos, bufsz - pos, "%d\n", | 1114 | pos += scnprintf(buf + pos, bufsz - pos, "%d\n", |
1115 | priv->missed_beacon_threshold); | 1115 | il->missed_beacon_threshold); |
1116 | 1116 | ||
1117 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 1117 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
1118 | } | 1118 | } |
@@ -1121,7 +1121,7 @@ static ssize_t il_dbgfs_missed_beacon_write(struct file *file, | |||
1121 | const char __user *user_buf, | 1121 | const char __user *user_buf, |
1122 | size_t count, loff_t *ppos) | 1122 | size_t count, loff_t *ppos) |
1123 | { | 1123 | { |
1124 | struct il_priv *priv = file->private_data; | 1124 | struct il_priv *il = file->private_data; |
1125 | char buf[8]; | 1125 | char buf[8]; |
1126 | int buf_size; | 1126 | int buf_size; |
1127 | int missed; | 1127 | int missed; |
@@ -1135,10 +1135,10 @@ static ssize_t il_dbgfs_missed_beacon_write(struct file *file, | |||
1135 | 1135 | ||
1136 | if (missed < IL_MISSED_BEACON_THRESHOLD_MIN || | 1136 | if (missed < IL_MISSED_BEACON_THRESHOLD_MIN || |
1137 | missed > IL_MISSED_BEACON_THRESHOLD_MAX) | 1137 | missed > IL_MISSED_BEACON_THRESHOLD_MAX) |
1138 | priv->missed_beacon_threshold = | 1138 | il->missed_beacon_threshold = |
1139 | IL_MISSED_BEACON_THRESHOLD_DEF; | 1139 | IL_MISSED_BEACON_THRESHOLD_DEF; |
1140 | else | 1140 | else |
1141 | priv->missed_beacon_threshold = missed; | 1141 | il->missed_beacon_threshold = missed; |
1142 | 1142 | ||
1143 | return count; | 1143 | return count; |
1144 | } | 1144 | } |
@@ -1147,13 +1147,13 @@ static ssize_t il_dbgfs_force_reset_read(struct file *file, | |||
1147 | char __user *user_buf, | 1147 | char __user *user_buf, |
1148 | size_t count, loff_t *ppos) { | 1148 | size_t count, loff_t *ppos) { |
1149 | 1149 | ||
1150 | struct il_priv *priv = file->private_data; | 1150 | struct il_priv *il = file->private_data; |
1151 | int pos = 0; | 1151 | int pos = 0; |
1152 | char buf[300]; | 1152 | char buf[300]; |
1153 | const size_t bufsz = sizeof(buf); | 1153 | const size_t bufsz = sizeof(buf); |
1154 | struct il_force_reset *force_reset; | 1154 | struct il_force_reset *force_reset; |
1155 | 1155 | ||
1156 | force_reset = &priv->force_reset; | 1156 | force_reset = &il->force_reset; |
1157 | 1157 | ||
1158 | pos += scnprintf(buf + pos, bufsz - pos, | 1158 | pos += scnprintf(buf + pos, bufsz - pos, |
1159 | "\tnumber of reset request: %d\n", | 1159 | "\tnumber of reset request: %d\n", |
@@ -1176,9 +1176,9 @@ static ssize_t il_dbgfs_force_reset_write(struct file *file, | |||
1176 | size_t count, loff_t *ppos) { | 1176 | size_t count, loff_t *ppos) { |
1177 | 1177 | ||
1178 | int ret; | 1178 | int ret; |
1179 | struct il_priv *priv = file->private_data; | 1179 | struct il_priv *il = file->private_data; |
1180 | 1180 | ||
1181 | ret = il_force_reset(priv, true); | 1181 | ret = il_force_reset(il, true); |
1182 | 1182 | ||
1183 | return ret ? ret : count; | 1183 | return ret ? ret : count; |
1184 | } | 1184 | } |
@@ -1187,7 +1187,7 @@ static ssize_t il_dbgfs_wd_timeout_write(struct file *file, | |||
1187 | const char __user *user_buf, | 1187 | const char __user *user_buf, |
1188 | size_t count, loff_t *ppos) { | 1188 | size_t count, loff_t *ppos) { |
1189 | 1189 | ||
1190 | struct il_priv *priv = file->private_data; | 1190 | struct il_priv *il = file->private_data; |
1191 | char buf[8]; | 1191 | char buf[8]; |
1192 | int buf_size; | 1192 | int buf_size; |
1193 | int timeout; | 1193 | int timeout; |
@@ -1201,8 +1201,8 @@ static ssize_t il_dbgfs_wd_timeout_write(struct file *file, | |||
1201 | if (timeout < 0 || timeout > IL_MAX_WD_TIMEOUT) | 1201 | if (timeout < 0 || timeout > IL_MAX_WD_TIMEOUT) |
1202 | timeout = IL_DEF_WD_TIMEOUT; | 1202 | timeout = IL_DEF_WD_TIMEOUT; |
1203 | 1203 | ||
1204 | priv->cfg->base_params->wd_timeout = timeout; | 1204 | il->cfg->base_params->wd_timeout = timeout; |
1205 | il_setup_watchdog(priv); | 1205 | il_setup_watchdog(il); |
1206 | return count; | 1206 | return count; |
1207 | } | 1207 | } |
1208 | 1208 | ||
@@ -1230,16 +1230,16 @@ DEBUGFS_WRITE_FILE_OPS(wd_timeout); | |||
1230 | * Create the debugfs files and directories | 1230 | * Create the debugfs files and directories |
1231 | * | 1231 | * |
1232 | */ | 1232 | */ |
1233 | int il_dbgfs_register(struct il_priv *priv, const char *name) | 1233 | int il_dbgfs_register(struct il_priv *il, const char *name) |
1234 | { | 1234 | { |
1235 | struct dentry *phyd = priv->hw->wiphy->debugfsdir; | 1235 | struct dentry *phyd = il->hw->wiphy->debugfsdir; |
1236 | struct dentry *dir_drv, *dir_data, *dir_rf, *dir_debug; | 1236 | struct dentry *dir_drv, *dir_data, *dir_rf, *dir_debug; |
1237 | 1237 | ||
1238 | dir_drv = debugfs_create_dir(name, phyd); | 1238 | dir_drv = debugfs_create_dir(name, phyd); |
1239 | if (!dir_drv) | 1239 | if (!dir_drv) |
1240 | return -ENOMEM; | 1240 | return -ENOMEM; |
1241 | 1241 | ||
1242 | priv->debugfs_dir = dir_drv; | 1242 | il->debugfs_dir = dir_drv; |
1243 | 1243 | ||
1244 | dir_data = debugfs_create_dir("data", dir_drv); | 1244 | dir_data = debugfs_create_dir("data", dir_drv); |
1245 | if (!dir_data) | 1245 | if (!dir_data) |
@@ -1274,26 +1274,26 @@ int il_dbgfs_register(struct il_priv *priv, const char *name) | |||
1274 | DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR); | 1274 | DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR); |
1275 | DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR); | 1275 | DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR); |
1276 | 1276 | ||
1277 | if (priv->cfg->base_params->sensitivity_calib_by_driver) | 1277 | if (il->cfg->base_params->sensitivity_calib_by_driver) |
1278 | DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR); | 1278 | DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR); |
1279 | if (priv->cfg->base_params->chain_noise_calib_by_driver) | 1279 | if (il->cfg->base_params->chain_noise_calib_by_driver) |
1280 | DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR); | 1280 | DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR); |
1281 | DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); | 1281 | DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); |
1282 | DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); | 1282 | DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); |
1283 | DEBUGFS_ADD_FILE(wd_timeout, dir_debug, S_IWUSR); | 1283 | DEBUGFS_ADD_FILE(wd_timeout, dir_debug, S_IWUSR); |
1284 | if (priv->cfg->base_params->sensitivity_calib_by_driver) | 1284 | if (il->cfg->base_params->sensitivity_calib_by_driver) |
1285 | DEBUGFS_ADD_BOOL(disable_sensitivity, dir_rf, | 1285 | DEBUGFS_ADD_BOOL(disable_sensitivity, dir_rf, |
1286 | &priv->disable_sens_cal); | 1286 | &il->disable_sens_cal); |
1287 | if (priv->cfg->base_params->chain_noise_calib_by_driver) | 1287 | if (il->cfg->base_params->chain_noise_calib_by_driver) |
1288 | DEBUGFS_ADD_BOOL(disable_chain_noise, dir_rf, | 1288 | DEBUGFS_ADD_BOOL(disable_chain_noise, dir_rf, |
1289 | &priv->disable_chain_noise_cal); | 1289 | &il->disable_chain_noise_cal); |
1290 | DEBUGFS_ADD_BOOL(disable_tx_power, dir_rf, | 1290 | DEBUGFS_ADD_BOOL(disable_tx_power, dir_rf, |
1291 | &priv->disable_tx_power_cal); | 1291 | &il->disable_tx_power_cal); |
1292 | return 0; | 1292 | return 0; |
1293 | 1293 | ||
1294 | err: | 1294 | err: |
1295 | IL_ERR(priv, "Can't create the debugfs directory\n"); | 1295 | IL_ERR(il, "Can't create the debugfs directory\n"); |
1296 | il_dbgfs_unregister(priv); | 1296 | il_dbgfs_unregister(il); |
1297 | return -ENOMEM; | 1297 | return -ENOMEM; |
1298 | } | 1298 | } |
1299 | EXPORT_SYMBOL(il_dbgfs_register); | 1299 | EXPORT_SYMBOL(il_dbgfs_register); |
@@ -1302,12 +1302,12 @@ EXPORT_SYMBOL(il_dbgfs_register); | |||
1302 | * Remove the debugfs files and directories | 1302 | * Remove the debugfs files and directories |
1303 | * | 1303 | * |
1304 | */ | 1304 | */ |
1305 | void il_dbgfs_unregister(struct il_priv *priv) | 1305 | void il_dbgfs_unregister(struct il_priv *il) |
1306 | { | 1306 | { |
1307 | if (!priv->debugfs_dir) | 1307 | if (!il->debugfs_dir) |
1308 | return; | 1308 | return; |
1309 | 1309 | ||
1310 | debugfs_remove_recursive(priv->debugfs_dir); | 1310 | debugfs_remove_recursive(il->debugfs_dir); |
1311 | priv->debugfs_dir = NULL; | 1311 | il->debugfs_dir = NULL; |
1312 | } | 1312 | } |
1313 | EXPORT_SYMBOL(il_dbgfs_unregister); | 1313 | EXPORT_SYMBOL(il_dbgfs_unregister); |
diff --git a/drivers/net/wireless/iwlegacy/iwl-dev.h b/drivers/net/wireless/iwlegacy/iwl-dev.h index 20c44f36ba7..824d1934a7a 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 { | |||
106 | * invoked for SYNC commands, if it were and its result passed | 106 | * invoked for SYNC commands, if it were and its result passed |
107 | * through it would be simpler...) | 107 | * through it would be simpler...) |
108 | */ | 108 | */ |
109 | void (*callback)(struct il_priv *priv, | 109 | void (*callback)(struct il_priv *il, |
110 | struct il_device_cmd *cmd, | 110 | struct il_device_cmd *cmd, |
111 | struct il_rx_packet *pkt); | 111 | struct il_rx_packet *pkt); |
112 | 112 | ||
@@ -321,7 +321,7 @@ struct il_device_cmd { | |||
321 | struct il_host_cmd { | 321 | struct il_host_cmd { |
322 | const void *data; | 322 | const void *data; |
323 | unsigned long reply_page; | 323 | unsigned long reply_page; |
324 | void (*callback)(struct il_priv *priv, | 324 | void (*callback)(struct il_priv *il, |
325 | struct il_device_cmd *cmd, | 325 | struct il_device_cmd *cmd, |
326 | struct il_rx_packet *pkt); | 326 | struct il_rx_packet *pkt); |
327 | u32 flags; | 327 | u32 flags; |
@@ -476,7 +476,7 @@ struct il_station_priv_common { | |||
476 | }; | 476 | }; |
477 | 477 | ||
478 | /* | 478 | /* |
479 | * il_station_priv: Driver's private station information | 479 | * il_station_priv: Driver's ilate station information |
480 | * | 480 | * |
481 | * When mac80211 creates a station it reserves some space (hw->sta_data_size) | 481 | * When mac80211 creates a station it reserves some space (hw->sta_data_size) |
482 | * in the structure for use by driver. This structure is places in that | 482 | * in the structure for use by driver. This structure is places in that |
@@ -494,7 +494,7 @@ struct il_station_priv { | |||
494 | }; | 494 | }; |
495 | 495 | ||
496 | /** | 496 | /** |
497 | * struct il_vif_priv - driver's private per-interface information | 497 | * struct il_vif_priv - driver's ilate per-interface information |
498 | * | 498 | * |
499 | * When mac80211 allocates a virtual interface, it can allocate | 499 | * When mac80211 allocates a virtual interface, it can allocate |
500 | * space for us to put data into. | 500 | * space for us to put data into. |
@@ -625,7 +625,7 @@ struct il_hw_params { | |||
625 | * il4965_mac_ <-- mac80211 callback | 625 | * il4965_mac_ <-- mac80211 callback |
626 | * | 626 | * |
627 | ****************************************************************************/ | 627 | ****************************************************************************/ |
628 | extern void il4965_update_chain_flags(struct il_priv *priv); | 628 | extern void il4965_update_chain_flags(struct il_priv *il); |
629 | extern const u8 iwlegacy_bcast_addr[ETH_ALEN]; | 629 | extern const u8 iwlegacy_bcast_addr[ETH_ALEN]; |
630 | extern int il_queue_space(const struct il_queue *q); | 630 | extern int il_queue_space(const struct il_queue *q); |
631 | static inline int il_queue_used(const struct il_queue *q, int i) | 631 | static inline int il_queue_used(const struct il_queue *q, int i) |
@@ -973,7 +973,7 @@ struct il_priv { | |||
973 | enum ieee80211_band band; | 973 | enum ieee80211_band band; |
974 | int alloc_rxb_page; | 974 | int alloc_rxb_page; |
975 | 975 | ||
976 | void (*rx_handlers[REPLY_MAX])(struct il_priv *priv, | 976 | void (*rx_handlers[REPLY_MAX])(struct il_priv *il, |
977 | struct il_rx_mem_buffer *rxb); | 977 | struct il_rx_mem_buffer *rxb); |
978 | 978 | ||
979 | struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS]; | 979 | struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS]; |
@@ -1247,14 +1247,14 @@ struct il_priv { | |||
1247 | bool led_registered; | 1247 | bool led_registered; |
1248 | }; /*il_priv */ | 1248 | }; /*il_priv */ |
1249 | 1249 | ||
1250 | static inline void il_txq_ctx_activate(struct il_priv *priv, int txq_id) | 1250 | static inline void il_txq_ctx_activate(struct il_priv *il, int txq_id) |
1251 | { | 1251 | { |
1252 | set_bit(txq_id, &priv->txq_ctx_active_msk); | 1252 | set_bit(txq_id, &il->txq_ctx_active_msk); |
1253 | } | 1253 | } |
1254 | 1254 | ||
1255 | static inline void il_txq_ctx_deactivate(struct il_priv *priv, int txq_id) | 1255 | static inline void il_txq_ctx_deactivate(struct il_priv *il, int txq_id) |
1256 | { | 1256 | { |
1257 | clear_bit(txq_id, &priv->txq_ctx_active_msk); | 1257 | clear_bit(txq_id, &il->txq_ctx_active_msk); |
1258 | } | 1258 | } |
1259 | 1259 | ||
1260 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 1260 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
@@ -1265,15 +1265,15 @@ static inline void il_txq_ctx_deactivate(struct il_priv *priv, int txq_id) | |||
1265 | * level will be used if set, otherwise the global debug level which can be | 1265 | * level will be used if set, otherwise the global debug level which can be |
1266 | * set via module parameter is used. | 1266 | * set via module parameter is used. |
1267 | */ | 1267 | */ |
1268 | static inline u32 il_get_debug_level(struct il_priv *priv) | 1268 | static inline u32 il_get_debug_level(struct il_priv *il) |
1269 | { | 1269 | { |
1270 | if (priv->debug_level) | 1270 | if (il->debug_level) |
1271 | return priv->debug_level; | 1271 | return il->debug_level; |
1272 | else | 1272 | else |
1273 | return iwlegacy_debug_level; | 1273 | return iwlegacy_debug_level; |
1274 | } | 1274 | } |
1275 | #else | 1275 | #else |
1276 | static inline u32 il_get_debug_level(struct il_priv *priv) | 1276 | static inline u32 il_get_debug_level(struct il_priv *il) |
1277 | { | 1277 | { |
1278 | return iwlegacy_debug_level; | 1278 | return iwlegacy_debug_level; |
1279 | } | 1279 | } |
@@ -1281,11 +1281,11 @@ static inline u32 il_get_debug_level(struct il_priv *priv) | |||
1281 | 1281 | ||
1282 | 1282 | ||
1283 | static inline struct ieee80211_hdr * | 1283 | static inline struct ieee80211_hdr * |
1284 | il_tx_queue_get_hdr(struct il_priv *priv, | 1284 | il_tx_queue_get_hdr(struct il_priv *il, |
1285 | int txq_id, int idx) | 1285 | int txq_id, int idx) |
1286 | { | 1286 | { |
1287 | if (priv->txq[txq_id].txb[idx].skb) | 1287 | if (il->txq[txq_id].txb[idx].skb) |
1288 | return (struct ieee80211_hdr *)priv->txq[txq_id]. | 1288 | return (struct ieee80211_hdr *)il->txq[txq_id]. |
1289 | txb[idx].skb->data; | 1289 | txb[idx].skb->data; |
1290 | return NULL; | 1290 | return NULL; |
1291 | } | 1291 | } |
@@ -1298,21 +1298,21 @@ il_rxon_ctx_from_vif(struct ieee80211_vif *vif) | |||
1298 | return vif_priv->ctx; | 1298 | return vif_priv->ctx; |
1299 | } | 1299 | } |
1300 | 1300 | ||
1301 | #define for_each_context(priv, ctx) \ | 1301 | #define for_each_context(il, ctx) \ |
1302 | for (ctx = &priv->contexts[IL_RXON_CTX_BSS]; \ | 1302 | for (ctx = &il->contexts[IL_RXON_CTX_BSS]; \ |
1303 | ctx < &priv->contexts[NUM_IL_RXON_CTX]; ctx++) \ | 1303 | ctx < &il->contexts[NUM_IL_RXON_CTX]; ctx++) \ |
1304 | if (priv->valid_contexts & BIT(ctx->ctxid)) | 1304 | if (il->valid_contexts & BIT(ctx->ctxid)) |
1305 | 1305 | ||
1306 | static inline int il_is_associated(struct il_priv *priv, | 1306 | static inline int il_is_associated(struct il_priv *il, |
1307 | enum il_rxon_context_id ctxid) | 1307 | enum il_rxon_context_id ctxid) |
1308 | { | 1308 | { |
1309 | return (priv->contexts[ctxid].active.filter_flags & | 1309 | return (il->contexts[ctxid].active.filter_flags & |
1310 | RXON_FILTER_ASSOC_MSK) ? 1 : 0; | 1310 | RXON_FILTER_ASSOC_MSK) ? 1 : 0; |
1311 | } | 1311 | } |
1312 | 1312 | ||
1313 | static inline int il_is_any_associated(struct il_priv *priv) | 1313 | static inline int il_is_any_associated(struct il_priv *il) |
1314 | { | 1314 | { |
1315 | return il_is_associated(priv, IL_RXON_CTX_BSS); | 1315 | return il_is_associated(il, IL_RXON_CTX_BSS); |
1316 | } | 1316 | } |
1317 | 1317 | ||
1318 | static inline int il_is_associated_ctx(struct il_rxon_context *ctx) | 1318 | 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) | |||
1350 | } | 1350 | } |
1351 | 1351 | ||
1352 | static inline void | 1352 | static inline void |
1353 | __il_free_pages(struct il_priv *priv, struct page *page) | 1353 | __il_free_pages(struct il_priv *il, struct page *page) |
1354 | { | 1354 | { |
1355 | __free_pages(page, priv->hw_params.rx_page_order); | 1355 | __free_pages(page, il->hw_params.rx_page_order); |
1356 | priv->alloc_rxb_page--; | 1356 | il->alloc_rxb_page--; |
1357 | } | 1357 | } |
1358 | 1358 | ||
1359 | static inline void il_free_pages(struct il_priv *priv, unsigned long page) | 1359 | static inline void il_free_pages(struct il_priv *il, unsigned long page) |
1360 | { | 1360 | { |
1361 | free_pages(page, priv->hw_params.rx_page_order); | 1361 | free_pages(page, il->hw_params.rx_page_order); |
1362 | priv->alloc_rxb_page--; | 1362 | il->alloc_rxb_page--; |
1363 | } | 1363 | } |
1364 | #endif /* __il_dev_h__ */ | 1364 | #endif /* __il_dev_h__ */ |
diff --git a/drivers/net/wireless/iwlegacy/iwl-eeprom.c b/drivers/net/wireless/iwlegacy/iwl-eeprom.c index 1075f1d7f01..5edec73a505 100644 --- a/drivers/net/wireless/iwlegacy/iwl-eeprom.c +++ b/drivers/net/wireless/iwlegacy/iwl-eeprom.c | |||
@@ -87,7 +87,7 @@ | |||
87 | * is contained in the eeprom map itself. | 87 | * is contained in the eeprom map itself. |
88 | * | 88 | * |
89 | * During init, we copy the eeprom information and channel map | 89 | * During init, we copy the eeprom information and channel map |
90 | * information into priv->channel_info_24/52 and priv->channel_map_24/52 | 90 | * information into il->channel_info_24/52 and il->channel_map_24/52 |
91 | * | 91 | * |
92 | * channel_map_24/52 provides the index in the channel_info array for a | 92 | * channel_map_24/52 provides the index in the channel_info array for a |
93 | * given channel. We have to have two separate maps as there is channel | 93 | * 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 */ | |||
142 | * | 142 | * |
143 | ******************************************************************************/ | 143 | ******************************************************************************/ |
144 | 144 | ||
145 | static int il_eeprom_verify_signature(struct il_priv *priv) | 145 | static int il_eeprom_verify_signature(struct il_priv *il) |
146 | { | 146 | { |
147 | u32 gp = il_read32(priv, CSR_EEPROM_GP) & CSR_EEPROM_GP_VALID_MSK; | 147 | u32 gp = il_read32(il, CSR_EEPROM_GP) & CSR_EEPROM_GP_VALID_MSK; |
148 | int ret = 0; | 148 | int ret = 0; |
149 | 149 | ||
150 | IL_DEBUG_EEPROM(priv, "EEPROM signature=0x%08x\n", gp); | 150 | IL_DEBUG_EEPROM(il, "EEPROM signature=0x%08x\n", gp); |
151 | switch (gp) { | 151 | switch (gp) { |
152 | case CSR_EEPROM_GP_GOOD_SIG_EEP_LESS_THAN_4K: | 152 | case CSR_EEPROM_GP_GOOD_SIG_EEP_LESS_THAN_4K: |
153 | case CSR_EEPROM_GP_GOOD_SIG_EEP_MORE_THAN_4K: | 153 | case CSR_EEPROM_GP_GOOD_SIG_EEP_MORE_THAN_4K: |
154 | break; | 154 | break; |
155 | default: | 155 | default: |
156 | IL_ERR(priv, "bad EEPROM signature," | 156 | IL_ERR(il, "bad EEPROM signature," |
157 | "EEPROM_GP=0x%08x\n", gp); | 157 | "EEPROM_GP=0x%08x\n", gp); |
158 | ret = -ENOENT; | 158 | ret = -ENOENT; |
159 | break; | 159 | break; |
@@ -162,59 +162,59 @@ static int il_eeprom_verify_signature(struct il_priv *priv) | |||
162 | } | 162 | } |
163 | 163 | ||
164 | const u8 | 164 | const u8 |
165 | *il_eeprom_query_addr(const struct il_priv *priv, size_t offset) | 165 | *il_eeprom_query_addr(const struct il_priv *il, size_t offset) |
166 | { | 166 | { |
167 | BUG_ON(offset >= priv->cfg->base_params->eeprom_size); | 167 | BUG_ON(offset >= il->cfg->base_params->eeprom_size); |
168 | return &priv->eeprom[offset]; | 168 | return &il->eeprom[offset]; |
169 | } | 169 | } |
170 | EXPORT_SYMBOL(il_eeprom_query_addr); | 170 | EXPORT_SYMBOL(il_eeprom_query_addr); |
171 | 171 | ||
172 | u16 il_eeprom_query16(const struct il_priv *priv, size_t offset) | 172 | u16 il_eeprom_query16(const struct il_priv *il, size_t offset) |
173 | { | 173 | { |
174 | if (!priv->eeprom) | 174 | if (!il->eeprom) |
175 | return 0; | 175 | return 0; |
176 | return (u16)priv->eeprom[offset] | ((u16)priv->eeprom[offset + 1] << 8); | 176 | return (u16)il->eeprom[offset] | ((u16)il->eeprom[offset + 1] << 8); |
177 | } | 177 | } |
178 | EXPORT_SYMBOL(il_eeprom_query16); | 178 | EXPORT_SYMBOL(il_eeprom_query16); |
179 | 179 | ||
180 | /** | 180 | /** |
181 | * il_eeprom_init - read EEPROM contents | 181 | * il_eeprom_init - read EEPROM contents |
182 | * | 182 | * |
183 | * Load the EEPROM contents from adapter into priv->eeprom | 183 | * Load the EEPROM contents from adapter into il->eeprom |
184 | * | 184 | * |
185 | * NOTE: This routine uses the non-debug IO access functions. | 185 | * NOTE: This routine uses the non-debug IO access functions. |
186 | */ | 186 | */ |
187 | int il_eeprom_init(struct il_priv *priv) | 187 | int il_eeprom_init(struct il_priv *il) |
188 | { | 188 | { |
189 | __le16 *e; | 189 | __le16 *e; |
190 | u32 gp = il_read32(priv, CSR_EEPROM_GP); | 190 | u32 gp = il_read32(il, CSR_EEPROM_GP); |
191 | int sz; | 191 | int sz; |
192 | int ret; | 192 | int ret; |
193 | u16 addr; | 193 | u16 addr; |
194 | 194 | ||
195 | /* allocate eeprom */ | 195 | /* allocate eeprom */ |
196 | sz = priv->cfg->base_params->eeprom_size; | 196 | sz = il->cfg->base_params->eeprom_size; |
197 | IL_DEBUG_EEPROM(priv, "NVM size = %d\n", sz); | 197 | IL_DEBUG_EEPROM(il, "NVM size = %d\n", sz); |
198 | priv->eeprom = kzalloc(sz, GFP_KERNEL); | 198 | il->eeprom = kzalloc(sz, GFP_KERNEL); |
199 | if (!priv->eeprom) { | 199 | if (!il->eeprom) { |
200 | ret = -ENOMEM; | 200 | ret = -ENOMEM; |
201 | goto alloc_err; | 201 | goto alloc_err; |
202 | } | 202 | } |
203 | e = (__le16 *)priv->eeprom; | 203 | e = (__le16 *)il->eeprom; |
204 | 204 | ||
205 | priv->cfg->ops->lib->apm_ops.init(priv); | 205 | il->cfg->ops->lib->apm_ops.init(il); |
206 | 206 | ||
207 | ret = il_eeprom_verify_signature(priv); | 207 | ret = il_eeprom_verify_signature(il); |
208 | if (ret < 0) { | 208 | if (ret < 0) { |
209 | IL_ERR(priv, "EEPROM not found, EEPROM_GP=0x%08x\n", gp); | 209 | IL_ERR(il, "EEPROM not found, EEPROM_GP=0x%08x\n", gp); |
210 | ret = -ENOENT; | 210 | ret = -ENOENT; |
211 | goto err; | 211 | goto err; |
212 | } | 212 | } |
213 | 213 | ||
214 | /* Make sure driver (instead of uCode) is allowed to read EEPROM */ | 214 | /* Make sure driver (instead of uCode) is allowed to read EEPROM */ |
215 | ret = priv->cfg->ops->lib->eeprom_ops.acquire_semaphore(priv); | 215 | ret = il->cfg->ops->lib->eeprom_ops.acquire_semaphore(il); |
216 | if (ret < 0) { | 216 | if (ret < 0) { |
217 | IL_ERR(priv, "Failed to acquire EEPROM semaphore.\n"); | 217 | IL_ERR(il, "Failed to acquire EEPROM semaphore.\n"); |
218 | ret = -ENOENT; | 218 | ret = -ENOENT; |
219 | goto err; | 219 | goto err; |
220 | } | 220 | } |
@@ -223,95 +223,95 @@ int il_eeprom_init(struct il_priv *priv) | |||
223 | for (addr = 0; addr < sz; addr += sizeof(u16)) { | 223 | for (addr = 0; addr < sz; addr += sizeof(u16)) { |
224 | u32 r; | 224 | u32 r; |
225 | 225 | ||
226 | _il_write32(priv, CSR_EEPROM_REG, | 226 | _il_write32(il, CSR_EEPROM_REG, |
227 | CSR_EEPROM_REG_MSK_ADDR & (addr << 1)); | 227 | CSR_EEPROM_REG_MSK_ADDR & (addr << 1)); |
228 | 228 | ||
229 | ret = il_poll_bit(priv, CSR_EEPROM_REG, | 229 | ret = il_poll_bit(il, CSR_EEPROM_REG, |
230 | CSR_EEPROM_REG_READ_VALID_MSK, | 230 | CSR_EEPROM_REG_READ_VALID_MSK, |
231 | CSR_EEPROM_REG_READ_VALID_MSK, | 231 | CSR_EEPROM_REG_READ_VALID_MSK, |
232 | IL_EEPROM_ACCESS_TIMEOUT); | 232 | IL_EEPROM_ACCESS_TIMEOUT); |
233 | if (ret < 0) { | 233 | if (ret < 0) { |
234 | IL_ERR(priv, "Time out reading EEPROM[%d]\n", | 234 | IL_ERR(il, "Time out reading EEPROM[%d]\n", |
235 | addr); | 235 | addr); |
236 | goto done; | 236 | goto done; |
237 | } | 237 | } |
238 | r = _il_read_direct32(priv, CSR_EEPROM_REG); | 238 | r = _il_read_direct32(il, CSR_EEPROM_REG); |
239 | e[addr / 2] = cpu_to_le16(r >> 16); | 239 | e[addr / 2] = cpu_to_le16(r >> 16); |
240 | } | 240 | } |
241 | 241 | ||
242 | IL_DEBUG_EEPROM(priv, "NVM Type: %s, version: 0x%x\n", | 242 | IL_DEBUG_EEPROM(il, "NVM Type: %s, version: 0x%x\n", |
243 | "EEPROM", | 243 | "EEPROM", |
244 | il_eeprom_query16(priv, EEPROM_VERSION)); | 244 | il_eeprom_query16(il, EEPROM_VERSION)); |
245 | 245 | ||
246 | ret = 0; | 246 | ret = 0; |
247 | done: | 247 | done: |
248 | priv->cfg->ops->lib->eeprom_ops.release_semaphore(priv); | 248 | il->cfg->ops->lib->eeprom_ops.release_semaphore(il); |
249 | 249 | ||
250 | err: | 250 | err: |
251 | if (ret) | 251 | if (ret) |
252 | il_eeprom_free(priv); | 252 | il_eeprom_free(il); |
253 | /* Reset chip to save power until we load uCode during "up". */ | 253 | /* Reset chip to save power until we load uCode during "up". */ |
254 | il_apm_stop(priv); | 254 | il_apm_stop(il); |
255 | alloc_err: | 255 | alloc_err: |
256 | return ret; | 256 | return ret; |
257 | } | 257 | } |
258 | EXPORT_SYMBOL(il_eeprom_init); | 258 | EXPORT_SYMBOL(il_eeprom_init); |
259 | 259 | ||
260 | void il_eeprom_free(struct il_priv *priv) | 260 | void il_eeprom_free(struct il_priv *il) |
261 | { | 261 | { |
262 | kfree(priv->eeprom); | 262 | kfree(il->eeprom); |
263 | priv->eeprom = NULL; | 263 | il->eeprom = NULL; |
264 | } | 264 | } |
265 | EXPORT_SYMBOL(il_eeprom_free); | 265 | EXPORT_SYMBOL(il_eeprom_free); |
266 | 266 | ||
267 | static void il_init_band_reference(const struct il_priv *priv, | 267 | static void il_init_band_reference(const struct il_priv *il, |
268 | int eep_band, int *eeprom_ch_count, | 268 | int eep_band, int *eeprom_ch_count, |
269 | const struct il_eeprom_channel **eeprom_ch_info, | 269 | const struct il_eeprom_channel **eeprom_ch_info, |
270 | const u8 **eeprom_ch_index) | 270 | const u8 **eeprom_ch_index) |
271 | { | 271 | { |
272 | u32 offset = priv->cfg->ops->lib-> | 272 | u32 offset = il->cfg->ops->lib-> |
273 | eeprom_ops.regulatory_bands[eep_band - 1]; | 273 | eeprom_ops.regulatory_bands[eep_band - 1]; |
274 | switch (eep_band) { | 274 | switch (eep_band) { |
275 | case 1: /* 2.4GHz band */ | 275 | case 1: /* 2.4GHz band */ |
276 | *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_1); | 276 | *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_1); |
277 | *eeprom_ch_info = (struct il_eeprom_channel *) | 277 | *eeprom_ch_info = (struct il_eeprom_channel *) |
278 | il_eeprom_query_addr(priv, offset); | 278 | il_eeprom_query_addr(il, offset); |
279 | *eeprom_ch_index = iwlegacy_eeprom_band_1; | 279 | *eeprom_ch_index = iwlegacy_eeprom_band_1; |
280 | break; | 280 | break; |
281 | case 2: /* 4.9GHz band */ | 281 | case 2: /* 4.9GHz band */ |
282 | *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_2); | 282 | *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_2); |
283 | *eeprom_ch_info = (struct il_eeprom_channel *) | 283 | *eeprom_ch_info = (struct il_eeprom_channel *) |
284 | il_eeprom_query_addr(priv, offset); | 284 | il_eeprom_query_addr(il, offset); |
285 | *eeprom_ch_index = iwlegacy_eeprom_band_2; | 285 | *eeprom_ch_index = iwlegacy_eeprom_band_2; |
286 | break; | 286 | break; |
287 | case 3: /* 5.2GHz band */ | 287 | case 3: /* 5.2GHz band */ |
288 | *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_3); | 288 | *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_3); |
289 | *eeprom_ch_info = (struct il_eeprom_channel *) | 289 | *eeprom_ch_info = (struct il_eeprom_channel *) |
290 | il_eeprom_query_addr(priv, offset); | 290 | il_eeprom_query_addr(il, offset); |
291 | *eeprom_ch_index = iwlegacy_eeprom_band_3; | 291 | *eeprom_ch_index = iwlegacy_eeprom_band_3; |
292 | break; | 292 | break; |
293 | case 4: /* 5.5GHz band */ | 293 | case 4: /* 5.5GHz band */ |
294 | *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_4); | 294 | *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_4); |
295 | *eeprom_ch_info = (struct il_eeprom_channel *) | 295 | *eeprom_ch_info = (struct il_eeprom_channel *) |
296 | il_eeprom_query_addr(priv, offset); | 296 | il_eeprom_query_addr(il, offset); |
297 | *eeprom_ch_index = iwlegacy_eeprom_band_4; | 297 | *eeprom_ch_index = iwlegacy_eeprom_band_4; |
298 | break; | 298 | break; |
299 | case 5: /* 5.7GHz band */ | 299 | case 5: /* 5.7GHz band */ |
300 | *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_5); | 300 | *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_5); |
301 | *eeprom_ch_info = (struct il_eeprom_channel *) | 301 | *eeprom_ch_info = (struct il_eeprom_channel *) |
302 | il_eeprom_query_addr(priv, offset); | 302 | il_eeprom_query_addr(il, offset); |
303 | *eeprom_ch_index = iwlegacy_eeprom_band_5; | 303 | *eeprom_ch_index = iwlegacy_eeprom_band_5; |
304 | break; | 304 | break; |
305 | case 6: /* 2.4GHz ht40 channels */ | 305 | case 6: /* 2.4GHz ht40 channels */ |
306 | *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_6); | 306 | *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_6); |
307 | *eeprom_ch_info = (struct il_eeprom_channel *) | 307 | *eeprom_ch_info = (struct il_eeprom_channel *) |
308 | il_eeprom_query_addr(priv, offset); | 308 | il_eeprom_query_addr(il, offset); |
309 | *eeprom_ch_index = iwlegacy_eeprom_band_6; | 309 | *eeprom_ch_index = iwlegacy_eeprom_band_6; |
310 | break; | 310 | break; |
311 | case 7: /* 5 GHz ht40 channels */ | 311 | case 7: /* 5 GHz ht40 channels */ |
312 | *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_7); | 312 | *eeprom_ch_count = ARRAY_SIZE(iwlegacy_eeprom_band_7); |
313 | *eeprom_ch_info = (struct il_eeprom_channel *) | 313 | *eeprom_ch_info = (struct il_eeprom_channel *) |
314 | il_eeprom_query_addr(priv, offset); | 314 | il_eeprom_query_addr(il, offset); |
315 | *eeprom_ch_index = iwlegacy_eeprom_band_7; | 315 | *eeprom_ch_index = iwlegacy_eeprom_band_7; |
316 | break; | 316 | break; |
317 | default: | 317 | default: |
@@ -322,11 +322,11 @@ static void il_init_band_reference(const struct il_priv *priv, | |||
322 | #define CHECK_AND_PRINT(x) ((eeprom_ch->flags & EEPROM_CHANNEL_##x) \ | 322 | #define CHECK_AND_PRINT(x) ((eeprom_ch->flags & EEPROM_CHANNEL_##x) \ |
323 | ? # x " " : "") | 323 | ? # x " " : "") |
324 | /** | 324 | /** |
325 | * il_mod_ht40_chan_info - Copy ht40 channel info into driver's priv. | 325 | * il_mod_ht40_chan_info - Copy ht40 channel info into driver's il. |
326 | * | 326 | * |
327 | * Does not set up a command, or touch hardware. | 327 | * Does not set up a command, or touch hardware. |
328 | */ | 328 | */ |
329 | static int il_mod_ht40_chan_info(struct il_priv *priv, | 329 | static int il_mod_ht40_chan_info(struct il_priv *il, |
330 | enum ieee80211_band band, u16 channel, | 330 | enum ieee80211_band band, u16 channel, |
331 | const struct il_eeprom_channel *eeprom_ch, | 331 | const struct il_eeprom_channel *eeprom_ch, |
332 | u8 clear_ht40_extension_channel) | 332 | u8 clear_ht40_extension_channel) |
@@ -334,12 +334,12 @@ static int il_mod_ht40_chan_info(struct il_priv *priv, | |||
334 | struct il_channel_info *ch_info; | 334 | struct il_channel_info *ch_info; |
335 | 335 | ||
336 | ch_info = (struct il_channel_info *) | 336 | ch_info = (struct il_channel_info *) |
337 | il_get_channel_info(priv, band, channel); | 337 | il_get_channel_info(il, band, channel); |
338 | 338 | ||
339 | if (!il_is_channel_valid(ch_info)) | 339 | if (!il_is_channel_valid(ch_info)) |
340 | return -1; | 340 | return -1; |
341 | 341 | ||
342 | IL_DEBUG_EEPROM(priv, "HT40 Ch. %d [%sGHz] %s%s%s%s%s(0x%02x %ddBm):" | 342 | IL_DEBUG_EEPROM(il, "HT40 Ch. %d [%sGHz] %s%s%s%s%s(0x%02x %ddBm):" |
343 | " Ad-Hoc %ssupported\n", | 343 | " Ad-Hoc %ssupported\n", |
344 | ch_info->channel, | 344 | ch_info->channel, |
345 | il_is_channel_a_band(ch_info) ? | 345 | il_is_channel_a_band(ch_info) ? |
@@ -371,7 +371,7 @@ static int il_mod_ht40_chan_info(struct il_priv *priv, | |||
371 | /** | 371 | /** |
372 | * il_init_channel_map - Set up driver's info for all possible channels | 372 | * il_init_channel_map - Set up driver's info for all possible channels |
373 | */ | 373 | */ |
374 | int il_init_channel_map(struct il_priv *priv) | 374 | int il_init_channel_map(struct il_priv *il) |
375 | { | 375 | { |
376 | int eeprom_ch_count = 0; | 376 | int eeprom_ch_count = 0; |
377 | const u8 *eeprom_ch_index = NULL; | 377 | const u8 *eeprom_ch_index = NULL; |
@@ -379,39 +379,39 @@ int il_init_channel_map(struct il_priv *priv) | |||
379 | int band, ch; | 379 | int band, ch; |
380 | struct il_channel_info *ch_info; | 380 | struct il_channel_info *ch_info; |
381 | 381 | ||
382 | if (priv->channel_count) { | 382 | if (il->channel_count) { |
383 | IL_DEBUG_EEPROM(priv, "Channel map already initialized.\n"); | 383 | IL_DEBUG_EEPROM(il, "Channel map already initialized.\n"); |
384 | return 0; | 384 | return 0; |
385 | } | 385 | } |
386 | 386 | ||
387 | IL_DEBUG_EEPROM(priv, "Initializing regulatory info from EEPROM\n"); | 387 | IL_DEBUG_EEPROM(il, "Initializing regulatory info from EEPROM\n"); |
388 | 388 | ||
389 | priv->channel_count = | 389 | il->channel_count = |
390 | ARRAY_SIZE(iwlegacy_eeprom_band_1) + | 390 | ARRAY_SIZE(iwlegacy_eeprom_band_1) + |
391 | ARRAY_SIZE(iwlegacy_eeprom_band_2) + | 391 | ARRAY_SIZE(iwlegacy_eeprom_band_2) + |
392 | ARRAY_SIZE(iwlegacy_eeprom_band_3) + | 392 | ARRAY_SIZE(iwlegacy_eeprom_band_3) + |
393 | ARRAY_SIZE(iwlegacy_eeprom_band_4) + | 393 | ARRAY_SIZE(iwlegacy_eeprom_band_4) + |
394 | ARRAY_SIZE(iwlegacy_eeprom_band_5); | 394 | ARRAY_SIZE(iwlegacy_eeprom_band_5); |
395 | 395 | ||
396 | IL_DEBUG_EEPROM(priv, "Parsing data for %d channels.\n", | 396 | IL_DEBUG_EEPROM(il, "Parsing data for %d channels.\n", |
397 | priv->channel_count); | 397 | il->channel_count); |
398 | 398 | ||
399 | priv->channel_info = kzalloc(sizeof(struct il_channel_info) * | 399 | il->channel_info = kzalloc(sizeof(struct il_channel_info) * |
400 | priv->channel_count, GFP_KERNEL); | 400 | il->channel_count, GFP_KERNEL); |
401 | if (!priv->channel_info) { | 401 | if (!il->channel_info) { |
402 | IL_ERR(priv, "Could not allocate channel_info\n"); | 402 | IL_ERR(il, "Could not allocate channel_info\n"); |
403 | priv->channel_count = 0; | 403 | il->channel_count = 0; |
404 | return -ENOMEM; | 404 | return -ENOMEM; |
405 | } | 405 | } |
406 | 406 | ||
407 | ch_info = priv->channel_info; | 407 | ch_info = il->channel_info; |
408 | 408 | ||
409 | /* Loop through the 5 EEPROM bands adding them in order to the | 409 | /* Loop through the 5 EEPROM bands adding them in order to the |
410 | * channel map we maintain (that contains additional information than | 410 | * channel map we maintain (that contains additional information than |
411 | * what just in the EEPROM) */ | 411 | * what just in the EEPROM) */ |
412 | for (band = 1; band <= 5; band++) { | 412 | for (band = 1; band <= 5; band++) { |
413 | 413 | ||
414 | il_init_band_reference(priv, band, &eeprom_ch_count, | 414 | il_init_band_reference(il, band, &eeprom_ch_count, |
415 | &eeprom_ch_info, &eeprom_ch_index); | 415 | &eeprom_ch_info, &eeprom_ch_index); |
416 | 416 | ||
417 | /* Loop through each band adding each of the channels */ | 417 | /* Loop through each band adding each of the channels */ |
@@ -433,7 +433,7 @@ int il_init_channel_map(struct il_priv *priv) | |||
433 | IEEE80211_CHAN_NO_HT40; | 433 | IEEE80211_CHAN_NO_HT40; |
434 | 434 | ||
435 | if (!(il_is_channel_valid(ch_info))) { | 435 | if (!(il_is_channel_valid(ch_info))) { |
436 | IL_DEBUG_EEPROM(priv, | 436 | IL_DEBUG_EEPROM(il, |
437 | "Ch. %d Flags %x [%sGHz] - " | 437 | "Ch. %d Flags %x [%sGHz] - " |
438 | "No traffic\n", | 438 | "No traffic\n", |
439 | ch_info->channel, | 439 | ch_info->channel, |
@@ -450,7 +450,7 @@ int il_init_channel_map(struct il_priv *priv) | |||
450 | ch_info->scan_power = eeprom_ch_info[ch].max_power_avg; | 450 | ch_info->scan_power = eeprom_ch_info[ch].max_power_avg; |
451 | ch_info->min_power = 0; | 451 | ch_info->min_power = 0; |
452 | 452 | ||
453 | IL_DEBUG_EEPROM(priv, "Ch. %d [%sGHz] " | 453 | IL_DEBUG_EEPROM(il, "Ch. %d [%sGHz] " |
454 | "%s%s%s%s%s%s(0x%02x %ddBm):" | 454 | "%s%s%s%s%s%s(0x%02x %ddBm):" |
455 | " Ad-Hoc %ssupported\n", | 455 | " Ad-Hoc %ssupported\n", |
456 | ch_info->channel, | 456 | ch_info->channel, |
@@ -475,9 +475,9 @@ int il_init_channel_map(struct il_priv *priv) | |||
475 | } | 475 | } |
476 | 476 | ||
477 | /* Check if we do have HT40 channels */ | 477 | /* Check if we do have HT40 channels */ |
478 | if (priv->cfg->ops->lib->eeprom_ops.regulatory_bands[5] == | 478 | if (il->cfg->ops->lib->eeprom_ops.regulatory_bands[5] == |
479 | EEPROM_REGULATORY_BAND_NO_HT40 && | 479 | EEPROM_REGULATORY_BAND_NO_HT40 && |
480 | priv->cfg->ops->lib->eeprom_ops.regulatory_bands[6] == | 480 | il->cfg->ops->lib->eeprom_ops.regulatory_bands[6] == |
481 | EEPROM_REGULATORY_BAND_NO_HT40) | 481 | EEPROM_REGULATORY_BAND_NO_HT40) |
482 | return 0; | 482 | return 0; |
483 | 483 | ||
@@ -485,7 +485,7 @@ int il_init_channel_map(struct il_priv *priv) | |||
485 | for (band = 6; band <= 7; band++) { | 485 | for (band = 6; band <= 7; band++) { |
486 | enum ieee80211_band ieeeband; | 486 | enum ieee80211_band ieeeband; |
487 | 487 | ||
488 | il_init_band_reference(priv, band, &eeprom_ch_count, | 488 | il_init_band_reference(il, band, &eeprom_ch_count, |
489 | &eeprom_ch_info, &eeprom_ch_index); | 489 | &eeprom_ch_info, &eeprom_ch_index); |
490 | 490 | ||
491 | /* EEPROM band 6 is 2.4, band 7 is 5 GHz */ | 491 | /* EEPROM band 6 is 2.4, band 7 is 5 GHz */ |
@@ -495,13 +495,13 @@ int il_init_channel_map(struct il_priv *priv) | |||
495 | /* Loop through each band adding each of the channels */ | 495 | /* Loop through each band adding each of the channels */ |
496 | for (ch = 0; ch < eeprom_ch_count; ch++) { | 496 | for (ch = 0; ch < eeprom_ch_count; ch++) { |
497 | /* Set up driver's info for lower half */ | 497 | /* Set up driver's info for lower half */ |
498 | il_mod_ht40_chan_info(priv, ieeeband, | 498 | il_mod_ht40_chan_info(il, ieeeband, |
499 | eeprom_ch_index[ch], | 499 | eeprom_ch_index[ch], |
500 | &eeprom_ch_info[ch], | 500 | &eeprom_ch_info[ch], |
501 | IEEE80211_CHAN_NO_HT40PLUS); | 501 | IEEE80211_CHAN_NO_HT40PLUS); |
502 | 502 | ||
503 | /* Set up driver's info for upper half */ | 503 | /* Set up driver's info for upper half */ |
504 | il_mod_ht40_chan_info(priv, ieeeband, | 504 | il_mod_ht40_chan_info(il, ieeeband, |
505 | eeprom_ch_index[ch] + 4, | 505 | eeprom_ch_index[ch] + 4, |
506 | &eeprom_ch_info[ch], | 506 | &eeprom_ch_info[ch], |
507 | IEEE80211_CHAN_NO_HT40MINUS); | 507 | IEEE80211_CHAN_NO_HT40MINUS); |
@@ -515,34 +515,34 @@ EXPORT_SYMBOL(il_init_channel_map); | |||
515 | /* | 515 | /* |
516 | * il_free_channel_map - undo allocations in il_init_channel_map | 516 | * il_free_channel_map - undo allocations in il_init_channel_map |
517 | */ | 517 | */ |
518 | void il_free_channel_map(struct il_priv *priv) | 518 | void il_free_channel_map(struct il_priv *il) |
519 | { | 519 | { |
520 | kfree(priv->channel_info); | 520 | kfree(il->channel_info); |
521 | priv->channel_count = 0; | 521 | il->channel_count = 0; |
522 | } | 522 | } |
523 | EXPORT_SYMBOL(il_free_channel_map); | 523 | EXPORT_SYMBOL(il_free_channel_map); |
524 | 524 | ||
525 | /** | 525 | /** |
526 | * il_get_channel_info - Find driver's private channel info | 526 | * il_get_channel_info - Find driver's ilate channel info |
527 | * | 527 | * |
528 | * Based on band and channel number. | 528 | * Based on band and channel number. |
529 | */ | 529 | */ |
530 | const struct | 530 | const struct |
531 | il_channel_info *il_get_channel_info(const struct il_priv *priv, | 531 | il_channel_info *il_get_channel_info(const struct il_priv *il, |
532 | enum ieee80211_band band, u16 channel) | 532 | enum ieee80211_band band, u16 channel) |
533 | { | 533 | { |
534 | int i; | 534 | int i; |
535 | 535 | ||
536 | switch (band) { | 536 | switch (band) { |
537 | case IEEE80211_BAND_5GHZ: | 537 | case IEEE80211_BAND_5GHZ: |
538 | for (i = 14; i < priv->channel_count; i++) { | 538 | for (i = 14; i < il->channel_count; i++) { |
539 | if (priv->channel_info[i].channel == channel) | 539 | if (il->channel_info[i].channel == channel) |
540 | return &priv->channel_info[i]; | 540 | return &il->channel_info[i]; |
541 | } | 541 | } |
542 | break; | 542 | break; |
543 | case IEEE80211_BAND_2GHZ: | 543 | case IEEE80211_BAND_2GHZ: |
544 | if (channel >= 1 && channel <= 14) | 544 | if (channel >= 1 && channel <= 14) |
545 | return &priv->channel_info[channel - 1]; | 545 | return &il->channel_info[channel - 1]; |
546 | break; | 546 | break; |
547 | default: | 547 | default: |
548 | BUG(); | 548 | BUG(); |
diff --git a/drivers/net/wireless/iwlegacy/iwl-eeprom.h b/drivers/net/wireless/iwlegacy/iwl-eeprom.h index 9ad68716162..acb5ec17d70 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 { | |||
325 | 325 | ||
326 | struct il_eeprom_ops { | 326 | struct il_eeprom_ops { |
327 | const u32 regulatory_bands[7]; | 327 | const u32 regulatory_bands[7]; |
328 | int (*acquire_semaphore) (struct il_priv *priv); | 328 | int (*acquire_semaphore) (struct il_priv *il); |
329 | void (*release_semaphore) (struct il_priv *priv); | 329 | void (*release_semaphore) (struct il_priv *il); |
330 | }; | 330 | }; |
331 | 331 | ||
332 | 332 | ||
333 | int il_eeprom_init(struct il_priv *priv); | 333 | int il_eeprom_init(struct il_priv *il); |
334 | void il_eeprom_free(struct il_priv *priv); | 334 | void il_eeprom_free(struct il_priv *il); |
335 | const u8 *il_eeprom_query_addr(const struct il_priv *priv, | 335 | const u8 *il_eeprom_query_addr(const struct il_priv *il, |
336 | size_t offset); | 336 | size_t offset); |
337 | u16 il_eeprom_query16(const struct il_priv *priv, size_t offset); | 337 | u16 il_eeprom_query16(const struct il_priv *il, size_t offset); |
338 | int il_init_channel_map(struct il_priv *priv); | 338 | int il_init_channel_map(struct il_priv *il); |
339 | void il_free_channel_map(struct il_priv *priv); | 339 | void il_free_channel_map(struct il_priv *il); |
340 | const struct il_channel_info *il_get_channel_info( | 340 | const struct il_channel_info *il_get_channel_info( |
341 | const struct il_priv *priv, | 341 | const struct il_priv *il, |
342 | enum ieee80211_band band, u16 channel); | 342 | enum ieee80211_band band, u16 channel); |
343 | 343 | ||
344 | #endif /* __il_eeprom_h__ */ | 344 | #endif /* __il_eeprom_h__ */ |
diff --git a/drivers/net/wireless/iwlegacy/iwl-hcmd.c b/drivers/net/wireless/iwlegacy/iwl-hcmd.c index 515befc2800..f16e31109e0 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); | |||
90 | 90 | ||
91 | #define HOST_COMPLETE_TIMEOUT (HZ / 2) | 91 | #define HOST_COMPLETE_TIMEOUT (HZ / 2) |
92 | 92 | ||
93 | static void il_generic_cmd_callback(struct il_priv *priv, | 93 | static void il_generic_cmd_callback(struct il_priv *il, |
94 | struct il_device_cmd *cmd, | 94 | struct il_device_cmd *cmd, |
95 | struct il_rx_packet *pkt) | 95 | struct il_rx_packet *pkt) |
96 | { | 96 | { |
97 | if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { | 97 | if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { |
98 | IL_ERR(priv, "Bad return from %s (0x%08X)\n", | 98 | IL_ERR(il, "Bad return from %s (0x%08X)\n", |
99 | il_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); | 99 | il_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); |
100 | return; | 100 | return; |
101 | } | 101 | } |
@@ -104,18 +104,18 @@ static void il_generic_cmd_callback(struct il_priv *priv, | |||
104 | switch (cmd->hdr.cmd) { | 104 | switch (cmd->hdr.cmd) { |
105 | case REPLY_TX_LINK_QUALITY_CMD: | 105 | case REPLY_TX_LINK_QUALITY_CMD: |
106 | case SENSITIVITY_CMD: | 106 | case SENSITIVITY_CMD: |
107 | IL_DEBUG_HC_DUMP(priv, "back from %s (0x%08X)\n", | 107 | IL_DEBUG_HC_DUMP(il, "back from %s (0x%08X)\n", |
108 | il_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); | 108 | il_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); |
109 | break; | 109 | break; |
110 | default: | 110 | default: |
111 | IL_DEBUG_HC(priv, "back from %s (0x%08X)\n", | 111 | IL_DEBUG_HC(il, "back from %s (0x%08X)\n", |
112 | il_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); | 112 | il_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); |
113 | } | 113 | } |
114 | #endif | 114 | #endif |
115 | } | 115 | } |
116 | 116 | ||
117 | static int | 117 | static int |
118 | il_send_cmd_async(struct il_priv *priv, struct il_host_cmd *cmd) | 118 | il_send_cmd_async(struct il_priv *il, struct il_host_cmd *cmd) |
119 | { | 119 | { |
120 | int ret; | 120 | int ret; |
121 | 121 | ||
@@ -128,57 +128,57 @@ il_send_cmd_async(struct il_priv *priv, struct il_host_cmd *cmd) | |||
128 | if (!cmd->callback) | 128 | if (!cmd->callback) |
129 | cmd->callback = il_generic_cmd_callback; | 129 | cmd->callback = il_generic_cmd_callback; |
130 | 130 | ||
131 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 131 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) |
132 | return -EBUSY; | 132 | return -EBUSY; |
133 | 133 | ||
134 | ret = il_enqueue_hcmd(priv, cmd); | 134 | ret = il_enqueue_hcmd(il, cmd); |
135 | if (ret < 0) { | 135 | if (ret < 0) { |
136 | IL_ERR(priv, "Error sending %s: enqueue_hcmd failed: %d\n", | 136 | IL_ERR(il, "Error sending %s: enqueue_hcmd failed: %d\n", |
137 | il_get_cmd_string(cmd->id), ret); | 137 | il_get_cmd_string(cmd->id), ret); |
138 | return ret; | 138 | return ret; |
139 | } | 139 | } |
140 | return 0; | 140 | return 0; |
141 | } | 141 | } |
142 | 142 | ||
143 | int il_send_cmd_sync(struct il_priv *priv, struct il_host_cmd *cmd) | 143 | int il_send_cmd_sync(struct il_priv *il, struct il_host_cmd *cmd) |
144 | { | 144 | { |
145 | int cmd_idx; | 145 | int cmd_idx; |
146 | int ret; | 146 | int ret; |
147 | 147 | ||
148 | lockdep_assert_held(&priv->mutex); | 148 | lockdep_assert_held(&il->mutex); |
149 | 149 | ||
150 | BUG_ON(cmd->flags & CMD_ASYNC); | 150 | BUG_ON(cmd->flags & CMD_ASYNC); |
151 | 151 | ||
152 | /* A synchronous command can not have a callback set. */ | 152 | /* A synchronous command can not have a callback set. */ |
153 | BUG_ON(cmd->callback); | 153 | BUG_ON(cmd->callback); |
154 | 154 | ||
155 | IL_DEBUG_INFO(priv, "Attempting to send sync command %s\n", | 155 | IL_DEBUG_INFO(il, "Attempting to send sync command %s\n", |
156 | il_get_cmd_string(cmd->id)); | 156 | il_get_cmd_string(cmd->id)); |
157 | 157 | ||
158 | set_bit(STATUS_HCMD_ACTIVE, &priv->status); | 158 | set_bit(STATUS_HCMD_ACTIVE, &il->status); |
159 | IL_DEBUG_INFO(priv, "Setting HCMD_ACTIVE for command %s\n", | 159 | IL_DEBUG_INFO(il, "Setting HCMD_ACTIVE for command %s\n", |
160 | il_get_cmd_string(cmd->id)); | 160 | il_get_cmd_string(cmd->id)); |
161 | 161 | ||
162 | cmd_idx = il_enqueue_hcmd(priv, cmd); | 162 | cmd_idx = il_enqueue_hcmd(il, cmd); |
163 | if (cmd_idx < 0) { | 163 | if (cmd_idx < 0) { |
164 | ret = cmd_idx; | 164 | ret = cmd_idx; |
165 | IL_ERR(priv, "Error sending %s: enqueue_hcmd failed: %d\n", | 165 | IL_ERR(il, "Error sending %s: enqueue_hcmd failed: %d\n", |
166 | il_get_cmd_string(cmd->id), ret); | 166 | il_get_cmd_string(cmd->id), ret); |
167 | goto out; | 167 | goto out; |
168 | } | 168 | } |
169 | 169 | ||
170 | ret = wait_event_timeout(priv->wait_command_queue, | 170 | ret = wait_event_timeout(il->wait_command_queue, |
171 | !test_bit(STATUS_HCMD_ACTIVE, &priv->status), | 171 | !test_bit(STATUS_HCMD_ACTIVE, &il->status), |
172 | HOST_COMPLETE_TIMEOUT); | 172 | HOST_COMPLETE_TIMEOUT); |
173 | if (!ret) { | 173 | if (!ret) { |
174 | if (test_bit(STATUS_HCMD_ACTIVE, &priv->status)) { | 174 | if (test_bit(STATUS_HCMD_ACTIVE, &il->status)) { |
175 | IL_ERR(priv, | 175 | IL_ERR(il, |
176 | "Error sending %s: time out after %dms.\n", | 176 | "Error sending %s: time out after %dms.\n", |
177 | il_get_cmd_string(cmd->id), | 177 | il_get_cmd_string(cmd->id), |
178 | jiffies_to_msecs(HOST_COMPLETE_TIMEOUT)); | 178 | jiffies_to_msecs(HOST_COMPLETE_TIMEOUT)); |
179 | 179 | ||
180 | clear_bit(STATUS_HCMD_ACTIVE, &priv->status); | 180 | clear_bit(STATUS_HCMD_ACTIVE, &il->status); |
181 | IL_DEBUG_INFO(priv, | 181 | IL_DEBUG_INFO(il, |
182 | "Clearing HCMD_ACTIVE for command %s\n", | 182 | "Clearing HCMD_ACTIVE for command %s\n", |
183 | il_get_cmd_string(cmd->id)); | 183 | il_get_cmd_string(cmd->id)); |
184 | ret = -ETIMEDOUT; | 184 | ret = -ETIMEDOUT; |
@@ -186,20 +186,20 @@ int il_send_cmd_sync(struct il_priv *priv, struct il_host_cmd *cmd) | |||
186 | } | 186 | } |
187 | } | 187 | } |
188 | 188 | ||
189 | if (test_bit(STATUS_RF_KILL_HW, &priv->status)) { | 189 | if (test_bit(STATUS_RF_KILL_HW, &il->status)) { |
190 | IL_ERR(priv, "Command %s aborted: RF KILL Switch\n", | 190 | IL_ERR(il, "Command %s aborted: RF KILL Switch\n", |
191 | il_get_cmd_string(cmd->id)); | 191 | il_get_cmd_string(cmd->id)); |
192 | ret = -ECANCELED; | 192 | ret = -ECANCELED; |
193 | goto fail; | 193 | goto fail; |
194 | } | 194 | } |
195 | if (test_bit(STATUS_FW_ERROR, &priv->status)) { | 195 | if (test_bit(STATUS_FW_ERROR, &il->status)) { |
196 | IL_ERR(priv, "Command %s failed: FW Error\n", | 196 | IL_ERR(il, "Command %s failed: FW Error\n", |
197 | il_get_cmd_string(cmd->id)); | 197 | il_get_cmd_string(cmd->id)); |
198 | ret = -EIO; | 198 | ret = -EIO; |
199 | goto fail; | 199 | goto fail; |
200 | } | 200 | } |
201 | if ((cmd->flags & CMD_WANT_SKB) && !cmd->reply_page) { | 201 | if ((cmd->flags & CMD_WANT_SKB) && !cmd->reply_page) { |
202 | IL_ERR(priv, "Error: Response NULL in '%s'\n", | 202 | IL_ERR(il, "Error: Response NULL in '%s'\n", |
203 | il_get_cmd_string(cmd->id)); | 203 | il_get_cmd_string(cmd->id)); |
204 | ret = -EIO; | 204 | ret = -EIO; |
205 | goto cancel; | 205 | goto cancel; |
@@ -216,12 +216,12 @@ cancel: | |||
216 | * in later, it will possibly set an invalid | 216 | * in later, it will possibly set an invalid |
217 | * address (cmd->meta.source). | 217 | * address (cmd->meta.source). |
218 | */ | 218 | */ |
219 | priv->txq[priv->cmd_queue].meta[cmd_idx].flags &= | 219 | il->txq[il->cmd_queue].meta[cmd_idx].flags &= |
220 | ~CMD_WANT_SKB; | 220 | ~CMD_WANT_SKB; |
221 | } | 221 | } |
222 | fail: | 222 | fail: |
223 | if (cmd->reply_page) { | 223 | if (cmd->reply_page) { |
224 | il_free_pages(priv, cmd->reply_page); | 224 | il_free_pages(il, cmd->reply_page); |
225 | cmd->reply_page = 0; | 225 | cmd->reply_page = 0; |
226 | } | 226 | } |
227 | out: | 227 | out: |
@@ -229,17 +229,17 @@ out: | |||
229 | } | 229 | } |
230 | EXPORT_SYMBOL(il_send_cmd_sync); | 230 | EXPORT_SYMBOL(il_send_cmd_sync); |
231 | 231 | ||
232 | int il_send_cmd(struct il_priv *priv, struct il_host_cmd *cmd) | 232 | int il_send_cmd(struct il_priv *il, struct il_host_cmd *cmd) |
233 | { | 233 | { |
234 | if (cmd->flags & CMD_ASYNC) | 234 | if (cmd->flags & CMD_ASYNC) |
235 | return il_send_cmd_async(priv, cmd); | 235 | return il_send_cmd_async(il, cmd); |
236 | 236 | ||
237 | return il_send_cmd_sync(priv, cmd); | 237 | return il_send_cmd_sync(il, cmd); |
238 | } | 238 | } |
239 | EXPORT_SYMBOL(il_send_cmd); | 239 | EXPORT_SYMBOL(il_send_cmd); |
240 | 240 | ||
241 | int | 241 | int |
242 | il_send_cmd_pdu(struct il_priv *priv, u8 id, u16 len, const void *data) | 242 | il_send_cmd_pdu(struct il_priv *il, u8 id, u16 len, const void *data) |
243 | { | 243 | { |
244 | struct il_host_cmd cmd = { | 244 | struct il_host_cmd cmd = { |
245 | .id = id, | 245 | .id = id, |
@@ -247,13 +247,13 @@ il_send_cmd_pdu(struct il_priv *priv, u8 id, u16 len, const void *data) | |||
247 | .data = data, | 247 | .data = data, |
248 | }; | 248 | }; |
249 | 249 | ||
250 | return il_send_cmd_sync(priv, &cmd); | 250 | return il_send_cmd_sync(il, &cmd); |
251 | } | 251 | } |
252 | EXPORT_SYMBOL(il_send_cmd_pdu); | 252 | EXPORT_SYMBOL(il_send_cmd_pdu); |
253 | 253 | ||
254 | int il_send_cmd_pdu_async(struct il_priv *priv, | 254 | int il_send_cmd_pdu_async(struct il_priv *il, |
255 | u8 id, u16 len, const void *data, | 255 | u8 id, u16 len, const void *data, |
256 | void (*callback)(struct il_priv *priv, | 256 | void (*callback)(struct il_priv *il, |
257 | struct il_device_cmd *cmd, | 257 | struct il_device_cmd *cmd, |
258 | struct il_rx_packet *pkt)) | 258 | struct il_rx_packet *pkt)) |
259 | { | 259 | { |
@@ -266,6 +266,6 @@ int il_send_cmd_pdu_async(struct il_priv *priv, | |||
266 | cmd.flags |= CMD_ASYNC; | 266 | cmd.flags |= CMD_ASYNC; |
267 | cmd.callback = callback; | 267 | cmd.callback = callback; |
268 | 268 | ||
269 | return il_send_cmd_async(priv, &cmd); | 269 | return il_send_cmd_async(il, &cmd); |
270 | } | 270 | } |
271 | EXPORT_SYMBOL(il_send_cmd_pdu_async); | 271 | 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 e4e63b570f5..e55f2ef1c57 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) | |||
108 | txq->swq_id = (hwq << 2) | ac; | 108 | txq->swq_id = (hwq << 2) | ac; |
109 | } | 109 | } |
110 | 110 | ||
111 | static inline void il_wake_queue(struct il_priv *priv, | 111 | static inline void il_wake_queue(struct il_priv *il, |
112 | struct il_tx_queue *txq) | 112 | struct il_tx_queue *txq) |
113 | { | 113 | { |
114 | u8 queue = txq->swq_id; | 114 | u8 queue = txq->swq_id; |
115 | u8 ac = queue & 3; | 115 | u8 ac = queue & 3; |
116 | u8 hwq = (queue >> 2) & 0x1f; | 116 | u8 hwq = (queue >> 2) & 0x1f; |
117 | 117 | ||
118 | if (test_and_clear_bit(hwq, priv->queue_stopped)) | 118 | if (test_and_clear_bit(hwq, il->queue_stopped)) |
119 | if (atomic_dec_return(&priv->queue_stop_count[ac]) <= 0) | 119 | if (atomic_dec_return(&il->queue_stop_count[ac]) <= 0) |
120 | ieee80211_wake_queue(priv->hw, ac); | 120 | ieee80211_wake_queue(il->hw, ac); |
121 | } | 121 | } |
122 | 122 | ||
123 | static inline void il_stop_queue(struct il_priv *priv, | 123 | static inline void il_stop_queue(struct il_priv *il, |
124 | struct il_tx_queue *txq) | 124 | struct il_tx_queue *txq) |
125 | { | 125 | { |
126 | u8 queue = txq->swq_id; | 126 | u8 queue = txq->swq_id; |
127 | u8 ac = queue & 3; | 127 | u8 ac = queue & 3; |
128 | u8 hwq = (queue >> 2) & 0x1f; | 128 | u8 hwq = (queue >> 2) & 0x1f; |
129 | 129 | ||
130 | if (!test_and_set_bit(hwq, priv->queue_stopped)) | 130 | if (!test_and_set_bit(hwq, il->queue_stopped)) |
131 | if (atomic_inc_return(&priv->queue_stop_count[ac]) > 0) | 131 | if (atomic_inc_return(&il->queue_stop_count[ac]) > 0) |
132 | ieee80211_stop_queue(priv->hw, ac); | 132 | ieee80211_stop_queue(il->hw, ac); |
133 | } | 133 | } |
134 | 134 | ||
135 | #ifdef ieee80211_stop_queue | 135 | #ifdef ieee80211_stop_queue |
@@ -144,39 +144,39 @@ static inline void il_stop_queue(struct il_priv *priv, | |||
144 | 144 | ||
145 | #define ieee80211_wake_queue DO_NOT_USE_ieee80211_wake_queue | 145 | #define ieee80211_wake_queue DO_NOT_USE_ieee80211_wake_queue |
146 | 146 | ||
147 | static inline void il_disable_interrupts(struct il_priv *priv) | 147 | static inline void il_disable_interrupts(struct il_priv *il) |
148 | { | 148 | { |
149 | clear_bit(STATUS_INT_ENABLED, &priv->status); | 149 | clear_bit(STATUS_INT_ENABLED, &il->status); |
150 | 150 | ||
151 | /* disable interrupts from uCode/NIC to host */ | 151 | /* disable interrupts from uCode/NIC to host */ |
152 | il_write32(priv, CSR_INT_MASK, 0x00000000); | 152 | il_write32(il, CSR_INT_MASK, 0x00000000); |
153 | 153 | ||
154 | /* acknowledge/clear/reset any interrupts still pending | 154 | /* acknowledge/clear/reset any interrupts still pending |
155 | * from uCode or flow handler (Rx/Tx DMA) */ | 155 | * from uCode or flow handler (Rx/Tx DMA) */ |
156 | il_write32(priv, CSR_INT, 0xffffffff); | 156 | il_write32(il, CSR_INT, 0xffffffff); |
157 | il_write32(priv, CSR_FH_INT_STATUS, 0xffffffff); | 157 | il_write32(il, CSR_FH_INT_STATUS, 0xffffffff); |
158 | IL_DEBUG_ISR(priv, "Disabled interrupts\n"); | 158 | IL_DEBUG_ISR(il, "Disabled interrupts\n"); |
159 | } | 159 | } |
160 | 160 | ||
161 | static inline void il_enable_rfkill_int(struct il_priv *priv) | 161 | static inline void il_enable_rfkill_int(struct il_priv *il) |
162 | { | 162 | { |
163 | IL_DEBUG_ISR(priv, "Enabling rfkill interrupt\n"); | 163 | IL_DEBUG_ISR(il, "Enabling rfkill interrupt\n"); |
164 | il_write32(priv, CSR_INT_MASK, CSR_INT_BIT_RF_KILL); | 164 | il_write32(il, CSR_INT_MASK, CSR_INT_BIT_RF_KILL); |
165 | } | 165 | } |
166 | 166 | ||
167 | static inline void il_enable_interrupts(struct il_priv *priv) | 167 | static inline void il_enable_interrupts(struct il_priv *il) |
168 | { | 168 | { |
169 | IL_DEBUG_ISR(priv, "Enabling interrupts\n"); | 169 | IL_DEBUG_ISR(il, "Enabling interrupts\n"); |
170 | set_bit(STATUS_INT_ENABLED, &priv->status); | 170 | set_bit(STATUS_INT_ENABLED, &il->status); |
171 | il_write32(priv, CSR_INT_MASK, priv->inta_mask); | 171 | il_write32(il, CSR_INT_MASK, il->inta_mask); |
172 | } | 172 | } |
173 | 173 | ||
174 | /** | 174 | /** |
175 | * il_beacon_time_mask_low - mask of lower 32 bit of beacon time | 175 | * il_beacon_time_mask_low - mask of lower 32 bit of beacon time |
176 | * @priv -- pointer to il_priv data structure | 176 | * @il -- pointer to il_priv data structure |
177 | * @tsf_bits -- number of bits need to shift for masking) | 177 | * @tsf_bits -- number of bits need to shift for masking) |
178 | */ | 178 | */ |
179 | static inline u32 il_beacon_time_mask_low(struct il_priv *priv, | 179 | static inline u32 il_beacon_time_mask_low(struct il_priv *il, |
180 | u16 tsf_bits) | 180 | u16 tsf_bits) |
181 | { | 181 | { |
182 | return (1 << tsf_bits) - 1; | 182 | return (1 << tsf_bits) - 1; |
@@ -184,10 +184,10 @@ static inline u32 il_beacon_time_mask_low(struct il_priv *priv, | |||
184 | 184 | ||
185 | /** | 185 | /** |
186 | * il_beacon_time_mask_high - mask of higher 32 bit of beacon time | 186 | * il_beacon_time_mask_high - mask of higher 32 bit of beacon time |
187 | * @priv -- pointer to il_priv data structure | 187 | * @il -- pointer to il_priv data structure |
188 | * @tsf_bits -- number of bits need to shift for masking) | 188 | * @tsf_bits -- number of bits need to shift for masking) |
189 | */ | 189 | */ |
190 | static inline u32 il_beacon_time_mask_high(struct il_priv *priv, | 190 | static inline u32 il_beacon_time_mask_high(struct il_priv *il, |
191 | u16 tsf_bits) | 191 | u16 tsf_bits) |
192 | { | 192 | { |
193 | return ((1 << (32 - tsf_bits)) - 1) << tsf_bits; | 193 | return ((1 << (32 - tsf_bits)) - 1) << tsf_bits; |
diff --git a/drivers/net/wireless/iwlegacy/iwl-io.h b/drivers/net/wireless/iwlegacy/iwl-io.h index ebeb6e2aa6e..42d241fd6ac 100644 --- a/drivers/net/wireless/iwlegacy/iwl-io.h +++ b/drivers/net/wireless/iwlegacy/iwl-io.h | |||
@@ -62,72 +62,72 @@ | |||
62 | * | 62 | * |
63 | */ | 63 | */ |
64 | 64 | ||
65 | static inline void _il_write8(struct il_priv *priv, u32 ofs, u8 val) | 65 | static inline void _il_write8(struct il_priv *il, u32 ofs, u8 val) |
66 | { | 66 | { |
67 | iowrite8(val, priv->hw_base + ofs); | 67 | iowrite8(val, il->hw_base + ofs); |
68 | } | 68 | } |
69 | 69 | ||
70 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 70 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
71 | static inline void | 71 | static inline void |
72 | __il_write8(const char *f, u32 l, struct il_priv *priv, | 72 | __il_write8(const char *f, u32 l, struct il_priv *il, |
73 | u32 ofs, u8 val) | 73 | u32 ofs, u8 val) |
74 | { | 74 | { |
75 | IL_DEBUG_IO(priv, "write8(0x%08X, 0x%02X) - %s %d\n", ofs, val, f, l); | 75 | IL_DEBUG_IO(il, "write8(0x%08X, 0x%02X) - %s %d\n", ofs, val, f, l); |
76 | _il_write8(priv, ofs, val); | 76 | _il_write8(il, ofs, val); |
77 | } | 77 | } |
78 | #define il_write8(priv, ofs, val) \ | 78 | #define il_write8(il, ofs, val) \ |
79 | __il_write8(__FILE__, __LINE__, priv, ofs, val) | 79 | __il_write8(__FILE__, __LINE__, il, ofs, val) |
80 | #else | 80 | #else |
81 | #define il_write8(priv, ofs, val) _il_write8(priv, ofs, val) | 81 | #define il_write8(il, ofs, val) _il_write8(il, ofs, val) |
82 | #endif | 82 | #endif |
83 | 83 | ||
84 | 84 | ||
85 | static inline void _il_write32(struct il_priv *priv, u32 ofs, u32 val) | 85 | static inline void _il_write32(struct il_priv *il, u32 ofs, u32 val) |
86 | { | 86 | { |
87 | iowrite32(val, priv->hw_base + ofs); | 87 | iowrite32(val, il->hw_base + ofs); |
88 | } | 88 | } |
89 | 89 | ||
90 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 90 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
91 | static inline void | 91 | static inline void |
92 | __il_write32(const char *f, u32 l, struct il_priv *priv, | 92 | __il_write32(const char *f, u32 l, struct il_priv *il, |
93 | u32 ofs, u32 val) | 93 | u32 ofs, u32 val) |
94 | { | 94 | { |
95 | IL_DEBUG_IO(priv, "write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l); | 95 | IL_DEBUG_IO(il, "write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l); |
96 | _il_write32(priv, ofs, val); | 96 | _il_write32(il, ofs, val); |
97 | } | 97 | } |
98 | #define il_write32(priv, ofs, val) \ | 98 | #define il_write32(il, ofs, val) \ |
99 | __il_write32(__FILE__, __LINE__, priv, ofs, val) | 99 | __il_write32(__FILE__, __LINE__, il, ofs, val) |
100 | #else | 100 | #else |
101 | #define il_write32(priv, ofs, val) _il_write32(priv, ofs, val) | 101 | #define il_write32(il, ofs, val) _il_write32(il, ofs, val) |
102 | #endif | 102 | #endif |
103 | 103 | ||
104 | static inline u32 _il_read32(struct il_priv *priv, u32 ofs) | 104 | static inline u32 _il_read32(struct il_priv *il, u32 ofs) |
105 | { | 105 | { |
106 | u32 val = ioread32(priv->hw_base + ofs); | 106 | u32 val = ioread32(il->hw_base + ofs); |
107 | return val; | 107 | return val; |
108 | } | 108 | } |
109 | 109 | ||
110 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 110 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
111 | static inline u32 | 111 | static inline u32 |
112 | __il_read32(char *f, u32 l, struct il_priv *priv, u32 ofs) | 112 | __il_read32(char *f, u32 l, struct il_priv *il, u32 ofs) |
113 | { | 113 | { |
114 | IL_DEBUG_IO(priv, "read_direct32(0x%08X) - %s %d\n", ofs, f, l); | 114 | IL_DEBUG_IO(il, "read_direct32(0x%08X) - %s %d\n", ofs, f, l); |
115 | return _il_read32(priv, ofs); | 115 | return _il_read32(il, ofs); |
116 | } | 116 | } |
117 | #define il_read32(priv, ofs) __il_read32(__FILE__, __LINE__, priv, ofs) | 117 | #define il_read32(il, ofs) __il_read32(__FILE__, __LINE__, il, ofs) |
118 | #else | 118 | #else |
119 | #define il_read32(p, o) _il_read32(p, o) | 119 | #define il_read32(p, o) _il_read32(p, o) |
120 | #endif | 120 | #endif |
121 | 121 | ||
122 | #define IL_POLL_INTERVAL 10 /* microseconds */ | 122 | #define IL_POLL_INTERVAL 10 /* microseconds */ |
123 | static inline int | 123 | static inline int |
124 | _il_poll_bit(struct il_priv *priv, u32 addr, | 124 | _il_poll_bit(struct il_priv *il, u32 addr, |
125 | u32 bits, u32 mask, int timeout) | 125 | u32 bits, u32 mask, int timeout) |
126 | { | 126 | { |
127 | int t = 0; | 127 | int t = 0; |
128 | 128 | ||
129 | do { | 129 | do { |
130 | if ((_il_read32(priv, addr) & mask) == (bits & mask)) | 130 | if ((_il_read32(il, addr) & mask) == (bits & mask)) |
131 | return t; | 131 | return t; |
132 | udelay(IL_POLL_INTERVAL); | 132 | udelay(IL_POLL_INTERVAL); |
133 | t += IL_POLL_INTERVAL; | 133 | t += IL_POLL_INTERVAL; |
@@ -137,34 +137,34 @@ _il_poll_bit(struct il_priv *priv, u32 addr, | |||
137 | } | 137 | } |
138 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 138 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
139 | static inline int __il_poll_bit(const char *f, u32 l, | 139 | static inline int __il_poll_bit(const char *f, u32 l, |
140 | struct il_priv *priv, u32 addr, | 140 | struct il_priv *il, u32 addr, |
141 | u32 bits, u32 mask, int timeout) | 141 | u32 bits, u32 mask, int timeout) |
142 | { | 142 | { |
143 | int ret = _il_poll_bit(priv, addr, bits, mask, timeout); | 143 | int ret = _il_poll_bit(il, addr, bits, mask, timeout); |
144 | IL_DEBUG_IO(priv, "poll_bit(0x%08X, 0x%08X, 0x%08X) - %s- %s %d\n", | 144 | IL_DEBUG_IO(il, "poll_bit(0x%08X, 0x%08X, 0x%08X) - %s- %s %d\n", |
145 | addr, bits, mask, | 145 | addr, bits, mask, |
146 | unlikely(ret == -ETIMEDOUT) ? "timeout" : "", f, l); | 146 | unlikely(ret == -ETIMEDOUT) ? "timeout" : "", f, l); |
147 | return ret; | 147 | return ret; |
148 | } | 148 | } |
149 | #define il_poll_bit(priv, addr, bits, mask, timeout) \ | 149 | #define il_poll_bit(il, addr, bits, mask, timeout) \ |
150 | __il_poll_bit(__FILE__, __LINE__, priv, addr, \ | 150 | __il_poll_bit(__FILE__, __LINE__, il, addr, \ |
151 | bits, mask, timeout) | 151 | bits, mask, timeout) |
152 | #else | 152 | #else |
153 | #define il_poll_bit(p, a, b, m, t) _il_poll_bit(p, a, b, m, t) | 153 | #define il_poll_bit(p, a, b, m, t) _il_poll_bit(p, a, b, m, t) |
154 | #endif | 154 | #endif |
155 | 155 | ||
156 | static inline void _il_set_bit(struct il_priv *priv, u32 reg, u32 mask) | 156 | static inline void _il_set_bit(struct il_priv *il, u32 reg, u32 mask) |
157 | { | 157 | { |
158 | _il_write32(priv, reg, _il_read32(priv, reg) | mask); | 158 | _il_write32(il, reg, _il_read32(il, reg) | mask); |
159 | } | 159 | } |
160 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 160 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
161 | static inline void __il_set_bit(const char *f, u32 l, | 161 | static inline void __il_set_bit(const char *f, u32 l, |
162 | struct il_priv *priv, u32 reg, u32 mask) | 162 | struct il_priv *il, u32 reg, u32 mask) |
163 | { | 163 | { |
164 | u32 val = _il_read32(priv, reg) | mask; | 164 | u32 val = _il_read32(il, reg) | mask; |
165 | IL_DEBUG_IO(priv, "set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, | 165 | IL_DEBUG_IO(il, "set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, |
166 | mask, val); | 166 | mask, val); |
167 | _il_write32(priv, reg, val); | 167 | _il_write32(il, reg, val); |
168 | } | 168 | } |
169 | static inline void il_set_bit(struct il_priv *p, u32 r, u32 m) | 169 | static inline void il_set_bit(struct il_priv *p, u32 r, u32 m) |
170 | { | 170 | { |
@@ -186,18 +186,18 @@ static inline void il_set_bit(struct il_priv *p, u32 r, u32 m) | |||
186 | #endif | 186 | #endif |
187 | 187 | ||
188 | static inline void | 188 | static inline void |
189 | _il_clear_bit(struct il_priv *priv, u32 reg, u32 mask) | 189 | _il_clear_bit(struct il_priv *il, u32 reg, u32 mask) |
190 | { | 190 | { |
191 | _il_write32(priv, reg, _il_read32(priv, reg) & ~mask); | 191 | _il_write32(il, reg, _il_read32(il, reg) & ~mask); |
192 | } | 192 | } |
193 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 193 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
194 | static inline void | 194 | static inline void |
195 | __il_clear_bit(const char *f, u32 l, | 195 | __il_clear_bit(const char *f, u32 l, |
196 | struct il_priv *priv, u32 reg, u32 mask) | 196 | struct il_priv *il, u32 reg, u32 mask) |
197 | { | 197 | { |
198 | u32 val = _il_read32(priv, reg) & ~mask; | 198 | u32 val = _il_read32(il, reg) & ~mask; |
199 | IL_DEBUG_IO(priv, "clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); | 199 | IL_DEBUG_IO(il, "clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); |
200 | _il_write32(priv, reg, val); | 200 | _il_write32(il, reg, val); |
201 | } | 201 | } |
202 | static inline void il_clear_bit(struct il_priv *p, u32 r, u32 m) | 202 | static inline void il_clear_bit(struct il_priv *p, u32 r, u32 m) |
203 | { | 203 | { |
@@ -218,13 +218,13 @@ static inline void il_clear_bit(struct il_priv *p, u32 r, u32 m) | |||
218 | } | 218 | } |
219 | #endif | 219 | #endif |
220 | 220 | ||
221 | static inline int _il_grab_nic_access(struct il_priv *priv) | 221 | static inline int _il_grab_nic_access(struct il_priv *il) |
222 | { | 222 | { |
223 | int ret; | 223 | int ret; |
224 | u32 val; | 224 | u32 val; |
225 | 225 | ||
226 | /* this bit wakes up the NIC */ | 226 | /* this bit wakes up the NIC */ |
227 | _il_set_bit(priv, CSR_GP_CNTRL, | 227 | _il_set_bit(il, CSR_GP_CNTRL, |
228 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); | 228 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); |
229 | 229 | ||
230 | /* | 230 | /* |
@@ -244,15 +244,15 @@ static inline int _il_grab_nic_access(struct il_priv *priv) | |||
244 | * good idea before accessing 3945/4965 SRAM (e.g. reading Event Log). | 244 | * good idea before accessing 3945/4965 SRAM (e.g. reading Event Log). |
245 | * | 245 | * |
246 | */ | 246 | */ |
247 | ret = _il_poll_bit(priv, CSR_GP_CNTRL, | 247 | ret = _il_poll_bit(il, CSR_GP_CNTRL, |
248 | CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN, | 248 | CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN, |
249 | (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY | | 249 | (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY | |
250 | CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 15000); | 250 | CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 15000); |
251 | if (ret < 0) { | 251 | if (ret < 0) { |
252 | val = _il_read32(priv, CSR_GP_CNTRL); | 252 | val = _il_read32(il, CSR_GP_CNTRL); |
253 | IL_ERR(priv, | 253 | IL_ERR(il, |
254 | "MAC is in deep sleep!. CSR_GP_CNTRL = 0x%08X\n", val); | 254 | "MAC is in deep sleep!. CSR_GP_CNTRL = 0x%08X\n", val); |
255 | _il_write32(priv, CSR_RESET, | 255 | _il_write32(il, CSR_RESET, |
256 | CSR_RESET_REG_FLAG_FORCE_NMI); | 256 | CSR_RESET_REG_FLAG_FORCE_NMI); |
257 | return -EIO; | 257 | return -EIO; |
258 | } | 258 | } |
@@ -262,117 +262,117 @@ static inline int _il_grab_nic_access(struct il_priv *priv) | |||
262 | 262 | ||
263 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 263 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
264 | static inline int __il_grab_nic_access(const char *f, u32 l, | 264 | static inline int __il_grab_nic_access(const char *f, u32 l, |
265 | struct il_priv *priv) | 265 | struct il_priv *il) |
266 | { | 266 | { |
267 | IL_DEBUG_IO(priv, "grabbing nic access - %s %d\n", f, l); | 267 | IL_DEBUG_IO(il, "grabbing nic access - %s %d\n", f, l); |
268 | return _il_grab_nic_access(priv); | 268 | return _il_grab_nic_access(il); |
269 | } | 269 | } |
270 | #define il_grab_nic_access(priv) \ | 270 | #define il_grab_nic_access(il) \ |
271 | __il_grab_nic_access(__FILE__, __LINE__, priv) | 271 | __il_grab_nic_access(__FILE__, __LINE__, il) |
272 | #else | 272 | #else |
273 | #define il_grab_nic_access(priv) \ | 273 | #define il_grab_nic_access(il) \ |
274 | _il_grab_nic_access(priv) | 274 | _il_grab_nic_access(il) |
275 | #endif | 275 | #endif |
276 | 276 | ||
277 | static inline void _il_release_nic_access(struct il_priv *priv) | 277 | static inline void _il_release_nic_access(struct il_priv *il) |
278 | { | 278 | { |
279 | _il_clear_bit(priv, CSR_GP_CNTRL, | 279 | _il_clear_bit(il, CSR_GP_CNTRL, |
280 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); | 280 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); |
281 | } | 281 | } |
282 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 282 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
283 | static inline void __il_release_nic_access(const char *f, u32 l, | 283 | static inline void __il_release_nic_access(const char *f, u32 l, |
284 | struct il_priv *priv) | 284 | struct il_priv *il) |
285 | { | 285 | { |
286 | 286 | ||
287 | IL_DEBUG_IO(priv, "releasing nic access - %s %d\n", f, l); | 287 | IL_DEBUG_IO(il, "releasing nic access - %s %d\n", f, l); |
288 | _il_release_nic_access(priv); | 288 | _il_release_nic_access(il); |
289 | } | 289 | } |
290 | #define il_release_nic_access(priv) \ | 290 | #define il_release_nic_access(il) \ |
291 | __il_release_nic_access(__FILE__, __LINE__, priv) | 291 | __il_release_nic_access(__FILE__, __LINE__, il) |
292 | #else | 292 | #else |
293 | #define il_release_nic_access(priv) \ | 293 | #define il_release_nic_access(il) \ |
294 | _il_release_nic_access(priv) | 294 | _il_release_nic_access(il) |
295 | #endif | 295 | #endif |
296 | 296 | ||
297 | static inline u32 _il_read_direct32(struct il_priv *priv, u32 reg) | 297 | static inline u32 _il_read_direct32(struct il_priv *il, u32 reg) |
298 | { | 298 | { |
299 | return _il_read32(priv, reg); | 299 | return _il_read32(il, reg); |
300 | } | 300 | } |
301 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 301 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
302 | static inline u32 __il_read_direct32(const char *f, u32 l, | 302 | static inline u32 __il_read_direct32(const char *f, u32 l, |
303 | struct il_priv *priv, u32 reg) | 303 | struct il_priv *il, u32 reg) |
304 | { | 304 | { |
305 | u32 value = _il_read_direct32(priv, reg); | 305 | u32 value = _il_read_direct32(il, reg); |
306 | IL_DEBUG_IO(priv, | 306 | IL_DEBUG_IO(il, |
307 | "read_direct32(0x%4X) = 0x%08x - %s %d\n", reg, value, | 307 | "read_direct32(0x%4X) = 0x%08x - %s %d\n", reg, value, |
308 | f, l); | 308 | f, l); |
309 | return value; | 309 | return value; |
310 | } | 310 | } |
311 | static inline u32 il_read_direct32(struct il_priv *priv, u32 reg) | 311 | static inline u32 il_read_direct32(struct il_priv *il, u32 reg) |
312 | { | 312 | { |
313 | u32 value; | 313 | u32 value; |
314 | unsigned long reg_flags; | 314 | unsigned long reg_flags; |
315 | 315 | ||
316 | spin_lock_irqsave(&priv->reg_lock, reg_flags); | 316 | spin_lock_irqsave(&il->reg_lock, reg_flags); |
317 | il_grab_nic_access(priv); | 317 | il_grab_nic_access(il); |
318 | value = __il_read_direct32(__FILE__, __LINE__, priv, reg); | 318 | value = __il_read_direct32(__FILE__, __LINE__, il, reg); |
319 | il_release_nic_access(priv); | 319 | il_release_nic_access(il); |
320 | spin_unlock_irqrestore(&priv->reg_lock, reg_flags); | 320 | spin_unlock_irqrestore(&il->reg_lock, reg_flags); |
321 | return value; | 321 | return value; |
322 | } | 322 | } |
323 | 323 | ||
324 | #else | 324 | #else |
325 | static inline u32 il_read_direct32(struct il_priv *priv, u32 reg) | 325 | static inline u32 il_read_direct32(struct il_priv *il, u32 reg) |
326 | { | 326 | { |
327 | u32 value; | 327 | u32 value; |
328 | unsigned long reg_flags; | 328 | unsigned long reg_flags; |
329 | 329 | ||
330 | spin_lock_irqsave(&priv->reg_lock, reg_flags); | 330 | spin_lock_irqsave(&il->reg_lock, reg_flags); |
331 | il_grab_nic_access(priv); | 331 | il_grab_nic_access(il); |
332 | value = _il_read_direct32(priv, reg); | 332 | value = _il_read_direct32(il, reg); |
333 | il_release_nic_access(priv); | 333 | il_release_nic_access(il); |
334 | spin_unlock_irqrestore(&priv->reg_lock, reg_flags); | 334 | spin_unlock_irqrestore(&il->reg_lock, reg_flags); |
335 | return value; | 335 | return value; |
336 | 336 | ||
337 | } | 337 | } |
338 | #endif | 338 | #endif |
339 | 339 | ||
340 | static inline void _il_write_direct32(struct il_priv *priv, | 340 | static inline void _il_write_direct32(struct il_priv *il, |
341 | u32 reg, u32 value) | 341 | u32 reg, u32 value) |
342 | { | 342 | { |
343 | _il_write32(priv, reg, value); | 343 | _il_write32(il, reg, value); |
344 | } | 344 | } |
345 | static inline void | 345 | static inline void |
346 | il_write_direct32(struct il_priv *priv, u32 reg, u32 value) | 346 | il_write_direct32(struct il_priv *il, u32 reg, u32 value) |
347 | { | 347 | { |
348 | unsigned long reg_flags; | 348 | unsigned long reg_flags; |
349 | 349 | ||
350 | spin_lock_irqsave(&priv->reg_lock, reg_flags); | 350 | spin_lock_irqsave(&il->reg_lock, reg_flags); |
351 | if (!il_grab_nic_access(priv)) { | 351 | if (!il_grab_nic_access(il)) { |
352 | _il_write_direct32(priv, reg, value); | 352 | _il_write_direct32(il, reg, value); |
353 | il_release_nic_access(priv); | 353 | il_release_nic_access(il); |
354 | } | 354 | } |
355 | spin_unlock_irqrestore(&priv->reg_lock, reg_flags); | 355 | spin_unlock_irqrestore(&il->reg_lock, reg_flags); |
356 | } | 356 | } |
357 | 357 | ||
358 | static inline void il_write_reg_buf(struct il_priv *priv, | 358 | static inline void il_write_reg_buf(struct il_priv *il, |
359 | u32 reg, u32 len, u32 *values) | 359 | u32 reg, u32 len, u32 *values) |
360 | { | 360 | { |
361 | u32 count = sizeof(u32); | 361 | u32 count = sizeof(u32); |
362 | 362 | ||
363 | if ((priv != NULL) && (values != NULL)) { | 363 | if ((il != NULL) && (values != NULL)) { |
364 | for (; 0 < len; len -= count, reg += count, values++) | 364 | for (; 0 < len; len -= count, reg += count, values++) |
365 | il_write_direct32(priv, reg, *values); | 365 | il_write_direct32(il, reg, *values); |
366 | } | 366 | } |
367 | } | 367 | } |
368 | 368 | ||
369 | static inline int _il_poll_direct_bit(struct il_priv *priv, u32 addr, | 369 | static inline int _il_poll_direct_bit(struct il_priv *il, u32 addr, |
370 | u32 mask, int timeout) | 370 | u32 mask, int timeout) |
371 | { | 371 | { |
372 | int t = 0; | 372 | int t = 0; |
373 | 373 | ||
374 | do { | 374 | do { |
375 | if ((il_read_direct32(priv, addr) & mask) == mask) | 375 | if ((il_read_direct32(il, addr) & mask) == mask) |
376 | return t; | 376 | return t; |
377 | udelay(IL_POLL_INTERVAL); | 377 | udelay(IL_POLL_INTERVAL); |
378 | t += IL_POLL_INTERVAL; | 378 | t += IL_POLL_INTERVAL; |
@@ -383,159 +383,159 @@ static inline int _il_poll_direct_bit(struct il_priv *priv, u32 addr, | |||
383 | 383 | ||
384 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 384 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
385 | static inline int __il_poll_direct_bit(const char *f, u32 l, | 385 | static inline int __il_poll_direct_bit(const char *f, u32 l, |
386 | struct il_priv *priv, | 386 | struct il_priv *il, |
387 | u32 addr, u32 mask, int timeout) | 387 | u32 addr, u32 mask, int timeout) |
388 | { | 388 | { |
389 | int ret = _il_poll_direct_bit(priv, addr, mask, timeout); | 389 | int ret = _il_poll_direct_bit(il, addr, mask, timeout); |
390 | 390 | ||
391 | if (unlikely(ret == -ETIMEDOUT)) | 391 | if (unlikely(ret == -ETIMEDOUT)) |
392 | IL_DEBUG_IO(priv, "poll_direct_bit(0x%08X, 0x%08X) - " | 392 | IL_DEBUG_IO(il, "poll_direct_bit(0x%08X, 0x%08X) - " |
393 | "timedout - %s %d\n", addr, mask, f, l); | 393 | "timedout - %s %d\n", addr, mask, f, l); |
394 | else | 394 | else |
395 | IL_DEBUG_IO(priv, "poll_direct_bit(0x%08X, 0x%08X) = 0x%08X " | 395 | IL_DEBUG_IO(il, "poll_direct_bit(0x%08X, 0x%08X) = 0x%08X " |
396 | "- %s %d\n", addr, mask, ret, f, l); | 396 | "- %s %d\n", addr, mask, ret, f, l); |
397 | return ret; | 397 | return ret; |
398 | } | 398 | } |
399 | #define il_poll_direct_bit(priv, addr, mask, timeout) \ | 399 | #define il_poll_direct_bit(il, addr, mask, timeout) \ |
400 | __il_poll_direct_bit(__FILE__, __LINE__, priv, addr, mask, timeout) | 400 | __il_poll_direct_bit(__FILE__, __LINE__, il, addr, mask, timeout) |
401 | #else | 401 | #else |
402 | #define il_poll_direct_bit _il_poll_direct_bit | 402 | #define il_poll_direct_bit _il_poll_direct_bit |
403 | #endif | 403 | #endif |
404 | 404 | ||
405 | static inline u32 _il_read_prph(struct il_priv *priv, u32 reg) | 405 | static inline u32 _il_read_prph(struct il_priv *il, u32 reg) |
406 | { | 406 | { |
407 | _il_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); | 407 | _il_write_direct32(il, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); |
408 | rmb(); | 408 | rmb(); |
409 | return _il_read_direct32(priv, HBUS_TARG_PRPH_RDAT); | 409 | return _il_read_direct32(il, HBUS_TARG_PRPH_RDAT); |
410 | } | 410 | } |
411 | static inline u32 il_read_prph(struct il_priv *priv, u32 reg) | 411 | static inline u32 il_read_prph(struct il_priv *il, u32 reg) |
412 | { | 412 | { |
413 | unsigned long reg_flags; | 413 | unsigned long reg_flags; |
414 | u32 val; | 414 | u32 val; |
415 | 415 | ||
416 | spin_lock_irqsave(&priv->reg_lock, reg_flags); | 416 | spin_lock_irqsave(&il->reg_lock, reg_flags); |
417 | il_grab_nic_access(priv); | 417 | il_grab_nic_access(il); |
418 | val = _il_read_prph(priv, reg); | 418 | val = _il_read_prph(il, reg); |
419 | il_release_nic_access(priv); | 419 | il_release_nic_access(il); |
420 | spin_unlock_irqrestore(&priv->reg_lock, reg_flags); | 420 | spin_unlock_irqrestore(&il->reg_lock, reg_flags); |
421 | return val; | 421 | return val; |
422 | } | 422 | } |
423 | 423 | ||
424 | static inline void _il_write_prph(struct il_priv *priv, | 424 | static inline void _il_write_prph(struct il_priv *il, |
425 | u32 addr, u32 val) | 425 | u32 addr, u32 val) |
426 | { | 426 | { |
427 | _il_write_direct32(priv, HBUS_TARG_PRPH_WADDR, | 427 | _il_write_direct32(il, HBUS_TARG_PRPH_WADDR, |
428 | ((addr & 0x0000FFFF) | (3 << 24))); | 428 | ((addr & 0x0000FFFF) | (3 << 24))); |
429 | wmb(); | 429 | wmb(); |
430 | _il_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); | 430 | _il_write_direct32(il, HBUS_TARG_PRPH_WDAT, val); |
431 | } | 431 | } |
432 | 432 | ||
433 | static inline void | 433 | static inline void |
434 | il_write_prph(struct il_priv *priv, u32 addr, u32 val) | 434 | il_write_prph(struct il_priv *il, u32 addr, u32 val) |
435 | { | 435 | { |
436 | unsigned long reg_flags; | 436 | unsigned long reg_flags; |
437 | 437 | ||
438 | spin_lock_irqsave(&priv->reg_lock, reg_flags); | 438 | spin_lock_irqsave(&il->reg_lock, reg_flags); |
439 | if (!il_grab_nic_access(priv)) { | 439 | if (!il_grab_nic_access(il)) { |
440 | _il_write_prph(priv, addr, val); | 440 | _il_write_prph(il, addr, val); |
441 | il_release_nic_access(priv); | 441 | il_release_nic_access(il); |
442 | } | 442 | } |
443 | spin_unlock_irqrestore(&priv->reg_lock, reg_flags); | 443 | spin_unlock_irqrestore(&il->reg_lock, reg_flags); |
444 | } | 444 | } |
445 | 445 | ||
446 | #define _il_set_bits_prph(priv, reg, mask) \ | 446 | #define _il_set_bits_prph(il, reg, mask) \ |
447 | _il_write_prph(priv, reg, (_il_read_prph(priv, reg) | mask)) | 447 | _il_write_prph(il, reg, (_il_read_prph(il, reg) | mask)) |
448 | 448 | ||
449 | static inline void | 449 | static inline void |
450 | il_set_bits_prph(struct il_priv *priv, u32 reg, u32 mask) | 450 | il_set_bits_prph(struct il_priv *il, u32 reg, u32 mask) |
451 | { | 451 | { |
452 | unsigned long reg_flags; | 452 | unsigned long reg_flags; |
453 | 453 | ||
454 | spin_lock_irqsave(&priv->reg_lock, reg_flags); | 454 | spin_lock_irqsave(&il->reg_lock, reg_flags); |
455 | il_grab_nic_access(priv); | 455 | il_grab_nic_access(il); |
456 | _il_set_bits_prph(priv, reg, mask); | 456 | _il_set_bits_prph(il, reg, mask); |
457 | il_release_nic_access(priv); | 457 | il_release_nic_access(il); |
458 | spin_unlock_irqrestore(&priv->reg_lock, reg_flags); | 458 | spin_unlock_irqrestore(&il->reg_lock, reg_flags); |
459 | } | 459 | } |
460 | 460 | ||
461 | #define _il_set_bits_mask_prph(priv, reg, bits, mask) \ | 461 | #define _il_set_bits_mask_prph(il, reg, bits, mask) \ |
462 | _il_write_prph(priv, reg, \ | 462 | _il_write_prph(il, reg, \ |
463 | ((_il_read_prph(priv, reg) & mask) | bits)) | 463 | ((_il_read_prph(il, reg) & mask) | bits)) |
464 | 464 | ||
465 | static inline void il_set_bits_mask_prph(struct il_priv *priv, u32 reg, | 465 | static inline void il_set_bits_mask_prph(struct il_priv *il, u32 reg, |
466 | u32 bits, u32 mask) | 466 | u32 bits, u32 mask) |
467 | { | 467 | { |
468 | unsigned long reg_flags; | 468 | unsigned long reg_flags; |
469 | 469 | ||
470 | spin_lock_irqsave(&priv->reg_lock, reg_flags); | 470 | spin_lock_irqsave(&il->reg_lock, reg_flags); |
471 | il_grab_nic_access(priv); | 471 | il_grab_nic_access(il); |
472 | _il_set_bits_mask_prph(priv, reg, bits, mask); | 472 | _il_set_bits_mask_prph(il, reg, bits, mask); |
473 | il_release_nic_access(priv); | 473 | il_release_nic_access(il); |
474 | spin_unlock_irqrestore(&priv->reg_lock, reg_flags); | 474 | spin_unlock_irqrestore(&il->reg_lock, reg_flags); |
475 | } | 475 | } |
476 | 476 | ||
477 | static inline void il_clear_bits_prph(struct il_priv | 477 | static inline void il_clear_bits_prph(struct il_priv |
478 | *priv, u32 reg, u32 mask) | 478 | *il, u32 reg, u32 mask) |
479 | { | 479 | { |
480 | unsigned long reg_flags; | 480 | unsigned long reg_flags; |
481 | u32 val; | 481 | u32 val; |
482 | 482 | ||
483 | spin_lock_irqsave(&priv->reg_lock, reg_flags); | 483 | spin_lock_irqsave(&il->reg_lock, reg_flags); |
484 | il_grab_nic_access(priv); | 484 | il_grab_nic_access(il); |
485 | val = _il_read_prph(priv, reg); | 485 | val = _il_read_prph(il, reg); |
486 | _il_write_prph(priv, reg, (val & ~mask)); | 486 | _il_write_prph(il, reg, (val & ~mask)); |
487 | il_release_nic_access(priv); | 487 | il_release_nic_access(il); |
488 | spin_unlock_irqrestore(&priv->reg_lock, reg_flags); | 488 | spin_unlock_irqrestore(&il->reg_lock, reg_flags); |
489 | } | 489 | } |
490 | 490 | ||
491 | static inline u32 il_read_targ_mem(struct il_priv *priv, u32 addr) | 491 | static inline u32 il_read_targ_mem(struct il_priv *il, u32 addr) |
492 | { | 492 | { |
493 | unsigned long reg_flags; | 493 | unsigned long reg_flags; |
494 | u32 value; | 494 | u32 value; |
495 | 495 | ||
496 | spin_lock_irqsave(&priv->reg_lock, reg_flags); | 496 | spin_lock_irqsave(&il->reg_lock, reg_flags); |
497 | il_grab_nic_access(priv); | 497 | il_grab_nic_access(il); |
498 | 498 | ||
499 | _il_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr); | 499 | _il_write_direct32(il, HBUS_TARG_MEM_RADDR, addr); |
500 | rmb(); | 500 | rmb(); |
501 | value = _il_read_direct32(priv, HBUS_TARG_MEM_RDAT); | 501 | value = _il_read_direct32(il, HBUS_TARG_MEM_RDAT); |
502 | 502 | ||
503 | il_release_nic_access(priv); | 503 | il_release_nic_access(il); |
504 | spin_unlock_irqrestore(&priv->reg_lock, reg_flags); | 504 | spin_unlock_irqrestore(&il->reg_lock, reg_flags); |
505 | return value; | 505 | return value; |
506 | } | 506 | } |
507 | 507 | ||
508 | static inline void | 508 | static inline void |
509 | il_write_targ_mem(struct il_priv *priv, u32 addr, u32 val) | 509 | il_write_targ_mem(struct il_priv *il, u32 addr, u32 val) |
510 | { | 510 | { |
511 | unsigned long reg_flags; | 511 | unsigned long reg_flags; |
512 | 512 | ||
513 | spin_lock_irqsave(&priv->reg_lock, reg_flags); | 513 | spin_lock_irqsave(&il->reg_lock, reg_flags); |
514 | if (!il_grab_nic_access(priv)) { | 514 | if (!il_grab_nic_access(il)) { |
515 | _il_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); | 515 | _il_write_direct32(il, HBUS_TARG_MEM_WADDR, addr); |
516 | wmb(); | 516 | wmb(); |
517 | _il_write_direct32(priv, HBUS_TARG_MEM_WDAT, val); | 517 | _il_write_direct32(il, HBUS_TARG_MEM_WDAT, val); |
518 | il_release_nic_access(priv); | 518 | il_release_nic_access(il); |
519 | } | 519 | } |
520 | spin_unlock_irqrestore(&priv->reg_lock, reg_flags); | 520 | spin_unlock_irqrestore(&il->reg_lock, reg_flags); |
521 | } | 521 | } |
522 | 522 | ||
523 | static inline void | 523 | static inline void |
524 | il_write_targ_mem_buf(struct il_priv *priv, u32 addr, | 524 | il_write_targ_mem_buf(struct il_priv *il, u32 addr, |
525 | u32 len, u32 *values) | 525 | u32 len, u32 *values) |
526 | { | 526 | { |
527 | unsigned long reg_flags; | 527 | unsigned long reg_flags; |
528 | 528 | ||
529 | spin_lock_irqsave(&priv->reg_lock, reg_flags); | 529 | spin_lock_irqsave(&il->reg_lock, reg_flags); |
530 | if (!il_grab_nic_access(priv)) { | 530 | if (!il_grab_nic_access(il)) { |
531 | _il_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); | 531 | _il_write_direct32(il, HBUS_TARG_MEM_WADDR, addr); |
532 | wmb(); | 532 | wmb(); |
533 | for (; 0 < len; len -= sizeof(u32), values++) | 533 | for (; 0 < len; len -= sizeof(u32), values++) |
534 | _il_write_direct32(priv, | 534 | _il_write_direct32(il, |
535 | HBUS_TARG_MEM_WDAT, *values); | 535 | HBUS_TARG_MEM_WDAT, *values); |
536 | 536 | ||
537 | il_release_nic_access(priv); | 537 | il_release_nic_access(il); |
538 | } | 538 | } |
539 | spin_unlock_irqrestore(&priv->reg_lock, reg_flags); | 539 | spin_unlock_irqrestore(&il->reg_lock, reg_flags); |
540 | } | 540 | } |
541 | #endif | 541 | #endif |
diff --git a/drivers/net/wireless/iwlegacy/iwl-led.c b/drivers/net/wireless/iwlegacy/iwl-led.c index 490b183b134..13add43987b 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[] = { | |||
84 | * compensation = (100 - averageDeviation) * 64 / 100 | 84 | * compensation = (100 - averageDeviation) * 64 / 100 |
85 | * NewBlinkTime = (compensation * BlinkTime) / 64 | 85 | * NewBlinkTime = (compensation * BlinkTime) / 64 |
86 | */ | 86 | */ |
87 | static inline u8 il_blink_compensation(struct il_priv *priv, | 87 | static inline u8 il_blink_compensation(struct il_priv *il, |
88 | u8 time, u16 compensation) | 88 | u8 time, u16 compensation) |
89 | { | 89 | { |
90 | if (!compensation) { | 90 | if (!compensation) { |
91 | IL_ERR(priv, "undefined blink compensation: " | 91 | IL_ERR(il, "undefined blink compensation: " |
92 | "use pre-defined blinking time\n"); | 92 | "use pre-defined blinking time\n"); |
93 | return time; | 93 | return time; |
94 | } | 94 | } |
@@ -97,7 +97,7 @@ static inline u8 il_blink_compensation(struct il_priv *priv, | |||
97 | } | 97 | } |
98 | 98 | ||
99 | /* Set led pattern command */ | 99 | /* Set led pattern command */ |
100 | static int il_led_cmd(struct il_priv *priv, | 100 | static int il_led_cmd(struct il_priv *il, |
101 | unsigned long on, | 101 | unsigned long on, |
102 | unsigned long off) | 102 | unsigned long off) |
103 | { | 103 | { |
@@ -107,10 +107,10 @@ static int il_led_cmd(struct il_priv *priv, | |||
107 | }; | 107 | }; |
108 | int ret; | 108 | int ret; |
109 | 109 | ||
110 | if (!test_bit(STATUS_READY, &priv->status)) | 110 | if (!test_bit(STATUS_READY, &il->status)) |
111 | return -EBUSY; | 111 | return -EBUSY; |
112 | 112 | ||
113 | if (priv->blink_on == on && priv->blink_off == off) | 113 | if (il->blink_on == on && il->blink_off == off) |
114 | return 0; | 114 | return 0; |
115 | 115 | ||
116 | if (off == 0) { | 116 | if (off == 0) { |
@@ -118,17 +118,17 @@ static int il_led_cmd(struct il_priv *priv, | |||
118 | on = IL_LED_SOLID; | 118 | on = IL_LED_SOLID; |
119 | } | 119 | } |
120 | 120 | ||
121 | IL_DEBUG_LED(priv, "Led blink time compensation=%u\n", | 121 | IL_DEBUG_LED(il, "Led blink time compensation=%u\n", |
122 | priv->cfg->base_params->led_compensation); | 122 | il->cfg->base_params->led_compensation); |
123 | led_cmd.on = il_blink_compensation(priv, on, | 123 | led_cmd.on = il_blink_compensation(il, on, |
124 | priv->cfg->base_params->led_compensation); | 124 | il->cfg->base_params->led_compensation); |
125 | led_cmd.off = il_blink_compensation(priv, off, | 125 | led_cmd.off = il_blink_compensation(il, off, |
126 | priv->cfg->base_params->led_compensation); | 126 | il->cfg->base_params->led_compensation); |
127 | 127 | ||
128 | ret = priv->cfg->ops->led->cmd(priv, &led_cmd); | 128 | ret = il->cfg->ops->led->cmd(il, &led_cmd); |
129 | if (!ret) { | 129 | if (!ret) { |
130 | priv->blink_on = on; | 130 | il->blink_on = on; |
131 | priv->blink_off = off; | 131 | il->blink_off = off; |
132 | } | 132 | } |
133 | return ret; | 133 | return ret; |
134 | } | 134 | } |
@@ -136,70 +136,70 @@ static int il_led_cmd(struct il_priv *priv, | |||
136 | static void il_led_brightness_set(struct led_classdev *led_cdev, | 136 | static void il_led_brightness_set(struct led_classdev *led_cdev, |
137 | enum led_brightness brightness) | 137 | enum led_brightness brightness) |
138 | { | 138 | { |
139 | struct il_priv *priv = container_of(led_cdev, struct il_priv, led); | 139 | struct il_priv *il = container_of(led_cdev, struct il_priv, led); |
140 | unsigned long on = 0; | 140 | unsigned long on = 0; |
141 | 141 | ||
142 | if (brightness > 0) | 142 | if (brightness > 0) |
143 | on = IL_LED_SOLID; | 143 | on = IL_LED_SOLID; |
144 | 144 | ||
145 | il_led_cmd(priv, on, 0); | 145 | il_led_cmd(il, on, 0); |
146 | } | 146 | } |
147 | 147 | ||
148 | static int il_led_blink_set(struct led_classdev *led_cdev, | 148 | static int il_led_blink_set(struct led_classdev *led_cdev, |
149 | unsigned long *delay_on, | 149 | unsigned long *delay_on, |
150 | unsigned long *delay_off) | 150 | unsigned long *delay_off) |
151 | { | 151 | { |
152 | struct il_priv *priv = container_of(led_cdev, struct il_priv, led); | 152 | struct il_priv *il = container_of(led_cdev, struct il_priv, led); |
153 | 153 | ||
154 | return il_led_cmd(priv, *delay_on, *delay_off); | 154 | return il_led_cmd(il, *delay_on, *delay_off); |
155 | } | 155 | } |
156 | 156 | ||
157 | void il_leds_init(struct il_priv *priv) | 157 | void il_leds_init(struct il_priv *il) |
158 | { | 158 | { |
159 | int mode = led_mode; | 159 | int mode = led_mode; |
160 | int ret; | 160 | int ret; |
161 | 161 | ||
162 | if (mode == IL_LED_DEFAULT) | 162 | if (mode == IL_LED_DEFAULT) |
163 | mode = priv->cfg->led_mode; | 163 | mode = il->cfg->led_mode; |
164 | 164 | ||
165 | priv->led.name = kasprintf(GFP_KERNEL, "%s-led", | 165 | il->led.name = kasprintf(GFP_KERNEL, "%s-led", |
166 | wiphy_name(priv->hw->wiphy)); | 166 | wiphy_name(il->hw->wiphy)); |
167 | priv->led.brightness_set = il_led_brightness_set; | 167 | il->led.brightness_set = il_led_brightness_set; |
168 | priv->led.blink_set = il_led_blink_set; | 168 | il->led.blink_set = il_led_blink_set; |
169 | priv->led.max_brightness = 1; | 169 | il->led.max_brightness = 1; |
170 | 170 | ||
171 | switch (mode) { | 171 | switch (mode) { |
172 | case IL_LED_DEFAULT: | 172 | case IL_LED_DEFAULT: |
173 | WARN_ON(1); | 173 | WARN_ON(1); |
174 | break; | 174 | break; |
175 | case IL_LED_BLINK: | 175 | case IL_LED_BLINK: |
176 | priv->led.default_trigger = | 176 | il->led.default_trigger = |
177 | ieee80211_create_tpt_led_trigger(priv->hw, | 177 | ieee80211_create_tpt_led_trigger(il->hw, |
178 | IEEE80211_TPT_LEDTRIG_FL_CONNECTED, | 178 | IEEE80211_TPT_LEDTRIG_FL_CONNECTED, |
179 | il_blink, ARRAY_SIZE(il_blink)); | 179 | il_blink, ARRAY_SIZE(il_blink)); |
180 | break; | 180 | break; |
181 | case IL_LED_RF_STATE: | 181 | case IL_LED_RF_STATE: |
182 | priv->led.default_trigger = | 182 | il->led.default_trigger = |
183 | ieee80211_get_radio_led_name(priv->hw); | 183 | ieee80211_get_radio_led_name(il->hw); |
184 | break; | 184 | break; |
185 | } | 185 | } |
186 | 186 | ||
187 | ret = led_classdev_register(&priv->pci_dev->dev, &priv->led); | 187 | ret = led_classdev_register(&il->pci_dev->dev, &il->led); |
188 | if (ret) { | 188 | if (ret) { |
189 | kfree(priv->led.name); | 189 | kfree(il->led.name); |
190 | return; | 190 | return; |
191 | } | 191 | } |
192 | 192 | ||
193 | priv->led_registered = true; | 193 | il->led_registered = true; |
194 | } | 194 | } |
195 | EXPORT_SYMBOL(il_leds_init); | 195 | EXPORT_SYMBOL(il_leds_init); |
196 | 196 | ||
197 | void il_leds_exit(struct il_priv *priv) | 197 | void il_leds_exit(struct il_priv *il) |
198 | { | 198 | { |
199 | if (!priv->led_registered) | 199 | if (!il->led_registered) |
200 | return; | 200 | return; |
201 | 201 | ||
202 | led_classdev_unregister(&priv->led); | 202 | led_classdev_unregister(&il->led); |
203 | kfree(priv->led.name); | 203 | kfree(il->led.name); |
204 | } | 204 | } |
205 | EXPORT_SYMBOL(il_leds_exit); | 205 | EXPORT_SYMBOL(il_leds_exit); |
diff --git a/drivers/net/wireless/iwlegacy/iwl-led.h b/drivers/net/wireless/iwlegacy/iwl-led.h index ea7a8ea23a1..d3aba57feba 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 { | |||
50 | IL_LED_BLINK, | 50 | IL_LED_BLINK, |
51 | }; | 51 | }; |
52 | 52 | ||
53 | void il_leds_init(struct il_priv *priv); | 53 | void il_leds_init(struct il_priv *il); |
54 | void il_leds_exit(struct il_priv *priv); | 54 | void il_leds_exit(struct il_priv *il); |
55 | 55 | ||
56 | #endif /* __il_leds_h__ */ | 56 | #endif /* __il_leds_h__ */ |
diff --git a/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h b/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h index 72ef91e9a79..4282ed553b9 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 { | |||
346 | }; | 346 | }; |
347 | 347 | ||
348 | /** | 348 | /** |
349 | * struct il_lq_sta -- driver's rate scaling private structure | 349 | * struct il_lq_sta -- driver's rate scaling ilate structure |
350 | * | 350 | * |
351 | * Pointer to this gets passed back and forth between driver and mac80211. | 351 | * Pointer to this gets passed back and forth between driver and mac80211. |
352 | */ | 352 | */ |
@@ -400,11 +400,9 @@ struct il_lq_sta { | |||
400 | u8 is_agg; | 400 | u8 is_agg; |
401 | }; | 401 | }; |
402 | 402 | ||
403 | static inline u8 il4965_num_of_ant(u8 mask) | 403 | static inline u8 il4965_num_of_ant(u8 m) |
404 | { | 404 | { |
405 | return !!((mask) & ANT_A) + | 405 | return !!(m & ANT_A) + !!(m & ANT_B) + !!(m & ANT_C); |
406 | !!((mask) & ANT_B) + | ||
407 | !!((mask) & ANT_C); | ||
408 | } | 406 | } |
409 | 407 | ||
410 | static inline u8 il4965_first_antenna(u8 mask) | 408 | static inline u8 il4965_first_antenna(u8 mask) |
@@ -426,9 +424,9 @@ static inline u8 il4965_first_antenna(u8 mask) | |||
426 | extern void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id); | 424 | extern void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id); |
427 | 425 | ||
428 | /* Initialize station's rate scaling information after adding station */ | 426 | /* Initialize station's rate scaling information after adding station */ |
429 | extern void il4965_rs_rate_init(struct il_priv *priv, | 427 | extern void il4965_rs_rate_init(struct il_priv *il, |
430 | struct ieee80211_sta *sta, u8 sta_id); | 428 | struct ieee80211_sta *sta, u8 sta_id); |
431 | extern void il3945_rs_rate_init(struct il_priv *priv, | 429 | extern void il3945_rs_rate_init(struct il_priv *il, |
432 | struct ieee80211_sta *sta, u8 sta_id); | 430 | struct ieee80211_sta *sta, u8 sta_id); |
433 | 431 | ||
434 | /** | 432 | /** |
diff --git a/drivers/net/wireless/iwlegacy/iwl-power.c b/drivers/net/wireless/iwlegacy/iwl-power.c index 7ccff257736..63862464fcd 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 { | |||
60 | u8 no_dtim; /* number of skip dtim */ | 60 | u8 no_dtim; /* number of skip dtim */ |
61 | }; | 61 | }; |
62 | 62 | ||
63 | static void il_power_sleep_cam_cmd(struct il_priv *priv, | 63 | static void il_power_sleep_cam_cmd(struct il_priv *il, |
64 | struct il_powertable_cmd *cmd) | 64 | struct il_powertable_cmd *cmd) |
65 | { | 65 | { |
66 | memset(cmd, 0, sizeof(*cmd)); | 66 | memset(cmd, 0, sizeof(*cmd)); |
67 | 67 | ||
68 | if (priv->power_data.pci_pm) | 68 | if (il->power_data.pci_pm) |
69 | cmd->flags |= IL_POWER_PCI_PM_MSK; | 69 | cmd->flags |= IL_POWER_PCI_PM_MSK; |
70 | 70 | ||
71 | IL_DEBUG_POWER(priv, "Sleep command for CAM\n"); | 71 | IL_DEBUG_POWER(il, "Sleep command for CAM\n"); |
72 | } | 72 | } |
73 | 73 | ||
74 | static int | 74 | static int |
75 | il_set_power(struct il_priv *priv, struct il_powertable_cmd *cmd) | 75 | il_set_power(struct il_priv *il, struct il_powertable_cmd *cmd) |
76 | { | 76 | { |
77 | IL_DEBUG_POWER(priv, "Sending power/sleep command\n"); | 77 | IL_DEBUG_POWER(il, "Sending power/sleep command\n"); |
78 | IL_DEBUG_POWER(priv, "Flags value = 0x%08X\n", cmd->flags); | 78 | IL_DEBUG_POWER(il, "Flags value = 0x%08X\n", cmd->flags); |
79 | IL_DEBUG_POWER(priv, "Tx timeout = %u\n", | 79 | IL_DEBUG_POWER(il, "Tx timeout = %u\n", |
80 | le32_to_cpu(cmd->tx_data_timeout)); | 80 | le32_to_cpu(cmd->tx_data_timeout)); |
81 | IL_DEBUG_POWER(priv, "Rx timeout = %u\n", | 81 | IL_DEBUG_POWER(il, "Rx timeout = %u\n", |
82 | le32_to_cpu(cmd->rx_data_timeout)); | 82 | le32_to_cpu(cmd->rx_data_timeout)); |
83 | IL_DEBUG_POWER(priv, | 83 | IL_DEBUG_POWER(il, |
84 | "Sleep interval vector = { %d , %d , %d , %d , %d }\n", | 84 | "Sleep interval vector = { %d , %d , %d , %d , %d }\n", |
85 | le32_to_cpu(cmd->sleep_interval[0]), | 85 | le32_to_cpu(cmd->sleep_interval[0]), |
86 | le32_to_cpu(cmd->sleep_interval[1]), | 86 | le32_to_cpu(cmd->sleep_interval[1]), |
@@ -88,78 +88,78 @@ il_set_power(struct il_priv *priv, struct il_powertable_cmd *cmd) | |||
88 | le32_to_cpu(cmd->sleep_interval[3]), | 88 | le32_to_cpu(cmd->sleep_interval[3]), |
89 | le32_to_cpu(cmd->sleep_interval[4])); | 89 | le32_to_cpu(cmd->sleep_interval[4])); |
90 | 90 | ||
91 | return il_send_cmd_pdu(priv, POWER_TABLE_CMD, | 91 | return il_send_cmd_pdu(il, POWER_TABLE_CMD, |
92 | sizeof(struct il_powertable_cmd), cmd); | 92 | sizeof(struct il_powertable_cmd), cmd); |
93 | } | 93 | } |
94 | 94 | ||
95 | int | 95 | int |
96 | il_power_set_mode(struct il_priv *priv, struct il_powertable_cmd *cmd, | 96 | il_power_set_mode(struct il_priv *il, struct il_powertable_cmd *cmd, |
97 | bool force) | 97 | bool force) |
98 | { | 98 | { |
99 | int ret; | 99 | int ret; |
100 | bool update_chains; | 100 | bool update_chains; |
101 | 101 | ||
102 | lockdep_assert_held(&priv->mutex); | 102 | lockdep_assert_held(&il->mutex); |
103 | 103 | ||
104 | /* Don't update the RX chain when chain noise calibration is running */ | 104 | /* Don't update the RX chain when chain noise calibration is running */ |
105 | update_chains = priv->chain_noise_data.state == IL_CHAIN_NOISE_DONE || | 105 | update_chains = il->chain_noise_data.state == IL_CHAIN_NOISE_DONE || |
106 | priv->chain_noise_data.state == IL_CHAIN_NOISE_ALIVE; | 106 | il->chain_noise_data.state == IL_CHAIN_NOISE_ALIVE; |
107 | 107 | ||
108 | if (!memcmp(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd)) && !force) | 108 | if (!memcmp(&il->power_data.sleep_cmd, cmd, sizeof(*cmd)) && !force) |
109 | return 0; | 109 | return 0; |
110 | 110 | ||
111 | if (!il_is_ready_rf(priv)) | 111 | if (!il_is_ready_rf(il)) |
112 | return -EIO; | 112 | return -EIO; |
113 | 113 | ||
114 | /* scan complete use sleep_power_next, need to be updated */ | 114 | /* scan complete use sleep_power_next, need to be updated */ |
115 | memcpy(&priv->power_data.sleep_cmd_next, cmd, sizeof(*cmd)); | 115 | memcpy(&il->power_data.sleep_cmd_next, cmd, sizeof(*cmd)); |
116 | if (test_bit(STATUS_SCANNING, &priv->status) && !force) { | 116 | if (test_bit(STATUS_SCANNING, &il->status) && !force) { |
117 | IL_DEBUG_INFO(priv, "Defer power set mode while scanning\n"); | 117 | IL_DEBUG_INFO(il, "Defer power set mode while scanning\n"); |
118 | return 0; | 118 | return 0; |
119 | } | 119 | } |
120 | 120 | ||
121 | if (cmd->flags & IL_POWER_DRIVER_ALLOW_SLEEP_MSK) | 121 | if (cmd->flags & IL_POWER_DRIVER_ALLOW_SLEEP_MSK) |
122 | set_bit(STATUS_POWER_PMI, &priv->status); | 122 | set_bit(STATUS_POWER_PMI, &il->status); |
123 | 123 | ||
124 | ret = il_set_power(priv, cmd); | 124 | ret = il_set_power(il, cmd); |
125 | if (!ret) { | 125 | if (!ret) { |
126 | if (!(cmd->flags & IL_POWER_DRIVER_ALLOW_SLEEP_MSK)) | 126 | if (!(cmd->flags & IL_POWER_DRIVER_ALLOW_SLEEP_MSK)) |
127 | clear_bit(STATUS_POWER_PMI, &priv->status); | 127 | clear_bit(STATUS_POWER_PMI, &il->status); |
128 | 128 | ||
129 | if (priv->cfg->ops->lib->update_chain_flags && update_chains) | 129 | if (il->cfg->ops->lib->update_chain_flags && update_chains) |
130 | priv->cfg->ops->lib->update_chain_flags(priv); | 130 | il->cfg->ops->lib->update_chain_flags(il); |
131 | else if (priv->cfg->ops->lib->update_chain_flags) | 131 | else if (il->cfg->ops->lib->update_chain_flags) |
132 | IL_DEBUG_POWER(priv, | 132 | IL_DEBUG_POWER(il, |
133 | "Cannot update the power, chain noise " | 133 | "Cannot update the power, chain noise " |
134 | "calibration running: %d\n", | 134 | "calibration running: %d\n", |
135 | priv->chain_noise_data.state); | 135 | il->chain_noise_data.state); |
136 | 136 | ||
137 | memcpy(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd)); | 137 | memcpy(&il->power_data.sleep_cmd, cmd, sizeof(*cmd)); |
138 | } else | 138 | } else |
139 | IL_ERR(priv, "set power fail, ret = %d", ret); | 139 | IL_ERR(il, "set power fail, ret = %d", ret); |
140 | 140 | ||
141 | return ret; | 141 | return ret; |
142 | } | 142 | } |
143 | 143 | ||
144 | int il_power_update_mode(struct il_priv *priv, bool force) | 144 | int il_power_update_mode(struct il_priv *il, bool force) |
145 | { | 145 | { |
146 | struct il_powertable_cmd cmd; | 146 | struct il_powertable_cmd cmd; |
147 | 147 | ||
148 | il_power_sleep_cam_cmd(priv, &cmd); | 148 | il_power_sleep_cam_cmd(il, &cmd); |
149 | return il_power_set_mode(priv, &cmd, force); | 149 | return il_power_set_mode(il, &cmd, force); |
150 | } | 150 | } |
151 | EXPORT_SYMBOL(il_power_update_mode); | 151 | EXPORT_SYMBOL(il_power_update_mode); |
152 | 152 | ||
153 | /* initialize to default */ | 153 | /* initialize to default */ |
154 | void il_power_initialize(struct il_priv *priv) | 154 | void il_power_initialize(struct il_priv *il) |
155 | { | 155 | { |
156 | u16 lctl = il_pcie_link_ctl(priv); | 156 | u16 lctl = il_pcie_link_ctl(il); |
157 | 157 | ||
158 | priv->power_data.pci_pm = !(lctl & PCI_CFG_LINK_CTRL_VAL_L0S_EN); | 158 | il->power_data.pci_pm = !(lctl & PCI_CFG_LINK_CTRL_VAL_L0S_EN); |
159 | 159 | ||
160 | priv->power_data.debug_sleep_level_override = -1; | 160 | il->power_data.debug_sleep_level_override = -1; |
161 | 161 | ||
162 | memset(&priv->power_data.sleep_cmd, 0, | 162 | memset(&il->power_data.sleep_cmd, 0, |
163 | sizeof(priv->power_data.sleep_cmd)); | 163 | sizeof(il->power_data.sleep_cmd)); |
164 | } | 164 | } |
165 | EXPORT_SYMBOL(il_power_initialize); | 165 | EXPORT_SYMBOL(il_power_initialize); |
diff --git a/drivers/net/wireless/iwlegacy/iwl-power.h b/drivers/net/wireless/iwlegacy/iwl-power.h index dba4ca9d30e..e149f789063 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 { | |||
47 | }; | 47 | }; |
48 | 48 | ||
49 | int | 49 | int |
50 | il_power_set_mode(struct il_priv *priv, struct il_powertable_cmd *cmd, | 50 | il_power_set_mode(struct il_priv *il, struct il_powertable_cmd *cmd, |
51 | bool force); | 51 | bool force); |
52 | int il_power_update_mode(struct il_priv *priv, bool force); | 52 | int il_power_update_mode(struct il_priv *il, bool force); |
53 | void il_power_initialize(struct il_priv *priv); | 53 | void il_power_initialize(struct il_priv *il); |
54 | 54 | ||
55 | #endif /* __il_power_setting_h__ */ | 55 | #endif /* __il_power_setting_h__ */ |
diff --git a/drivers/net/wireless/iwlegacy/iwl-rx.c b/drivers/net/wireless/iwlegacy/iwl-rx.c index 9a2714c7f3e..b6c5dd09bd8 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); | |||
124 | * il_rx_queue_update_write_ptr - Update the write pointer for the RX queue | 124 | * il_rx_queue_update_write_ptr - Update the write pointer for the RX queue |
125 | */ | 125 | */ |
126 | void | 126 | void |
127 | il_rx_queue_update_write_ptr(struct il_priv *priv, | 127 | il_rx_queue_update_write_ptr(struct il_priv *il, |
128 | struct il_rx_queue *q) | 128 | struct il_rx_queue *q) |
129 | { | 129 | { |
130 | unsigned long flags; | 130 | unsigned long flags; |
131 | u32 rx_wrt_ptr_reg = priv->hw_params.rx_wrt_ptr_reg; | 131 | u32 rx_wrt_ptr_reg = il->hw_params.rx_wrt_ptr_reg; |
132 | u32 reg; | 132 | u32 reg; |
133 | 133 | ||
134 | spin_lock_irqsave(&q->lock, flags); | 134 | spin_lock_irqsave(&q->lock, flags); |
@@ -137,27 +137,27 @@ il_rx_queue_update_write_ptr(struct il_priv *priv, | |||
137 | goto exit_unlock; | 137 | goto exit_unlock; |
138 | 138 | ||
139 | /* If power-saving is in use, make sure device is awake */ | 139 | /* If power-saving is in use, make sure device is awake */ |
140 | if (test_bit(STATUS_POWER_PMI, &priv->status)) { | 140 | if (test_bit(STATUS_POWER_PMI, &il->status)) { |
141 | reg = il_read32(priv, CSR_UCODE_DRV_GP1); | 141 | reg = il_read32(il, CSR_UCODE_DRV_GP1); |
142 | 142 | ||
143 | if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { | 143 | if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { |
144 | IL_DEBUG_INFO(priv, | 144 | IL_DEBUG_INFO(il, |
145 | "Rx queue requesting wakeup," | 145 | "Rx queue requesting wakeup," |
146 | " GP1 = 0x%x\n", reg); | 146 | " GP1 = 0x%x\n", reg); |
147 | il_set_bit(priv, CSR_GP_CNTRL, | 147 | il_set_bit(il, CSR_GP_CNTRL, |
148 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); | 148 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); |
149 | goto exit_unlock; | 149 | goto exit_unlock; |
150 | } | 150 | } |
151 | 151 | ||
152 | q->write_actual = (q->write & ~0x7); | 152 | q->write_actual = (q->write & ~0x7); |
153 | il_write_direct32(priv, rx_wrt_ptr_reg, | 153 | il_write_direct32(il, rx_wrt_ptr_reg, |
154 | q->write_actual); | 154 | q->write_actual); |
155 | 155 | ||
156 | /* Else device is assumed to be awake */ | 156 | /* Else device is assumed to be awake */ |
157 | } else { | 157 | } else { |
158 | /* Device expects a multiple of 8 */ | 158 | /* Device expects a multiple of 8 */ |
159 | q->write_actual = (q->write & ~0x7); | 159 | q->write_actual = (q->write & ~0x7); |
160 | il_write_direct32(priv, rx_wrt_ptr_reg, | 160 | il_write_direct32(il, rx_wrt_ptr_reg, |
161 | q->write_actual); | 161 | q->write_actual); |
162 | } | 162 | } |
163 | 163 | ||
@@ -168,10 +168,10 @@ il_rx_queue_update_write_ptr(struct il_priv *priv, | |||
168 | } | 168 | } |
169 | EXPORT_SYMBOL(il_rx_queue_update_write_ptr); | 169 | EXPORT_SYMBOL(il_rx_queue_update_write_ptr); |
170 | 170 | ||
171 | int il_rx_queue_alloc(struct il_priv *priv) | 171 | int il_rx_queue_alloc(struct il_priv *il) |
172 | { | 172 | { |
173 | struct il_rx_queue *rxq = &priv->rxq; | 173 | struct il_rx_queue *rxq = &il->rxq; |
174 | struct device *dev = &priv->pci_dev->dev; | 174 | struct device *dev = &il->pci_dev->dev; |
175 | int i; | 175 | int i; |
176 | 176 | ||
177 | spin_lock_init(&rxq->lock); | 177 | spin_lock_init(&rxq->lock); |
@@ -202,7 +202,7 @@ int il_rx_queue_alloc(struct il_priv *priv) | |||
202 | return 0; | 202 | return 0; |
203 | 203 | ||
204 | err_rb: | 204 | err_rb: |
205 | dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, | 205 | dma_free_coherent(&il->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, |
206 | rxq->bd_dma); | 206 | rxq->bd_dma); |
207 | err_bd: | 207 | err_bd: |
208 | return -ENOMEM; | 208 | return -ENOMEM; |
@@ -210,27 +210,27 @@ err_bd: | |||
210 | EXPORT_SYMBOL(il_rx_queue_alloc); | 210 | EXPORT_SYMBOL(il_rx_queue_alloc); |
211 | 211 | ||
212 | 212 | ||
213 | void il_rx_spectrum_measure_notif(struct il_priv *priv, | 213 | void il_rx_spectrum_measure_notif(struct il_priv *il, |
214 | struct il_rx_mem_buffer *rxb) | 214 | struct il_rx_mem_buffer *rxb) |
215 | { | 215 | { |
216 | struct il_rx_packet *pkt = rxb_addr(rxb); | 216 | struct il_rx_packet *pkt = rxb_addr(rxb); |
217 | struct il_spectrum_notification *report = &(pkt->u.spectrum_notif); | 217 | struct il_spectrum_notification *report = &(pkt->u.spectrum_notif); |
218 | 218 | ||
219 | if (!report->state) { | 219 | if (!report->state) { |
220 | IL_DEBUG_11H(priv, | 220 | IL_DEBUG_11H(il, |
221 | "Spectrum Measure Notification: Start\n"); | 221 | "Spectrum Measure Notification: Start\n"); |
222 | return; | 222 | return; |
223 | } | 223 | } |
224 | 224 | ||
225 | memcpy(&priv->measure_report, report, sizeof(*report)); | 225 | memcpy(&il->measure_report, report, sizeof(*report)); |
226 | priv->measurement_status |= MEASUREMENT_READY; | 226 | il->measurement_status |= MEASUREMENT_READY; |
227 | } | 227 | } |
228 | EXPORT_SYMBOL(il_rx_spectrum_measure_notif); | 228 | EXPORT_SYMBOL(il_rx_spectrum_measure_notif); |
229 | 229 | ||
230 | /* | 230 | /* |
231 | * returns non-zero if packet should be dropped | 231 | * returns non-zero if packet should be dropped |
232 | */ | 232 | */ |
233 | int il_set_decrypted_flag(struct il_priv *priv, | 233 | int il_set_decrypted_flag(struct il_priv *il, |
234 | struct ieee80211_hdr *hdr, | 234 | struct ieee80211_hdr *hdr, |
235 | u32 decrypt_res, | 235 | u32 decrypt_res, |
236 | struct ieee80211_rx_status *stats) | 236 | struct ieee80211_rx_status *stats) |
@@ -241,14 +241,14 @@ int il_set_decrypted_flag(struct il_priv *priv, | |||
241 | * All contexts have the same setting here due to it being | 241 | * All contexts have the same setting here due to it being |
242 | * a module parameter, so OK to check any context. | 242 | * a module parameter, so OK to check any context. |
243 | */ | 243 | */ |
244 | if (priv->contexts[IL_RXON_CTX_BSS].active.filter_flags & | 244 | if (il->contexts[IL_RXON_CTX_BSS].active.filter_flags & |
245 | RXON_FILTER_DIS_DECRYPT_MSK) | 245 | RXON_FILTER_DIS_DECRYPT_MSK) |
246 | return 0; | 246 | return 0; |
247 | 247 | ||
248 | if (!(fc & IEEE80211_FCTL_PROTECTED)) | 248 | if (!(fc & IEEE80211_FCTL_PROTECTED)) |
249 | return 0; | 249 | return 0; |
250 | 250 | ||
251 | IL_DEBUG_RX(priv, "decrypt_res:0x%x\n", decrypt_res); | 251 | IL_DEBUG_RX(il, "decrypt_res:0x%x\n", decrypt_res); |
252 | switch (decrypt_res & RX_RES_STATUS_SEC_TYPE_MSK) { | 252 | switch (decrypt_res & RX_RES_STATUS_SEC_TYPE_MSK) { |
253 | case RX_RES_STATUS_SEC_TYPE_TKIP: | 253 | case RX_RES_STATUS_SEC_TYPE_TKIP: |
254 | /* The uCode has got a bad phase 1 Key, pushes the packet. | 254 | /* The uCode has got a bad phase 1 Key, pushes the packet. |
@@ -262,13 +262,13 @@ int il_set_decrypted_flag(struct il_priv *priv, | |||
262 | RX_RES_STATUS_BAD_ICV_MIC) { | 262 | RX_RES_STATUS_BAD_ICV_MIC) { |
263 | /* bad ICV, the packet is destroyed since the | 263 | /* bad ICV, the packet is destroyed since the |
264 | * decryption is inplace, drop it */ | 264 | * decryption is inplace, drop it */ |
265 | IL_DEBUG_RX(priv, "Packet destroyed\n"); | 265 | IL_DEBUG_RX(il, "Packet destroyed\n"); |
266 | return -1; | 266 | return -1; |
267 | } | 267 | } |
268 | case RX_RES_STATUS_SEC_TYPE_CCMP: | 268 | case RX_RES_STATUS_SEC_TYPE_CCMP: |
269 | if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == | 269 | if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == |
270 | RX_RES_STATUS_DECRYPT_OK) { | 270 | RX_RES_STATUS_DECRYPT_OK) { |
271 | IL_DEBUG_RX(priv, "hw decrypt successfully!!!\n"); | 271 | IL_DEBUG_RX(il, "hw decrypt successfully!!!\n"); |
272 | stats->flag |= RX_FLAG_DECRYPTED; | 272 | stats->flag |= RX_FLAG_DECRYPTED; |
273 | } | 273 | } |
274 | break; | 274 | break; |
diff --git a/drivers/net/wireless/iwlegacy/iwl-scan.c b/drivers/net/wireless/iwlegacy/iwl-scan.c index 93e939cc9bc..0184d5bf04e 100644 --- a/drivers/net/wireless/iwlegacy/iwl-scan.c +++ b/drivers/net/wireless/iwlegacy/iwl-scan.c | |||
@@ -54,7 +54,7 @@ | |||
54 | #define IL_PASSIVE_DWELL_BASE (100) | 54 | #define IL_PASSIVE_DWELL_BASE (100) |
55 | #define IL_CHANNEL_TUNE_TIME 5 | 55 | #define IL_CHANNEL_TUNE_TIME 5 |
56 | 56 | ||
57 | static int il_send_scan_abort(struct il_priv *priv) | 57 | static int il_send_scan_abort(struct il_priv *il) |
58 | { | 58 | { |
59 | int ret; | 59 | int ret; |
60 | struct il_rx_packet *pkt; | 60 | struct il_rx_packet *pkt; |
@@ -66,14 +66,14 @@ static int il_send_scan_abort(struct il_priv *priv) | |||
66 | /* Exit instantly with error when device is not ready | 66 | /* Exit instantly with error when device is not ready |
67 | * to receive scan abort command or it does not perform | 67 | * to receive scan abort command or it does not perform |
68 | * hardware scan currently */ | 68 | * hardware scan currently */ |
69 | if (!test_bit(STATUS_READY, &priv->status) || | 69 | if (!test_bit(STATUS_READY, &il->status) || |
70 | !test_bit(STATUS_GEO_CONFIGURED, &priv->status) || | 70 | !test_bit(STATUS_GEO_CONFIGURED, &il->status) || |
71 | !test_bit(STATUS_SCAN_HW, &priv->status) || | 71 | !test_bit(STATUS_SCAN_HW, &il->status) || |
72 | test_bit(STATUS_FW_ERROR, &priv->status) || | 72 | test_bit(STATUS_FW_ERROR, &il->status) || |
73 | test_bit(STATUS_EXIT_PENDING, &priv->status)) | 73 | test_bit(STATUS_EXIT_PENDING, &il->status)) |
74 | return -EIO; | 74 | return -EIO; |
75 | 75 | ||
76 | ret = il_send_cmd_sync(priv, &cmd); | 76 | ret = il_send_cmd_sync(il, &cmd); |
77 | if (ret) | 77 | if (ret) |
78 | return ret; | 78 | return ret; |
79 | 79 | ||
@@ -85,73 +85,73 @@ static int il_send_scan_abort(struct il_priv *priv) | |||
85 | * can occur if we send the scan abort before we | 85 | * can occur if we send the scan abort before we |
86 | * the microcode has notified us that a scan is | 86 | * the microcode has notified us that a scan is |
87 | * completed. */ | 87 | * completed. */ |
88 | IL_DEBUG_SCAN(priv, "SCAN_ABORT ret %d.\n", pkt->u.status); | 88 | IL_DEBUG_SCAN(il, "SCAN_ABORT ret %d.\n", pkt->u.status); |
89 | ret = -EIO; | 89 | ret = -EIO; |
90 | } | 90 | } |
91 | 91 | ||
92 | il_free_pages(priv, cmd.reply_page); | 92 | il_free_pages(il, cmd.reply_page); |
93 | return ret; | 93 | return ret; |
94 | } | 94 | } |
95 | 95 | ||
96 | static void il_complete_scan(struct il_priv *priv, bool aborted) | 96 | static void il_complete_scan(struct il_priv *il, bool aborted) |
97 | { | 97 | { |
98 | /* check if scan was requested from mac80211 */ | 98 | /* check if scan was requested from mac80211 */ |
99 | if (priv->scan_request) { | 99 | if (il->scan_request) { |
100 | IL_DEBUG_SCAN(priv, "Complete scan in mac80211\n"); | 100 | IL_DEBUG_SCAN(il, "Complete scan in mac80211\n"); |
101 | ieee80211_scan_completed(priv->hw, aborted); | 101 | ieee80211_scan_completed(il->hw, aborted); |
102 | } | 102 | } |
103 | 103 | ||
104 | priv->scan_vif = NULL; | 104 | il->scan_vif = NULL; |
105 | priv->scan_request = NULL; | 105 | il->scan_request = NULL; |
106 | } | 106 | } |
107 | 107 | ||
108 | void il_force_scan_end(struct il_priv *priv) | 108 | void il_force_scan_end(struct il_priv *il) |
109 | { | 109 | { |
110 | lockdep_assert_held(&priv->mutex); | 110 | lockdep_assert_held(&il->mutex); |
111 | 111 | ||
112 | if (!test_bit(STATUS_SCANNING, &priv->status)) { | 112 | if (!test_bit(STATUS_SCANNING, &il->status)) { |
113 | IL_DEBUG_SCAN(priv, "Forcing scan end while not scanning\n"); | 113 | IL_DEBUG_SCAN(il, "Forcing scan end while not scanning\n"); |
114 | return; | 114 | return; |
115 | } | 115 | } |
116 | 116 | ||
117 | IL_DEBUG_SCAN(priv, "Forcing scan end\n"); | 117 | IL_DEBUG_SCAN(il, "Forcing scan end\n"); |
118 | clear_bit(STATUS_SCANNING, &priv->status); | 118 | clear_bit(STATUS_SCANNING, &il->status); |
119 | clear_bit(STATUS_SCAN_HW, &priv->status); | 119 | clear_bit(STATUS_SCAN_HW, &il->status); |
120 | clear_bit(STATUS_SCAN_ABORTING, &priv->status); | 120 | clear_bit(STATUS_SCAN_ABORTING, &il->status); |
121 | il_complete_scan(priv, true); | 121 | il_complete_scan(il, true); |
122 | } | 122 | } |
123 | 123 | ||
124 | static void il_do_scan_abort(struct il_priv *priv) | 124 | static void il_do_scan_abort(struct il_priv *il) |
125 | { | 125 | { |
126 | int ret; | 126 | int ret; |
127 | 127 | ||
128 | lockdep_assert_held(&priv->mutex); | 128 | lockdep_assert_held(&il->mutex); |
129 | 129 | ||
130 | if (!test_bit(STATUS_SCANNING, &priv->status)) { | 130 | if (!test_bit(STATUS_SCANNING, &il->status)) { |
131 | IL_DEBUG_SCAN(priv, "Not performing scan to abort\n"); | 131 | IL_DEBUG_SCAN(il, "Not performing scan to abort\n"); |
132 | return; | 132 | return; |
133 | } | 133 | } |
134 | 134 | ||
135 | if (test_and_set_bit(STATUS_SCAN_ABORTING, &priv->status)) { | 135 | if (test_and_set_bit(STATUS_SCAN_ABORTING, &il->status)) { |
136 | IL_DEBUG_SCAN(priv, "Scan abort in progress\n"); | 136 | IL_DEBUG_SCAN(il, "Scan abort in progress\n"); |
137 | return; | 137 | return; |
138 | } | 138 | } |
139 | 139 | ||
140 | ret = il_send_scan_abort(priv); | 140 | ret = il_send_scan_abort(il); |
141 | if (ret) { | 141 | if (ret) { |
142 | IL_DEBUG_SCAN(priv, "Send scan abort failed %d\n", ret); | 142 | IL_DEBUG_SCAN(il, "Send scan abort failed %d\n", ret); |
143 | il_force_scan_end(priv); | 143 | il_force_scan_end(il); |
144 | } else | 144 | } else |
145 | IL_DEBUG_SCAN(priv, "Successfully send scan abort\n"); | 145 | IL_DEBUG_SCAN(il, "Successfully send scan abort\n"); |
146 | } | 146 | } |
147 | 147 | ||
148 | /** | 148 | /** |
149 | * il_scan_cancel - Cancel any currently executing HW scan | 149 | * il_scan_cancel - Cancel any currently executing HW scan |
150 | */ | 150 | */ |
151 | int il_scan_cancel(struct il_priv *priv) | 151 | int il_scan_cancel(struct il_priv *il) |
152 | { | 152 | { |
153 | IL_DEBUG_SCAN(priv, "Queuing abort scan\n"); | 153 | IL_DEBUG_SCAN(il, "Queuing abort scan\n"); |
154 | queue_work(priv->workqueue, &priv->abort_scan); | 154 | queue_work(il->workqueue, &il->abort_scan); |
155 | return 0; | 155 | return 0; |
156 | } | 156 | } |
157 | EXPORT_SYMBOL(il_scan_cancel); | 157 | EXPORT_SYMBOL(il_scan_cancel); |
@@ -161,28 +161,28 @@ EXPORT_SYMBOL(il_scan_cancel); | |||
161 | * @ms: amount of time to wait (in milliseconds) for scan to abort | 161 | * @ms: amount of time to wait (in milliseconds) for scan to abort |
162 | * | 162 | * |
163 | */ | 163 | */ |
164 | int il_scan_cancel_timeout(struct il_priv *priv, unsigned long ms) | 164 | int il_scan_cancel_timeout(struct il_priv *il, unsigned long ms) |
165 | { | 165 | { |
166 | unsigned long timeout = jiffies + msecs_to_jiffies(ms); | 166 | unsigned long timeout = jiffies + msecs_to_jiffies(ms); |
167 | 167 | ||
168 | lockdep_assert_held(&priv->mutex); | 168 | lockdep_assert_held(&il->mutex); |
169 | 169 | ||
170 | IL_DEBUG_SCAN(priv, "Scan cancel timeout\n"); | 170 | IL_DEBUG_SCAN(il, "Scan cancel timeout\n"); |
171 | 171 | ||
172 | il_do_scan_abort(priv); | 172 | il_do_scan_abort(il); |
173 | 173 | ||
174 | while (time_before_eq(jiffies, timeout)) { | 174 | while (time_before_eq(jiffies, timeout)) { |
175 | if (!test_bit(STATUS_SCAN_HW, &priv->status)) | 175 | if (!test_bit(STATUS_SCAN_HW, &il->status)) |
176 | break; | 176 | break; |
177 | msleep(20); | 177 | msleep(20); |
178 | } | 178 | } |
179 | 179 | ||
180 | return test_bit(STATUS_SCAN_HW, &priv->status); | 180 | return test_bit(STATUS_SCAN_HW, &il->status); |
181 | } | 181 | } |
182 | EXPORT_SYMBOL(il_scan_cancel_timeout); | 182 | EXPORT_SYMBOL(il_scan_cancel_timeout); |
183 | 183 | ||
184 | /* Service response to REPLY_SCAN_CMD (0x80) */ | 184 | /* Service response to REPLY_SCAN_CMD (0x80) */ |
185 | static void il_rx_reply_scan(struct il_priv *priv, | 185 | static void il_rx_reply_scan(struct il_priv *il, |
186 | struct il_rx_mem_buffer *rxb) | 186 | struct il_rx_mem_buffer *rxb) |
187 | { | 187 | { |
188 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 188 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
@@ -190,19 +190,19 @@ static void il_rx_reply_scan(struct il_priv *priv, | |||
190 | struct il_scanreq_notification *notif = | 190 | struct il_scanreq_notification *notif = |
191 | (struct il_scanreq_notification *)pkt->u.raw; | 191 | (struct il_scanreq_notification *)pkt->u.raw; |
192 | 192 | ||
193 | IL_DEBUG_SCAN(priv, "Scan request status = 0x%x\n", notif->status); | 193 | IL_DEBUG_SCAN(il, "Scan request status = 0x%x\n", notif->status); |
194 | #endif | 194 | #endif |
195 | } | 195 | } |
196 | 196 | ||
197 | /* Service SCAN_START_NOTIFICATION (0x82) */ | 197 | /* Service SCAN_START_NOTIFICATION (0x82) */ |
198 | static void il_rx_scan_start_notif(struct il_priv *priv, | 198 | static void il_rx_scan_start_notif(struct il_priv *il, |
199 | struct il_rx_mem_buffer *rxb) | 199 | struct il_rx_mem_buffer *rxb) |
200 | { | 200 | { |
201 | struct il_rx_packet *pkt = rxb_addr(rxb); | 201 | struct il_rx_packet *pkt = rxb_addr(rxb); |
202 | struct il_scanstart_notification *notif = | 202 | struct il_scanstart_notification *notif = |
203 | (struct il_scanstart_notification *)pkt->u.raw; | 203 | (struct il_scanstart_notification *)pkt->u.raw; |
204 | priv->scan_start_tsf = le32_to_cpu(notif->tsf_low); | 204 | il->scan_start_tsf = le32_to_cpu(notif->tsf_low); |
205 | IL_DEBUG_SCAN(priv, "Scan start: " | 205 | IL_DEBUG_SCAN(il, "Scan start: " |
206 | "%d [802.11%s] " | 206 | "%d [802.11%s] " |
207 | "(TSF: 0x%08X:%08X) - %d (beacon timer %u)\n", | 207 | "(TSF: 0x%08X:%08X) - %d (beacon timer %u)\n", |
208 | notif->channel, | 208 | notif->channel, |
@@ -213,7 +213,7 @@ static void il_rx_scan_start_notif(struct il_priv *priv, | |||
213 | } | 213 | } |
214 | 214 | ||
215 | /* Service SCAN_RESULTS_NOTIFICATION (0x83) */ | 215 | /* Service SCAN_RESULTS_NOTIFICATION (0x83) */ |
216 | static void il_rx_scan_results_notif(struct il_priv *priv, | 216 | static void il_rx_scan_results_notif(struct il_priv *il, |
217 | struct il_rx_mem_buffer *rxb) | 217 | struct il_rx_mem_buffer *rxb) |
218 | { | 218 | { |
219 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 219 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
@@ -221,7 +221,7 @@ static void il_rx_scan_results_notif(struct il_priv *priv, | |||
221 | struct il_scanresults_notification *notif = | 221 | struct il_scanresults_notification *notif = |
222 | (struct il_scanresults_notification *)pkt->u.raw; | 222 | (struct il_scanresults_notification *)pkt->u.raw; |
223 | 223 | ||
224 | IL_DEBUG_SCAN(priv, "Scan ch.res: " | 224 | IL_DEBUG_SCAN(il, "Scan ch.res: " |
225 | "%d [802.11%s] " | 225 | "%d [802.11%s] " |
226 | "(TSF: 0x%08X:%08X) - %d " | 226 | "(TSF: 0x%08X:%08X) - %d " |
227 | "elapsed=%lu usec\n", | 227 | "elapsed=%lu usec\n", |
@@ -230,12 +230,12 @@ static void il_rx_scan_results_notif(struct il_priv *priv, | |||
230 | le32_to_cpu(notif->tsf_high), | 230 | le32_to_cpu(notif->tsf_high), |
231 | le32_to_cpu(notif->tsf_low), | 231 | le32_to_cpu(notif->tsf_low), |
232 | le32_to_cpu(notif->statistics[0]), | 232 | le32_to_cpu(notif->statistics[0]), |
233 | le32_to_cpu(notif->tsf_low) - priv->scan_start_tsf); | 233 | le32_to_cpu(notif->tsf_low) - il->scan_start_tsf); |
234 | #endif | 234 | #endif |
235 | } | 235 | } |
236 | 236 | ||
237 | /* Service SCAN_COMPLETE_NOTIFICATION (0x84) */ | 237 | /* Service SCAN_COMPLETE_NOTIFICATION (0x84) */ |
238 | static void il_rx_scan_complete_notif(struct il_priv *priv, | 238 | static void il_rx_scan_complete_notif(struct il_priv *il, |
239 | struct il_rx_mem_buffer *rxb) | 239 | struct il_rx_mem_buffer *rxb) |
240 | { | 240 | { |
241 | 241 | ||
@@ -244,36 +244,36 @@ static void il_rx_scan_complete_notif(struct il_priv *priv, | |||
244 | struct il_scancomplete_notification *scan_notif = (void *)pkt->u.raw; | 244 | struct il_scancomplete_notification *scan_notif = (void *)pkt->u.raw; |
245 | #endif | 245 | #endif |
246 | 246 | ||
247 | IL_DEBUG_SCAN(priv, | 247 | IL_DEBUG_SCAN(il, |
248 | "Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n", | 248 | "Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n", |
249 | scan_notif->scanned_channels, | 249 | scan_notif->scanned_channels, |
250 | scan_notif->tsf_low, | 250 | scan_notif->tsf_low, |
251 | scan_notif->tsf_high, scan_notif->status); | 251 | scan_notif->tsf_high, scan_notif->status); |
252 | 252 | ||
253 | /* The HW is no longer scanning */ | 253 | /* The HW is no longer scanning */ |
254 | clear_bit(STATUS_SCAN_HW, &priv->status); | 254 | clear_bit(STATUS_SCAN_HW, &il->status); |
255 | 255 | ||
256 | IL_DEBUG_SCAN(priv, "Scan on %sGHz took %dms\n", | 256 | IL_DEBUG_SCAN(il, "Scan on %sGHz took %dms\n", |
257 | (priv->scan_band == IEEE80211_BAND_2GHZ) ? "2.4" : "5.2", | 257 | (il->scan_band == IEEE80211_BAND_2GHZ) ? "2.4" : "5.2", |
258 | jiffies_to_msecs(jiffies - priv->scan_start)); | 258 | jiffies_to_msecs(jiffies - il->scan_start)); |
259 | 259 | ||
260 | queue_work(priv->workqueue, &priv->scan_completed); | 260 | queue_work(il->workqueue, &il->scan_completed); |
261 | } | 261 | } |
262 | 262 | ||
263 | void il_setup_rx_scan_handlers(struct il_priv *priv) | 263 | void il_setup_rx_scan_handlers(struct il_priv *il) |
264 | { | 264 | { |
265 | /* scan handlers */ | 265 | /* scan handlers */ |
266 | priv->rx_handlers[REPLY_SCAN_CMD] = il_rx_reply_scan; | 266 | il->rx_handlers[REPLY_SCAN_CMD] = il_rx_reply_scan; |
267 | priv->rx_handlers[SCAN_START_NOTIFICATION] = | 267 | il->rx_handlers[SCAN_START_NOTIFICATION] = |
268 | il_rx_scan_start_notif; | 268 | il_rx_scan_start_notif; |
269 | priv->rx_handlers[SCAN_RESULTS_NOTIFICATION] = | 269 | il->rx_handlers[SCAN_RESULTS_NOTIFICATION] = |
270 | il_rx_scan_results_notif; | 270 | il_rx_scan_results_notif; |
271 | priv->rx_handlers[SCAN_COMPLETE_NOTIFICATION] = | 271 | il->rx_handlers[SCAN_COMPLETE_NOTIFICATION] = |
272 | il_rx_scan_complete_notif; | 272 | il_rx_scan_complete_notif; |
273 | } | 273 | } |
274 | EXPORT_SYMBOL(il_setup_rx_scan_handlers); | 274 | EXPORT_SYMBOL(il_setup_rx_scan_handlers); |
275 | 275 | ||
276 | inline u16 il_get_active_dwell_time(struct il_priv *priv, | 276 | inline u16 il_get_active_dwell_time(struct il_priv *il, |
277 | enum ieee80211_band band, | 277 | enum ieee80211_band band, |
278 | u8 n_probes) | 278 | u8 n_probes) |
279 | { | 279 | { |
@@ -286,7 +286,7 @@ inline u16 il_get_active_dwell_time(struct il_priv *priv, | |||
286 | } | 286 | } |
287 | EXPORT_SYMBOL(il_get_active_dwell_time); | 287 | EXPORT_SYMBOL(il_get_active_dwell_time); |
288 | 288 | ||
289 | u16 il_get_passive_dwell_time(struct il_priv *priv, | 289 | u16 il_get_passive_dwell_time(struct il_priv *il, |
290 | enum ieee80211_band band, | 290 | enum ieee80211_band band, |
291 | struct ieee80211_vif *vif) | 291 | struct ieee80211_vif *vif) |
292 | { | 292 | { |
@@ -295,13 +295,13 @@ u16 il_get_passive_dwell_time(struct il_priv *priv, | |||
295 | IL_PASSIVE_DWELL_BASE + IL_PASSIVE_DWELL_TIME_24 : | 295 | IL_PASSIVE_DWELL_BASE + IL_PASSIVE_DWELL_TIME_24 : |
296 | IL_PASSIVE_DWELL_BASE + IL_PASSIVE_DWELL_TIME_52; | 296 | IL_PASSIVE_DWELL_BASE + IL_PASSIVE_DWELL_TIME_52; |
297 | 297 | ||
298 | if (il_is_any_associated(priv)) { | 298 | if (il_is_any_associated(il)) { |
299 | /* | 299 | /* |
300 | * If we're associated, we clamp the maximum passive | 300 | * If we're associated, we clamp the maximum passive |
301 | * dwell time to be 98% of the smallest beacon interval | 301 | * dwell time to be 98% of the smallest beacon interval |
302 | * (minus 2 * channel tune time) | 302 | * (minus 2 * channel tune time) |
303 | */ | 303 | */ |
304 | for_each_context(priv, ctx) { | 304 | for_each_context(il, ctx) { |
305 | u16 value; | 305 | u16 value; |
306 | 306 | ||
307 | if (!il_is_associated_ctx(ctx)) | 307 | if (!il_is_associated_ctx(ctx)) |
@@ -318,56 +318,56 @@ u16 il_get_passive_dwell_time(struct il_priv *priv, | |||
318 | } | 318 | } |
319 | EXPORT_SYMBOL(il_get_passive_dwell_time); | 319 | EXPORT_SYMBOL(il_get_passive_dwell_time); |
320 | 320 | ||
321 | void il_init_scan_params(struct il_priv *priv) | 321 | void il_init_scan_params(struct il_priv *il) |
322 | { | 322 | { |
323 | u8 ant_idx = fls(priv->hw_params.valid_tx_ant) - 1; | 323 | u8 ant_idx = fls(il->hw_params.valid_tx_ant) - 1; |
324 | if (!priv->scan_tx_ant[IEEE80211_BAND_5GHZ]) | 324 | if (!il->scan_tx_ant[IEEE80211_BAND_5GHZ]) |
325 | priv->scan_tx_ant[IEEE80211_BAND_5GHZ] = ant_idx; | 325 | il->scan_tx_ant[IEEE80211_BAND_5GHZ] = ant_idx; |
326 | if (!priv->scan_tx_ant[IEEE80211_BAND_2GHZ]) | 326 | if (!il->scan_tx_ant[IEEE80211_BAND_2GHZ]) |
327 | priv->scan_tx_ant[IEEE80211_BAND_2GHZ] = ant_idx; | 327 | il->scan_tx_ant[IEEE80211_BAND_2GHZ] = ant_idx; |
328 | } | 328 | } |
329 | EXPORT_SYMBOL(il_init_scan_params); | 329 | EXPORT_SYMBOL(il_init_scan_params); |
330 | 330 | ||
331 | static int il_scan_initiate(struct il_priv *priv, | 331 | static int il_scan_initiate(struct il_priv *il, |
332 | struct ieee80211_vif *vif) | 332 | struct ieee80211_vif *vif) |
333 | { | 333 | { |
334 | int ret; | 334 | int ret; |
335 | 335 | ||
336 | lockdep_assert_held(&priv->mutex); | 336 | lockdep_assert_held(&il->mutex); |
337 | 337 | ||
338 | if (WARN_ON(!priv->cfg->ops->utils->request_scan)) | 338 | if (WARN_ON(!il->cfg->ops->utils->request_scan)) |
339 | return -EOPNOTSUPP; | 339 | return -EOPNOTSUPP; |
340 | 340 | ||
341 | cancel_delayed_work(&priv->scan_check); | 341 | cancel_delayed_work(&il->scan_check); |
342 | 342 | ||
343 | if (!il_is_ready_rf(priv)) { | 343 | if (!il_is_ready_rf(il)) { |
344 | IL_WARN(priv, "Request scan called when driver not ready.\n"); | 344 | IL_WARN(il, "Request scan called when driver not ready.\n"); |
345 | return -EIO; | 345 | return -EIO; |
346 | } | 346 | } |
347 | 347 | ||
348 | if (test_bit(STATUS_SCAN_HW, &priv->status)) { | 348 | if (test_bit(STATUS_SCAN_HW, &il->status)) { |
349 | IL_DEBUG_SCAN(priv, | 349 | IL_DEBUG_SCAN(il, |
350 | "Multiple concurrent scan requests in parallel.\n"); | 350 | "Multiple concurrent scan requests in parallel.\n"); |
351 | return -EBUSY; | 351 | return -EBUSY; |
352 | } | 352 | } |
353 | 353 | ||
354 | if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) { | 354 | if (test_bit(STATUS_SCAN_ABORTING, &il->status)) { |
355 | IL_DEBUG_SCAN(priv, "Scan request while abort pending.\n"); | 355 | IL_DEBUG_SCAN(il, "Scan request while abort pending.\n"); |
356 | return -EBUSY; | 356 | return -EBUSY; |
357 | } | 357 | } |
358 | 358 | ||
359 | IL_DEBUG_SCAN(priv, "Starting scan...\n"); | 359 | IL_DEBUG_SCAN(il, "Starting scan...\n"); |
360 | 360 | ||
361 | set_bit(STATUS_SCANNING, &priv->status); | 361 | set_bit(STATUS_SCANNING, &il->status); |
362 | priv->scan_start = jiffies; | 362 | il->scan_start = jiffies; |
363 | 363 | ||
364 | ret = priv->cfg->ops->utils->request_scan(priv, vif); | 364 | ret = il->cfg->ops->utils->request_scan(il, vif); |
365 | if (ret) { | 365 | if (ret) { |
366 | clear_bit(STATUS_SCANNING, &priv->status); | 366 | clear_bit(STATUS_SCANNING, &il->status); |
367 | return ret; | 367 | return ret; |
368 | } | 368 | } |
369 | 369 | ||
370 | queue_delayed_work(priv->workqueue, &priv->scan_check, | 370 | queue_delayed_work(il->workqueue, &il->scan_check, |
371 | IL_SCAN_CHECK_WATCHDOG); | 371 | IL_SCAN_CHECK_WATCHDOG); |
372 | 372 | ||
373 | return 0; | 373 | return 0; |
@@ -377,33 +377,33 @@ int il_mac_hw_scan(struct ieee80211_hw *hw, | |||
377 | struct ieee80211_vif *vif, | 377 | struct ieee80211_vif *vif, |
378 | struct cfg80211_scan_request *req) | 378 | struct cfg80211_scan_request *req) |
379 | { | 379 | { |
380 | struct il_priv *priv = hw->priv; | 380 | struct il_priv *il = hw->priv; |
381 | int ret; | 381 | int ret; |
382 | 382 | ||
383 | IL_DEBUG_MAC80211(priv, "enter\n"); | 383 | IL_DEBUG_MAC80211(il, "enter\n"); |
384 | 384 | ||
385 | if (req->n_channels == 0) | 385 | if (req->n_channels == 0) |
386 | return -EINVAL; | 386 | return -EINVAL; |
387 | 387 | ||
388 | mutex_lock(&priv->mutex); | 388 | mutex_lock(&il->mutex); |
389 | 389 | ||
390 | if (test_bit(STATUS_SCANNING, &priv->status)) { | 390 | if (test_bit(STATUS_SCANNING, &il->status)) { |
391 | IL_DEBUG_SCAN(priv, "Scan already in progress.\n"); | 391 | IL_DEBUG_SCAN(il, "Scan already in progress.\n"); |
392 | ret = -EAGAIN; | 392 | ret = -EAGAIN; |
393 | goto out_unlock; | 393 | goto out_unlock; |
394 | } | 394 | } |
395 | 395 | ||
396 | /* mac80211 will only ask for one band at a time */ | 396 | /* mac80211 will only ask for one band at a time */ |
397 | priv->scan_request = req; | 397 | il->scan_request = req; |
398 | priv->scan_vif = vif; | 398 | il->scan_vif = vif; |
399 | priv->scan_band = req->channels[0]->band; | 399 | il->scan_band = req->channels[0]->band; |
400 | 400 | ||
401 | ret = il_scan_initiate(priv, vif); | 401 | ret = il_scan_initiate(il, vif); |
402 | 402 | ||
403 | IL_DEBUG_MAC80211(priv, "leave\n"); | 403 | IL_DEBUG_MAC80211(il, "leave\n"); |
404 | 404 | ||
405 | out_unlock: | 405 | out_unlock: |
406 | mutex_unlock(&priv->mutex); | 406 | mutex_unlock(&il->mutex); |
407 | 407 | ||
408 | return ret; | 408 | return ret; |
409 | } | 409 | } |
@@ -411,17 +411,17 @@ EXPORT_SYMBOL(il_mac_hw_scan); | |||
411 | 411 | ||
412 | static void il_bg_scan_check(struct work_struct *data) | 412 | static void il_bg_scan_check(struct work_struct *data) |
413 | { | 413 | { |
414 | struct il_priv *priv = | 414 | struct il_priv *il = |
415 | container_of(data, struct il_priv, scan_check.work); | 415 | container_of(data, struct il_priv, scan_check.work); |
416 | 416 | ||
417 | IL_DEBUG_SCAN(priv, "Scan check work\n"); | 417 | IL_DEBUG_SCAN(il, "Scan check work\n"); |
418 | 418 | ||
419 | /* Since we are here firmware does not finish scan and | 419 | /* Since we are here firmware does not finish scan and |
420 | * most likely is in bad shape, so we don't bother to | 420 | * most likely is in bad shape, so we don't bother to |
421 | * send abort command, just force scan complete to mac80211 */ | 421 | * send abort command, just force scan complete to mac80211 */ |
422 | mutex_lock(&priv->mutex); | 422 | mutex_lock(&il->mutex); |
423 | il_force_scan_end(priv); | 423 | il_force_scan_end(il); |
424 | mutex_unlock(&priv->mutex); | 424 | mutex_unlock(&il->mutex); |
425 | } | 425 | } |
426 | 426 | ||
427 | /** | 427 | /** |
@@ -429,7 +429,7 @@ static void il_bg_scan_check(struct work_struct *data) | |||
429 | */ | 429 | */ |
430 | 430 | ||
431 | u16 | 431 | u16 |
432 | il_fill_probe_req(struct il_priv *priv, struct ieee80211_mgmt *frame, | 432 | il_fill_probe_req(struct il_priv *il, struct ieee80211_mgmt *frame, |
433 | const u8 *ta, const u8 *ies, int ie_len, int left) | 433 | const u8 *ta, const u8 *ies, int ie_len, int left) |
434 | { | 434 | { |
435 | int len = 0; | 435 | int len = 0; |
@@ -475,75 +475,75 @@ EXPORT_SYMBOL(il_fill_probe_req); | |||
475 | 475 | ||
476 | static void il_bg_abort_scan(struct work_struct *work) | 476 | static void il_bg_abort_scan(struct work_struct *work) |
477 | { | 477 | { |
478 | struct il_priv *priv = container_of(work, struct il_priv, abort_scan); | 478 | struct il_priv *il = container_of(work, struct il_priv, abort_scan); |
479 | 479 | ||
480 | IL_DEBUG_SCAN(priv, "Abort scan work\n"); | 480 | IL_DEBUG_SCAN(il, "Abort scan work\n"); |
481 | 481 | ||
482 | /* We keep scan_check work queued in case when firmware will not | 482 | /* We keep scan_check work queued in case when firmware will not |
483 | * report back scan completed notification */ | 483 | * report back scan completed notification */ |
484 | mutex_lock(&priv->mutex); | 484 | mutex_lock(&il->mutex); |
485 | il_scan_cancel_timeout(priv, 200); | 485 | il_scan_cancel_timeout(il, 200); |
486 | mutex_unlock(&priv->mutex); | 486 | mutex_unlock(&il->mutex); |
487 | } | 487 | } |
488 | 488 | ||
489 | static void il_bg_scan_completed(struct work_struct *work) | 489 | static void il_bg_scan_completed(struct work_struct *work) |
490 | { | 490 | { |
491 | struct il_priv *priv = | 491 | struct il_priv *il = |
492 | container_of(work, struct il_priv, scan_completed); | 492 | container_of(work, struct il_priv, scan_completed); |
493 | bool aborted; | 493 | bool aborted; |
494 | 494 | ||
495 | IL_DEBUG_SCAN(priv, "Completed scan.\n"); | 495 | IL_DEBUG_SCAN(il, "Completed scan.\n"); |
496 | 496 | ||
497 | cancel_delayed_work(&priv->scan_check); | 497 | cancel_delayed_work(&il->scan_check); |
498 | 498 | ||
499 | mutex_lock(&priv->mutex); | 499 | mutex_lock(&il->mutex); |
500 | 500 | ||
501 | aborted = test_and_clear_bit(STATUS_SCAN_ABORTING, &priv->status); | 501 | aborted = test_and_clear_bit(STATUS_SCAN_ABORTING, &il->status); |
502 | if (aborted) | 502 | if (aborted) |
503 | IL_DEBUG_SCAN(priv, "Aborted scan completed.\n"); | 503 | IL_DEBUG_SCAN(il, "Aborted scan completed.\n"); |
504 | 504 | ||
505 | if (!test_and_clear_bit(STATUS_SCANNING, &priv->status)) { | 505 | if (!test_and_clear_bit(STATUS_SCANNING, &il->status)) { |
506 | IL_DEBUG_SCAN(priv, "Scan already completed.\n"); | 506 | IL_DEBUG_SCAN(il, "Scan already completed.\n"); |
507 | goto out_settings; | 507 | goto out_settings; |
508 | } | 508 | } |
509 | 509 | ||
510 | il_complete_scan(priv, aborted); | 510 | il_complete_scan(il, aborted); |
511 | 511 | ||
512 | out_settings: | 512 | out_settings: |
513 | /* Can we still talk to firmware ? */ | 513 | /* Can we still talk to firmware ? */ |
514 | if (!il_is_ready_rf(priv)) | 514 | if (!il_is_ready_rf(il)) |
515 | goto out; | 515 | goto out; |
516 | 516 | ||
517 | /* | 517 | /* |
518 | * We do not commit power settings while scan is pending, | 518 | * We do not commit power settings while scan is pending, |
519 | * do it now if the settings changed. | 519 | * do it now if the settings changed. |
520 | */ | 520 | */ |
521 | il_power_set_mode(priv, &priv->power_data.sleep_cmd_next, false); | 521 | il_power_set_mode(il, &il->power_data.sleep_cmd_next, false); |
522 | il_set_tx_power(priv, priv->tx_power_next, false); | 522 | il_set_tx_power(il, il->tx_power_next, false); |
523 | 523 | ||
524 | priv->cfg->ops->utils->post_scan(priv); | 524 | il->cfg->ops->utils->post_scan(il); |
525 | 525 | ||
526 | out: | 526 | out: |
527 | mutex_unlock(&priv->mutex); | 527 | mutex_unlock(&il->mutex); |
528 | } | 528 | } |
529 | 529 | ||
530 | void il_setup_scan_deferred_work(struct il_priv *priv) | 530 | void il_setup_scan_deferred_work(struct il_priv *il) |
531 | { | 531 | { |
532 | INIT_WORK(&priv->scan_completed, il_bg_scan_completed); | 532 | INIT_WORK(&il->scan_completed, il_bg_scan_completed); |
533 | INIT_WORK(&priv->abort_scan, il_bg_abort_scan); | 533 | INIT_WORK(&il->abort_scan, il_bg_abort_scan); |
534 | INIT_DELAYED_WORK(&priv->scan_check, il_bg_scan_check); | 534 | INIT_DELAYED_WORK(&il->scan_check, il_bg_scan_check); |
535 | } | 535 | } |
536 | EXPORT_SYMBOL(il_setup_scan_deferred_work); | 536 | EXPORT_SYMBOL(il_setup_scan_deferred_work); |
537 | 537 | ||
538 | void il_cancel_scan_deferred_work(struct il_priv *priv) | 538 | void il_cancel_scan_deferred_work(struct il_priv *il) |
539 | { | 539 | { |
540 | cancel_work_sync(&priv->abort_scan); | 540 | cancel_work_sync(&il->abort_scan); |
541 | cancel_work_sync(&priv->scan_completed); | 541 | cancel_work_sync(&il->scan_completed); |
542 | 542 | ||
543 | if (cancel_delayed_work_sync(&priv->scan_check)) { | 543 | if (cancel_delayed_work_sync(&il->scan_check)) { |
544 | mutex_lock(&priv->mutex); | 544 | mutex_lock(&il->mutex); |
545 | il_force_scan_end(priv); | 545 | il_force_scan_end(il); |
546 | mutex_unlock(&priv->mutex); | 546 | mutex_unlock(&il->mutex); |
547 | } | 547 | } |
548 | } | 548 | } |
549 | EXPORT_SYMBOL(il_cancel_scan_deferred_work); | 549 | 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 3773f7d64d2..7d66e79f5d3 100644 --- a/drivers/net/wireless/iwlegacy/iwl-sta.c +++ b/drivers/net/wireless/iwlegacy/iwl-sta.c | |||
@@ -36,28 +36,28 @@ | |||
36 | #include "iwl-core.h" | 36 | #include "iwl-core.h" |
37 | #include "iwl-sta.h" | 37 | #include "iwl-sta.h" |
38 | 38 | ||
39 | /* priv->sta_lock must be held */ | 39 | /* il->sta_lock must be held */ |
40 | static void il_sta_ucode_activate(struct il_priv *priv, u8 sta_id) | 40 | static void il_sta_ucode_activate(struct il_priv *il, u8 sta_id) |
41 | { | 41 | { |
42 | 42 | ||
43 | if (!(priv->stations[sta_id].used & IL_STA_DRIVER_ACTIVE)) | 43 | if (!(il->stations[sta_id].used & IL_STA_DRIVER_ACTIVE)) |
44 | IL_ERR(priv, | 44 | IL_ERR(il, |
45 | "ACTIVATE a non DRIVER active station id %u addr %pM\n", | 45 | "ACTIVATE a non DRIVER active station id %u addr %pM\n", |
46 | sta_id, priv->stations[sta_id].sta.sta.addr); | 46 | sta_id, il->stations[sta_id].sta.sta.addr); |
47 | 47 | ||
48 | if (priv->stations[sta_id].used & IL_STA_UCODE_ACTIVE) { | 48 | if (il->stations[sta_id].used & IL_STA_UCODE_ACTIVE) { |
49 | IL_DEBUG_ASSOC(priv, | 49 | IL_DEBUG_ASSOC(il, |
50 | "STA id %u addr %pM already present" | 50 | "STA id %u addr %pM already present" |
51 | " in uCode (according to driver)\n", | 51 | " in uCode (according to driver)\n", |
52 | sta_id, priv->stations[sta_id].sta.sta.addr); | 52 | sta_id, il->stations[sta_id].sta.sta.addr); |
53 | } else { | 53 | } else { |
54 | priv->stations[sta_id].used |= IL_STA_UCODE_ACTIVE; | 54 | il->stations[sta_id].used |= IL_STA_UCODE_ACTIVE; |
55 | IL_DEBUG_ASSOC(priv, "Added STA id %u addr %pM to uCode\n", | 55 | IL_DEBUG_ASSOC(il, "Added STA id %u addr %pM to uCode\n", |
56 | sta_id, priv->stations[sta_id].sta.sta.addr); | 56 | sta_id, il->stations[sta_id].sta.sta.addr); |
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | static int il_process_add_sta_resp(struct il_priv *priv, | 60 | static int il_process_add_sta_resp(struct il_priv *il, |
61 | struct il_addsta_cmd *addsta, | 61 | struct il_addsta_cmd *addsta, |
62 | struct il_rx_packet *pkt, | 62 | struct il_rx_packet *pkt, |
63 | bool sync) | 63 | bool sync) |
@@ -67,45 +67,45 @@ static int il_process_add_sta_resp(struct il_priv *priv, | |||
67 | int ret = -EIO; | 67 | int ret = -EIO; |
68 | 68 | ||
69 | if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { | 69 | if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { |
70 | IL_ERR(priv, "Bad return from REPLY_ADD_STA (0x%08X)\n", | 70 | IL_ERR(il, "Bad return from REPLY_ADD_STA (0x%08X)\n", |
71 | pkt->hdr.flags); | 71 | pkt->hdr.flags); |
72 | return ret; | 72 | return ret; |
73 | } | 73 | } |
74 | 74 | ||
75 | IL_DEBUG_INFO(priv, "Processing response for adding station %u\n", | 75 | IL_DEBUG_INFO(il, "Processing response for adding station %u\n", |
76 | sta_id); | 76 | sta_id); |
77 | 77 | ||
78 | spin_lock_irqsave(&priv->sta_lock, flags); | 78 | spin_lock_irqsave(&il->sta_lock, flags); |
79 | 79 | ||
80 | switch (pkt->u.add_sta.status) { | 80 | switch (pkt->u.add_sta.status) { |
81 | case ADD_STA_SUCCESS_MSK: | 81 | case ADD_STA_SUCCESS_MSK: |
82 | IL_DEBUG_INFO(priv, "REPLY_ADD_STA PASSED\n"); | 82 | IL_DEBUG_INFO(il, "REPLY_ADD_STA PASSED\n"); |
83 | il_sta_ucode_activate(priv, sta_id); | 83 | il_sta_ucode_activate(il, sta_id); |
84 | ret = 0; | 84 | ret = 0; |
85 | break; | 85 | break; |
86 | case ADD_STA_NO_ROOM_IN_TABLE: | 86 | case ADD_STA_NO_ROOM_IN_TABLE: |
87 | IL_ERR(priv, "Adding station %d failed, no room in table.\n", | 87 | IL_ERR(il, "Adding station %d failed, no room in table.\n", |
88 | sta_id); | 88 | sta_id); |
89 | break; | 89 | break; |
90 | case ADD_STA_NO_BLOCK_ACK_RESOURCE: | 90 | case ADD_STA_NO_BLOCK_ACK_RESOURCE: |
91 | IL_ERR(priv, | 91 | IL_ERR(il, |
92 | "Adding station %d failed, no block ack resource.\n", | 92 | "Adding station %d failed, no block ack resource.\n", |
93 | sta_id); | 93 | sta_id); |
94 | break; | 94 | break; |
95 | case ADD_STA_MODIFY_NON_EXIST_STA: | 95 | case ADD_STA_MODIFY_NON_EXIST_STA: |
96 | IL_ERR(priv, "Attempting to modify non-existing station %d\n", | 96 | IL_ERR(il, "Attempting to modify non-existing station %d\n", |
97 | sta_id); | 97 | sta_id); |
98 | break; | 98 | break; |
99 | default: | 99 | default: |
100 | IL_DEBUG_ASSOC(priv, "Received REPLY_ADD_STA:(0x%08X)\n", | 100 | IL_DEBUG_ASSOC(il, "Received REPLY_ADD_STA:(0x%08X)\n", |
101 | pkt->u.add_sta.status); | 101 | pkt->u.add_sta.status); |
102 | break; | 102 | break; |
103 | } | 103 | } |
104 | 104 | ||
105 | IL_DEBUG_INFO(priv, "%s station id %u addr %pM\n", | 105 | IL_DEBUG_INFO(il, "%s station id %u addr %pM\n", |
106 | priv->stations[sta_id].sta.mode == | 106 | il->stations[sta_id].sta.mode == |
107 | STA_CONTROL_MODIFY_MSK ? "Modified" : "Added", | 107 | STA_CONTROL_MODIFY_MSK ? "Modified" : "Added", |
108 | sta_id, priv->stations[sta_id].sta.sta.addr); | 108 | sta_id, il->stations[sta_id].sta.sta.addr); |
109 | 109 | ||
110 | /* | 110 | /* |
111 | * XXX: The MAC address in the command buffer is often changed from | 111 | * 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, | |||
115 | * issue has not yet been resolved and this debugging is left to | 115 | * issue has not yet been resolved and this debugging is left to |
116 | * observe the problem. | 116 | * observe the problem. |
117 | */ | 117 | */ |
118 | IL_DEBUG_INFO(priv, "%s station according to cmd buffer %pM\n", | 118 | IL_DEBUG_INFO(il, "%s station according to cmd buffer %pM\n", |
119 | priv->stations[sta_id].sta.mode == | 119 | il->stations[sta_id].sta.mode == |
120 | STA_CONTROL_MODIFY_MSK ? "Modified" : "Added", | 120 | STA_CONTROL_MODIFY_MSK ? "Modified" : "Added", |
121 | addsta->sta.addr); | 121 | addsta->sta.addr); |
122 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 122 | spin_unlock_irqrestore(&il->sta_lock, flags); |
123 | 123 | ||
124 | return ret; | 124 | return ret; |
125 | } | 125 | } |
126 | 126 | ||
127 | static void il_add_sta_callback(struct il_priv *priv, | 127 | static void il_add_sta_callback(struct il_priv *il, |
128 | struct il_device_cmd *cmd, | 128 | struct il_device_cmd *cmd, |
129 | struct il_rx_packet *pkt) | 129 | struct il_rx_packet *pkt) |
130 | { | 130 | { |
131 | struct il_addsta_cmd *addsta = | 131 | struct il_addsta_cmd *addsta = |
132 | (struct il_addsta_cmd *)cmd->cmd.payload; | 132 | (struct il_addsta_cmd *)cmd->cmd.payload; |
133 | 133 | ||
134 | il_process_add_sta_resp(priv, addsta, pkt, false); | 134 | il_process_add_sta_resp(il, addsta, pkt, false); |
135 | 135 | ||
136 | } | 136 | } |
137 | 137 | ||
138 | int il_send_add_sta(struct il_priv *priv, | 138 | int il_send_add_sta(struct il_priv *il, |
139 | struct il_addsta_cmd *sta, u8 flags) | 139 | struct il_addsta_cmd *sta, u8 flags) |
140 | { | 140 | { |
141 | struct il_rx_packet *pkt = NULL; | 141 | struct il_rx_packet *pkt = NULL; |
@@ -148,7 +148,7 @@ int il_send_add_sta(struct il_priv *priv, | |||
148 | }; | 148 | }; |
149 | u8 sta_id __maybe_unused = sta->sta.sta_id; | 149 | u8 sta_id __maybe_unused = sta->sta.sta_id; |
150 | 150 | ||
151 | IL_DEBUG_INFO(priv, "Adding sta %u (%pM) %ssynchronously\n", | 151 | IL_DEBUG_INFO(il, "Adding sta %u (%pM) %ssynchronously\n", |
152 | sta_id, sta->sta.addr, flags & CMD_ASYNC ? "a" : ""); | 152 | sta_id, sta->sta.addr, flags & CMD_ASYNC ? "a" : ""); |
153 | 153 | ||
154 | if (flags & CMD_ASYNC) | 154 | if (flags & CMD_ASYNC) |
@@ -158,23 +158,23 @@ int il_send_add_sta(struct il_priv *priv, | |||
158 | might_sleep(); | 158 | might_sleep(); |
159 | } | 159 | } |
160 | 160 | ||
161 | cmd.len = priv->cfg->ops->utils->build_addsta_hcmd(sta, data); | 161 | cmd.len = il->cfg->ops->utils->build_addsta_hcmd(sta, data); |
162 | ret = il_send_cmd(priv, &cmd); | 162 | ret = il_send_cmd(il, &cmd); |
163 | 163 | ||
164 | if (ret || (flags & CMD_ASYNC)) | 164 | if (ret || (flags & CMD_ASYNC)) |
165 | return ret; | 165 | return ret; |
166 | 166 | ||
167 | if (ret == 0) { | 167 | if (ret == 0) { |
168 | pkt = (struct il_rx_packet *)cmd.reply_page; | 168 | pkt = (struct il_rx_packet *)cmd.reply_page; |
169 | ret = il_process_add_sta_resp(priv, sta, pkt, true); | 169 | ret = il_process_add_sta_resp(il, sta, pkt, true); |
170 | } | 170 | } |
171 | il_free_pages(priv, cmd.reply_page); | 171 | il_free_pages(il, cmd.reply_page); |
172 | 172 | ||
173 | return ret; | 173 | return ret; |
174 | } | 174 | } |
175 | EXPORT_SYMBOL(il_send_add_sta); | 175 | EXPORT_SYMBOL(il_send_add_sta); |
176 | 176 | ||
177 | static void il_set_ht_add_station(struct il_priv *priv, u8 index, | 177 | static void il_set_ht_add_station(struct il_priv *il, u8 index, |
178 | struct ieee80211_sta *sta, | 178 | struct ieee80211_sta *sta, |
179 | struct il_rxon_context *ctx) | 179 | struct il_rxon_context *ctx) |
180 | { | 180 | { |
@@ -186,13 +186,13 @@ static void il_set_ht_add_station(struct il_priv *priv, u8 index, | |||
186 | goto done; | 186 | goto done; |
187 | 187 | ||
188 | mimo_ps_mode = (sta_ht_inf->cap & IEEE80211_HT_CAP_SM_PS) >> 2; | 188 | mimo_ps_mode = (sta_ht_inf->cap & IEEE80211_HT_CAP_SM_PS) >> 2; |
189 | IL_DEBUG_ASSOC(priv, "spatial multiplexing power save mode: %s\n", | 189 | IL_DEBUG_ASSOC(il, "spatial multiplexing power save mode: %s\n", |
190 | (mimo_ps_mode == WLAN_HT_CAP_SM_PS_STATIC) ? | 190 | (mimo_ps_mode == WLAN_HT_CAP_SM_PS_STATIC) ? |
191 | "static" : | 191 | "static" : |
192 | (mimo_ps_mode == WLAN_HT_CAP_SM_PS_DYNAMIC) ? | 192 | (mimo_ps_mode == WLAN_HT_CAP_SM_PS_DYNAMIC) ? |
193 | "dynamic" : "disabled"); | 193 | "dynamic" : "disabled"); |
194 | 194 | ||
195 | sta_flags = priv->stations[index].sta.station_flags; | 195 | sta_flags = il->stations[index].sta.station_flags; |
196 | 196 | ||
197 | sta_flags &= ~(STA_FLG_RTS_MIMO_PROT_MSK | STA_FLG_MIMO_DIS_MSK); | 197 | sta_flags &= ~(STA_FLG_RTS_MIMO_PROT_MSK | STA_FLG_MIMO_DIS_MSK); |
198 | 198 | ||
@@ -206,7 +206,7 @@ static void il_set_ht_add_station(struct il_priv *priv, u8 index, | |||
206 | case WLAN_HT_CAP_SM_PS_DISABLED: | 206 | case WLAN_HT_CAP_SM_PS_DISABLED: |
207 | break; | 207 | break; |
208 | default: | 208 | default: |
209 | IL_WARN(priv, "Invalid MIMO PS mode %d\n", mimo_ps_mode); | 209 | IL_WARN(il, "Invalid MIMO PS mode %d\n", mimo_ps_mode); |
210 | break; | 210 | break; |
211 | } | 211 | } |
212 | 212 | ||
@@ -216,12 +216,12 @@ static void il_set_ht_add_station(struct il_priv *priv, u8 index, | |||
216 | sta_flags |= cpu_to_le32( | 216 | sta_flags |= cpu_to_le32( |
217 | (u32)sta_ht_inf->ampdu_density << STA_FLG_AGG_MPDU_DENSITY_POS); | 217 | (u32)sta_ht_inf->ampdu_density << STA_FLG_AGG_MPDU_DENSITY_POS); |
218 | 218 | ||
219 | if (il_is_ht40_tx_allowed(priv, ctx, &sta->ht_cap)) | 219 | if (il_is_ht40_tx_allowed(il, ctx, &sta->ht_cap)) |
220 | sta_flags |= STA_FLG_HT40_EN_MSK; | 220 | sta_flags |= STA_FLG_HT40_EN_MSK; |
221 | else | 221 | else |
222 | sta_flags &= ~STA_FLG_HT40_EN_MSK; | 222 | sta_flags &= ~STA_FLG_HT40_EN_MSK; |
223 | 223 | ||
224 | priv->stations[index].sta.station_flags = sta_flags; | 224 | il->stations[index].sta.station_flags = sta_flags; |
225 | done: | 225 | done: |
226 | return; | 226 | return; |
227 | } | 227 | } |
@@ -231,7 +231,7 @@ static void il_set_ht_add_station(struct il_priv *priv, u8 index, | |||
231 | * | 231 | * |
232 | * should be called with sta_lock held | 232 | * should be called with sta_lock held |
233 | */ | 233 | */ |
234 | u8 il_prep_station(struct il_priv *priv, struct il_rxon_context *ctx, | 234 | u8 il_prep_station(struct il_priv *il, struct il_rxon_context *ctx, |
235 | const u8 *addr, bool is_ap, struct ieee80211_sta *sta) | 235 | const u8 *addr, bool is_ap, struct ieee80211_sta *sta) |
236 | { | 236 | { |
237 | struct il_station_entry *station; | 237 | struct il_station_entry *station; |
@@ -244,14 +244,14 @@ u8 il_prep_station(struct il_priv *priv, struct il_rxon_context *ctx, | |||
244 | else if (is_broadcast_ether_addr(addr)) | 244 | else if (is_broadcast_ether_addr(addr)) |
245 | sta_id = ctx->bcast_sta_id; | 245 | sta_id = ctx->bcast_sta_id; |
246 | else | 246 | else |
247 | for (i = IL_STA_ID; i < priv->hw_params.max_stations; i++) { | 247 | for (i = IL_STA_ID; i < il->hw_params.max_stations; i++) { |
248 | if (!compare_ether_addr(priv->stations[i].sta.sta.addr, | 248 | if (!compare_ether_addr(il->stations[i].sta.sta.addr, |
249 | addr)) { | 249 | addr)) { |
250 | sta_id = i; | 250 | sta_id = i; |
251 | break; | 251 | break; |
252 | } | 252 | } |
253 | 253 | ||
254 | if (!priv->stations[i].used && | 254 | if (!il->stations[i].used && |
255 | sta_id == IL_INVALID_STATION) | 255 | sta_id == IL_INVALID_STATION) |
256 | sta_id = i; | 256 | sta_id = i; |
257 | } | 257 | } |
@@ -268,27 +268,27 @@ u8 il_prep_station(struct il_priv *priv, struct il_rxon_context *ctx, | |||
268 | * station. Keep track if one is in progress so that we do not send | 268 | * station. Keep track if one is in progress so that we do not send |
269 | * another. | 269 | * another. |
270 | */ | 270 | */ |
271 | if (priv->stations[sta_id].used & IL_STA_UCODE_INPROGRESS) { | 271 | if (il->stations[sta_id].used & IL_STA_UCODE_INPROGRESS) { |
272 | IL_DEBUG_INFO(priv, | 272 | IL_DEBUG_INFO(il, |
273 | "STA %d already in process of being added.\n", | 273 | "STA %d already in process of being added.\n", |
274 | sta_id); | 274 | sta_id); |
275 | return sta_id; | 275 | return sta_id; |
276 | } | 276 | } |
277 | 277 | ||
278 | if ((priv->stations[sta_id].used & IL_STA_DRIVER_ACTIVE) && | 278 | if ((il->stations[sta_id].used & IL_STA_DRIVER_ACTIVE) && |
279 | (priv->stations[sta_id].used & IL_STA_UCODE_ACTIVE) && | 279 | (il->stations[sta_id].used & IL_STA_UCODE_ACTIVE) && |
280 | !compare_ether_addr(priv->stations[sta_id].sta.sta.addr, addr)) { | 280 | !compare_ether_addr(il->stations[sta_id].sta.sta.addr, addr)) { |
281 | IL_DEBUG_ASSOC(priv, | 281 | IL_DEBUG_ASSOC(il, |
282 | "STA %d (%pM) already added, not adding again.\n", | 282 | "STA %d (%pM) already added, not adding again.\n", |
283 | sta_id, addr); | 283 | sta_id, addr); |
284 | return sta_id; | 284 | return sta_id; |
285 | } | 285 | } |
286 | 286 | ||
287 | station = &priv->stations[sta_id]; | 287 | station = &il->stations[sta_id]; |
288 | station->used = IL_STA_DRIVER_ACTIVE; | 288 | station->used = IL_STA_DRIVER_ACTIVE; |
289 | IL_DEBUG_ASSOC(priv, "Add STA to driver ID %d: %pM\n", | 289 | IL_DEBUG_ASSOC(il, "Add STA to driver ID %d: %pM\n", |
290 | sta_id, addr); | 290 | sta_id, addr); |
291 | priv->num_stations++; | 291 | il->num_stations++; |
292 | 292 | ||
293 | /* Set up the REPLY_ADD_STA command to send to device */ | 293 | /* Set up the REPLY_ADD_STA command to send to device */ |
294 | memset(&station->sta, 0, sizeof(struct il_addsta_cmd)); | 294 | 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, | |||
310 | * STA and broadcast STA) pass in a NULL sta, and mac80211 | 310 | * STA and broadcast STA) pass in a NULL sta, and mac80211 |
311 | * doesn't allow HT IBSS. | 311 | * doesn't allow HT IBSS. |
312 | */ | 312 | */ |
313 | il_set_ht_add_station(priv, sta_id, sta, ctx); | 313 | il_set_ht_add_station(il, sta_id, sta, ctx); |
314 | 314 | ||
315 | /* 3945 only */ | 315 | /* 3945 only */ |
316 | rate = (priv->band == IEEE80211_BAND_5GHZ) ? | 316 | rate = (il->band == IEEE80211_BAND_5GHZ) ? |
317 | IL_RATE_6M_PLCP : IL_RATE_1M_PLCP; | 317 | IL_RATE_6M_PLCP : IL_RATE_1M_PLCP; |
318 | /* Turn on both antennas for the station... */ | 318 | /* Turn on both antennas for the station... */ |
319 | station->sta.rate_n_flags = cpu_to_le16(rate | RATE_MCS_ANT_AB_MSK); | 319 | station->sta.rate_n_flags = cpu_to_le16(rate | RATE_MCS_ANT_AB_MSK); |
@@ -329,7 +329,7 @@ EXPORT_SYMBOL_GPL(il_prep_station); | |||
329 | * il_add_station_common - | 329 | * il_add_station_common - |
330 | */ | 330 | */ |
331 | int | 331 | int |
332 | il_add_station_common(struct il_priv *priv, | 332 | il_add_station_common(struct il_priv *il, |
333 | struct il_rxon_context *ctx, | 333 | struct il_rxon_context *ctx, |
334 | const u8 *addr, bool is_ap, | 334 | const u8 *addr, bool is_ap, |
335 | struct ieee80211_sta *sta, u8 *sta_id_r) | 335 | struct ieee80211_sta *sta, u8 *sta_id_r) |
@@ -340,12 +340,12 @@ il_add_station_common(struct il_priv *priv, | |||
340 | struct il_addsta_cmd sta_cmd; | 340 | struct il_addsta_cmd sta_cmd; |
341 | 341 | ||
342 | *sta_id_r = 0; | 342 | *sta_id_r = 0; |
343 | spin_lock_irqsave(&priv->sta_lock, flags_spin); | 343 | spin_lock_irqsave(&il->sta_lock, flags_spin); |
344 | sta_id = il_prep_station(priv, ctx, addr, is_ap, sta); | 344 | sta_id = il_prep_station(il, ctx, addr, is_ap, sta); |
345 | if (sta_id == IL_INVALID_STATION) { | 345 | if (sta_id == IL_INVALID_STATION) { |
346 | IL_ERR(priv, "Unable to prepare station %pM for addition\n", | 346 | IL_ERR(il, "Unable to prepare station %pM for addition\n", |
347 | addr); | 347 | addr); |
348 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); | 348 | spin_unlock_irqrestore(&il->sta_lock, flags_spin); |
349 | return -EINVAL; | 349 | return -EINVAL; |
350 | } | 350 | } |
351 | 351 | ||
@@ -354,37 +354,37 @@ il_add_station_common(struct il_priv *priv, | |||
354 | * station. Keep track if one is in progress so that we do not send | 354 | * station. Keep track if one is in progress so that we do not send |
355 | * another. | 355 | * another. |
356 | */ | 356 | */ |
357 | if (priv->stations[sta_id].used & IL_STA_UCODE_INPROGRESS) { | 357 | if (il->stations[sta_id].used & IL_STA_UCODE_INPROGRESS) { |
358 | IL_DEBUG_INFO(priv, | 358 | IL_DEBUG_INFO(il, |
359 | "STA %d already in process of being added.\n", | 359 | "STA %d already in process of being added.\n", |
360 | sta_id); | 360 | sta_id); |
361 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); | 361 | spin_unlock_irqrestore(&il->sta_lock, flags_spin); |
362 | return -EEXIST; | 362 | return -EEXIST; |
363 | } | 363 | } |
364 | 364 | ||
365 | if ((priv->stations[sta_id].used & IL_STA_DRIVER_ACTIVE) && | 365 | if ((il->stations[sta_id].used & IL_STA_DRIVER_ACTIVE) && |
366 | (priv->stations[sta_id].used & IL_STA_UCODE_ACTIVE)) { | 366 | (il->stations[sta_id].used & IL_STA_UCODE_ACTIVE)) { |
367 | IL_DEBUG_ASSOC(priv, | 367 | IL_DEBUG_ASSOC(il, |
368 | "STA %d (%pM) already added, not adding again.\n", | 368 | "STA %d (%pM) already added, not adding again.\n", |
369 | sta_id, addr); | 369 | sta_id, addr); |
370 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); | 370 | spin_unlock_irqrestore(&il->sta_lock, flags_spin); |
371 | return -EEXIST; | 371 | return -EEXIST; |
372 | } | 372 | } |
373 | 373 | ||
374 | priv->stations[sta_id].used |= IL_STA_UCODE_INPROGRESS; | 374 | il->stations[sta_id].used |= IL_STA_UCODE_INPROGRESS; |
375 | memcpy(&sta_cmd, &priv->stations[sta_id].sta, | 375 | memcpy(&sta_cmd, &il->stations[sta_id].sta, |
376 | sizeof(struct il_addsta_cmd)); | 376 | sizeof(struct il_addsta_cmd)); |
377 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); | 377 | spin_unlock_irqrestore(&il->sta_lock, flags_spin); |
378 | 378 | ||
379 | /* Add station to device's station table */ | 379 | /* Add station to device's station table */ |
380 | ret = il_send_add_sta(priv, &sta_cmd, CMD_SYNC); | 380 | ret = il_send_add_sta(il, &sta_cmd, CMD_SYNC); |
381 | if (ret) { | 381 | if (ret) { |
382 | spin_lock_irqsave(&priv->sta_lock, flags_spin); | 382 | spin_lock_irqsave(&il->sta_lock, flags_spin); |
383 | IL_ERR(priv, "Adding station %pM failed.\n", | 383 | IL_ERR(il, "Adding station %pM failed.\n", |
384 | priv->stations[sta_id].sta.sta.addr); | 384 | il->stations[sta_id].sta.sta.addr); |
385 | priv->stations[sta_id].used &= ~IL_STA_DRIVER_ACTIVE; | 385 | il->stations[sta_id].used &= ~IL_STA_DRIVER_ACTIVE; |
386 | priv->stations[sta_id].used &= ~IL_STA_UCODE_INPROGRESS; | 386 | il->stations[sta_id].used &= ~IL_STA_UCODE_INPROGRESS; |
387 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); | 387 | spin_unlock_irqrestore(&il->sta_lock, flags_spin); |
388 | } | 388 | } |
389 | *sta_id_r = sta_id; | 389 | *sta_id_r = sta_id; |
390 | return ret; | 390 | return ret; |
@@ -394,23 +394,23 @@ EXPORT_SYMBOL(il_add_station_common); | |||
394 | /** | 394 | /** |
395 | * il_sta_ucode_deactivate - deactivate ucode status for a station | 395 | * il_sta_ucode_deactivate - deactivate ucode status for a station |
396 | * | 396 | * |
397 | * priv->sta_lock must be held | 397 | * il->sta_lock must be held |
398 | */ | 398 | */ |
399 | static void il_sta_ucode_deactivate(struct il_priv *priv, u8 sta_id) | 399 | static void il_sta_ucode_deactivate(struct il_priv *il, u8 sta_id) |
400 | { | 400 | { |
401 | /* Ucode must be active and driver must be non active */ | 401 | /* Ucode must be active and driver must be non active */ |
402 | if ((priv->stations[sta_id].used & | 402 | if ((il->stations[sta_id].used & |
403 | (IL_STA_UCODE_ACTIVE | IL_STA_DRIVER_ACTIVE)) != | 403 | (IL_STA_UCODE_ACTIVE | IL_STA_DRIVER_ACTIVE)) != |
404 | IL_STA_UCODE_ACTIVE) | 404 | IL_STA_UCODE_ACTIVE) |
405 | IL_ERR(priv, "removed non active STA %u\n", sta_id); | 405 | IL_ERR(il, "removed non active STA %u\n", sta_id); |
406 | 406 | ||
407 | priv->stations[sta_id].used &= ~IL_STA_UCODE_ACTIVE; | 407 | il->stations[sta_id].used &= ~IL_STA_UCODE_ACTIVE; |
408 | 408 | ||
409 | memset(&priv->stations[sta_id], 0, sizeof(struct il_station_entry)); | 409 | memset(&il->stations[sta_id], 0, sizeof(struct il_station_entry)); |
410 | IL_DEBUG_ASSOC(priv, "Removed STA %u\n", sta_id); | 410 | IL_DEBUG_ASSOC(il, "Removed STA %u\n", sta_id); |
411 | } | 411 | } |
412 | 412 | ||
413 | static int il_send_remove_station(struct il_priv *priv, | 413 | static int il_send_remove_station(struct il_priv *il, |
414 | const u8 *addr, int sta_id, | 414 | const u8 *addr, int sta_id, |
415 | bool temporary) | 415 | bool temporary) |
416 | { | 416 | { |
@@ -433,14 +433,14 @@ static int il_send_remove_station(struct il_priv *priv, | |||
433 | 433 | ||
434 | cmd.flags |= CMD_WANT_SKB; | 434 | cmd.flags |= CMD_WANT_SKB; |
435 | 435 | ||
436 | ret = il_send_cmd(priv, &cmd); | 436 | ret = il_send_cmd(il, &cmd); |
437 | 437 | ||
438 | if (ret) | 438 | if (ret) |
439 | return ret; | 439 | return ret; |
440 | 440 | ||
441 | pkt = (struct il_rx_packet *)cmd.reply_page; | 441 | pkt = (struct il_rx_packet *)cmd.reply_page; |
442 | if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { | 442 | if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { |
443 | IL_ERR(priv, "Bad return from REPLY_REMOVE_STA (0x%08X)\n", | 443 | IL_ERR(il, "Bad return from REPLY_REMOVE_STA (0x%08X)\n", |
444 | pkt->hdr.flags); | 444 | pkt->hdr.flags); |
445 | ret = -EIO; | 445 | ret = -EIO; |
446 | } | 446 | } |
@@ -449,20 +449,20 @@ static int il_send_remove_station(struct il_priv *priv, | |||
449 | switch (pkt->u.rem_sta.status) { | 449 | switch (pkt->u.rem_sta.status) { |
450 | case REM_STA_SUCCESS_MSK: | 450 | case REM_STA_SUCCESS_MSK: |
451 | if (!temporary) { | 451 | if (!temporary) { |
452 | spin_lock_irqsave(&priv->sta_lock, flags_spin); | 452 | spin_lock_irqsave(&il->sta_lock, flags_spin); |
453 | il_sta_ucode_deactivate(priv, sta_id); | 453 | il_sta_ucode_deactivate(il, sta_id); |
454 | spin_unlock_irqrestore(&priv->sta_lock, | 454 | spin_unlock_irqrestore(&il->sta_lock, |
455 | flags_spin); | 455 | flags_spin); |
456 | } | 456 | } |
457 | IL_DEBUG_ASSOC(priv, "REPLY_REMOVE_STA PASSED\n"); | 457 | IL_DEBUG_ASSOC(il, "REPLY_REMOVE_STA PASSED\n"); |
458 | break; | 458 | break; |
459 | default: | 459 | default: |
460 | ret = -EIO; | 460 | ret = -EIO; |
461 | IL_ERR(priv, "REPLY_REMOVE_STA failed\n"); | 461 | IL_ERR(il, "REPLY_REMOVE_STA failed\n"); |
462 | break; | 462 | break; |
463 | } | 463 | } |
464 | } | 464 | } |
465 | il_free_pages(priv, cmd.reply_page); | 465 | il_free_pages(il, cmd.reply_page); |
466 | 466 | ||
467 | return ret; | 467 | return ret; |
468 | } | 468 | } |
@@ -470,13 +470,13 @@ static int il_send_remove_station(struct il_priv *priv, | |||
470 | /** | 470 | /** |
471 | * il_remove_station - Remove driver's knowledge of station. | 471 | * il_remove_station - Remove driver's knowledge of station. |
472 | */ | 472 | */ |
473 | int il_remove_station(struct il_priv *priv, const u8 sta_id, | 473 | int il_remove_station(struct il_priv *il, const u8 sta_id, |
474 | const u8 *addr) | 474 | const u8 *addr) |
475 | { | 475 | { |
476 | unsigned long flags; | 476 | unsigned long flags; |
477 | 477 | ||
478 | if (!il_is_ready(priv)) { | 478 | if (!il_is_ready(il)) { |
479 | IL_DEBUG_INFO(priv, | 479 | IL_DEBUG_INFO(il, |
480 | "Unable to remove station %pM, device not ready.\n", | 480 | "Unable to remove station %pM, device not ready.\n", |
481 | addr); | 481 | addr); |
482 | /* | 482 | /* |
@@ -487,42 +487,42 @@ int il_remove_station(struct il_priv *priv, const u8 sta_id, | |||
487 | return 0; | 487 | return 0; |
488 | } | 488 | } |
489 | 489 | ||
490 | IL_DEBUG_ASSOC(priv, "Removing STA from driver:%d %pM\n", | 490 | IL_DEBUG_ASSOC(il, "Removing STA from driver:%d %pM\n", |
491 | sta_id, addr); | 491 | sta_id, addr); |
492 | 492 | ||
493 | if (WARN_ON(sta_id == IL_INVALID_STATION)) | 493 | if (WARN_ON(sta_id == IL_INVALID_STATION)) |
494 | return -EINVAL; | 494 | return -EINVAL; |
495 | 495 | ||
496 | spin_lock_irqsave(&priv->sta_lock, flags); | 496 | spin_lock_irqsave(&il->sta_lock, flags); |
497 | 497 | ||
498 | if (!(priv->stations[sta_id].used & IL_STA_DRIVER_ACTIVE)) { | 498 | if (!(il->stations[sta_id].used & IL_STA_DRIVER_ACTIVE)) { |
499 | IL_DEBUG_INFO(priv, "Removing %pM but non DRIVER active\n", | 499 | IL_DEBUG_INFO(il, "Removing %pM but non DRIVER active\n", |
500 | addr); | 500 | addr); |
501 | goto out_err; | 501 | goto out_err; |
502 | } | 502 | } |
503 | 503 | ||
504 | if (!(priv->stations[sta_id].used & IL_STA_UCODE_ACTIVE)) { | 504 | if (!(il->stations[sta_id].used & IL_STA_UCODE_ACTIVE)) { |
505 | IL_DEBUG_INFO(priv, "Removing %pM but non UCODE active\n", | 505 | IL_DEBUG_INFO(il, "Removing %pM but non UCODE active\n", |
506 | addr); | 506 | addr); |
507 | goto out_err; | 507 | goto out_err; |
508 | } | 508 | } |
509 | 509 | ||
510 | if (priv->stations[sta_id].used & IL_STA_LOCAL) { | 510 | if (il->stations[sta_id].used & IL_STA_LOCAL) { |
511 | kfree(priv->stations[sta_id].lq); | 511 | kfree(il->stations[sta_id].lq); |
512 | priv->stations[sta_id].lq = NULL; | 512 | il->stations[sta_id].lq = NULL; |
513 | } | 513 | } |
514 | 514 | ||
515 | priv->stations[sta_id].used &= ~IL_STA_DRIVER_ACTIVE; | 515 | il->stations[sta_id].used &= ~IL_STA_DRIVER_ACTIVE; |
516 | 516 | ||
517 | priv->num_stations--; | 517 | il->num_stations--; |
518 | 518 | ||
519 | BUG_ON(priv->num_stations < 0); | 519 | BUG_ON(il->num_stations < 0); |
520 | 520 | ||
521 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 521 | spin_unlock_irqrestore(&il->sta_lock, flags); |
522 | 522 | ||
523 | return il_send_remove_station(priv, addr, sta_id, false); | 523 | return il_send_remove_station(il, addr, sta_id, false); |
524 | out_err: | 524 | out_err: |
525 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 525 | spin_unlock_irqrestore(&il->sta_lock, flags); |
526 | return -EINVAL; | 526 | return -EINVAL; |
527 | } | 527 | } |
528 | EXPORT_SYMBOL_GPL(il_remove_station); | 528 | EXPORT_SYMBOL_GPL(il_remove_station); |
@@ -535,31 +535,31 @@ EXPORT_SYMBOL_GPL(il_remove_station); | |||
535 | * other than explicit station management would cause this in | 535 | * other than explicit station management would cause this in |
536 | * the ucode, e.g. unassociated RXON. | 536 | * the ucode, e.g. unassociated RXON. |
537 | */ | 537 | */ |
538 | void il_clear_ucode_stations(struct il_priv *priv, | 538 | void il_clear_ucode_stations(struct il_priv *il, |
539 | struct il_rxon_context *ctx) | 539 | struct il_rxon_context *ctx) |
540 | { | 540 | { |
541 | int i; | 541 | int i; |
542 | unsigned long flags_spin; | 542 | unsigned long flags_spin; |
543 | bool cleared = false; | 543 | bool cleared = false; |
544 | 544 | ||
545 | IL_DEBUG_INFO(priv, "Clearing ucode stations in driver\n"); | 545 | IL_DEBUG_INFO(il, "Clearing ucode stations in driver\n"); |
546 | 546 | ||
547 | spin_lock_irqsave(&priv->sta_lock, flags_spin); | 547 | spin_lock_irqsave(&il->sta_lock, flags_spin); |
548 | for (i = 0; i < priv->hw_params.max_stations; i++) { | 548 | for (i = 0; i < il->hw_params.max_stations; i++) { |
549 | if (ctx && ctx->ctxid != priv->stations[i].ctxid) | 549 | if (ctx && ctx->ctxid != il->stations[i].ctxid) |
550 | continue; | 550 | continue; |
551 | 551 | ||
552 | if (priv->stations[i].used & IL_STA_UCODE_ACTIVE) { | 552 | if (il->stations[i].used & IL_STA_UCODE_ACTIVE) { |
553 | IL_DEBUG_INFO(priv, | 553 | IL_DEBUG_INFO(il, |
554 | "Clearing ucode active for station %d\n", i); | 554 | "Clearing ucode active for station %d\n", i); |
555 | priv->stations[i].used &= ~IL_STA_UCODE_ACTIVE; | 555 | il->stations[i].used &= ~IL_STA_UCODE_ACTIVE; |
556 | cleared = true; | 556 | cleared = true; |
557 | } | 557 | } |
558 | } | 558 | } |
559 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); | 559 | spin_unlock_irqrestore(&il->sta_lock, flags_spin); |
560 | 560 | ||
561 | if (!cleared) | 561 | if (!cleared) |
562 | IL_DEBUG_INFO(priv, | 562 | IL_DEBUG_INFO(il, |
563 | "No active stations found to be cleared\n"); | 563 | "No active stations found to be cleared\n"); |
564 | } | 564 | } |
565 | EXPORT_SYMBOL(il_clear_ucode_stations); | 565 | EXPORT_SYMBOL(il_clear_ucode_stations); |
@@ -573,7 +573,7 @@ EXPORT_SYMBOL(il_clear_ucode_stations); | |||
573 | * Function sleeps. | 573 | * Function sleeps. |
574 | */ | 574 | */ |
575 | void | 575 | void |
576 | il_restore_stations(struct il_priv *priv, struct il_rxon_context *ctx) | 576 | il_restore_stations(struct il_priv *il, struct il_rxon_context *ctx) |
577 | { | 577 | { |
578 | struct il_addsta_cmd sta_cmd; | 578 | struct il_addsta_cmd sta_cmd; |
579 | struct il_link_quality_cmd lq; | 579 | struct il_link_quality_cmd lq; |
@@ -583,48 +583,48 @@ il_restore_stations(struct il_priv *priv, struct il_rxon_context *ctx) | |||
583 | int ret; | 583 | int ret; |
584 | bool send_lq; | 584 | bool send_lq; |
585 | 585 | ||
586 | if (!il_is_ready(priv)) { | 586 | if (!il_is_ready(il)) { |
587 | IL_DEBUG_INFO(priv, | 587 | IL_DEBUG_INFO(il, |
588 | "Not ready yet, not restoring any stations.\n"); | 588 | "Not ready yet, not restoring any stations.\n"); |
589 | return; | 589 | return; |
590 | } | 590 | } |
591 | 591 | ||
592 | IL_DEBUG_ASSOC(priv, "Restoring all known stations ... start.\n"); | 592 | IL_DEBUG_ASSOC(il, "Restoring all known stations ... start.\n"); |
593 | spin_lock_irqsave(&priv->sta_lock, flags_spin); | 593 | spin_lock_irqsave(&il->sta_lock, flags_spin); |
594 | for (i = 0; i < priv->hw_params.max_stations; i++) { | 594 | for (i = 0; i < il->hw_params.max_stations; i++) { |
595 | if (ctx->ctxid != priv->stations[i].ctxid) | 595 | if (ctx->ctxid != il->stations[i].ctxid) |
596 | continue; | 596 | continue; |
597 | if ((priv->stations[i].used & IL_STA_DRIVER_ACTIVE) && | 597 | if ((il->stations[i].used & IL_STA_DRIVER_ACTIVE) && |
598 | !(priv->stations[i].used & IL_STA_UCODE_ACTIVE)) { | 598 | !(il->stations[i].used & IL_STA_UCODE_ACTIVE)) { |
599 | IL_DEBUG_ASSOC(priv, "Restoring sta %pM\n", | 599 | IL_DEBUG_ASSOC(il, "Restoring sta %pM\n", |
600 | priv->stations[i].sta.sta.addr); | 600 | il->stations[i].sta.sta.addr); |
601 | priv->stations[i].sta.mode = 0; | 601 | il->stations[i].sta.mode = 0; |
602 | priv->stations[i].used |= IL_STA_UCODE_INPROGRESS; | 602 | il->stations[i].used |= IL_STA_UCODE_INPROGRESS; |
603 | found = true; | 603 | found = true; |
604 | } | 604 | } |
605 | } | 605 | } |
606 | 606 | ||
607 | for (i = 0; i < priv->hw_params.max_stations; i++) { | 607 | for (i = 0; i < il->hw_params.max_stations; i++) { |
608 | if ((priv->stations[i].used & IL_STA_UCODE_INPROGRESS)) { | 608 | if ((il->stations[i].used & IL_STA_UCODE_INPROGRESS)) { |
609 | memcpy(&sta_cmd, &priv->stations[i].sta, | 609 | memcpy(&sta_cmd, &il->stations[i].sta, |
610 | sizeof(struct il_addsta_cmd)); | 610 | sizeof(struct il_addsta_cmd)); |
611 | send_lq = false; | 611 | send_lq = false; |
612 | if (priv->stations[i].lq) { | 612 | if (il->stations[i].lq) { |
613 | memcpy(&lq, priv->stations[i].lq, | 613 | memcpy(&lq, il->stations[i].lq, |
614 | sizeof(struct il_link_quality_cmd)); | 614 | sizeof(struct il_link_quality_cmd)); |
615 | send_lq = true; | 615 | send_lq = true; |
616 | } | 616 | } |
617 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); | 617 | spin_unlock_irqrestore(&il->sta_lock, flags_spin); |
618 | ret = il_send_add_sta(priv, &sta_cmd, CMD_SYNC); | 618 | ret = il_send_add_sta(il, &sta_cmd, CMD_SYNC); |
619 | if (ret) { | 619 | if (ret) { |
620 | spin_lock_irqsave(&priv->sta_lock, flags_spin); | 620 | spin_lock_irqsave(&il->sta_lock, flags_spin); |
621 | IL_ERR(priv, "Adding station %pM failed.\n", | 621 | IL_ERR(il, "Adding station %pM failed.\n", |
622 | priv->stations[i].sta.sta.addr); | 622 | il->stations[i].sta.sta.addr); |
623 | priv->stations[i].used &= | 623 | il->stations[i].used &= |
624 | ~IL_STA_DRIVER_ACTIVE; | 624 | ~IL_STA_DRIVER_ACTIVE; |
625 | priv->stations[i].used &= | 625 | il->stations[i].used &= |
626 | ~IL_STA_UCODE_INPROGRESS; | 626 | ~IL_STA_UCODE_INPROGRESS; |
627 | spin_unlock_irqrestore(&priv->sta_lock, | 627 | spin_unlock_irqrestore(&il->sta_lock, |
628 | flags_spin); | 628 | flags_spin); |
629 | } | 629 | } |
630 | /* | 630 | /* |
@@ -632,71 +632,71 @@ il_restore_stations(struct il_priv *priv, struct il_rxon_context *ctx) | |||
632 | * current LQ command | 632 | * current LQ command |
633 | */ | 633 | */ |
634 | if (send_lq) | 634 | if (send_lq) |
635 | il_send_lq_cmd(priv, ctx, &lq, | 635 | il_send_lq_cmd(il, ctx, &lq, |
636 | CMD_SYNC, true); | 636 | CMD_SYNC, true); |
637 | spin_lock_irqsave(&priv->sta_lock, flags_spin); | 637 | spin_lock_irqsave(&il->sta_lock, flags_spin); |
638 | priv->stations[i].used &= ~IL_STA_UCODE_INPROGRESS; | 638 | il->stations[i].used &= ~IL_STA_UCODE_INPROGRESS; |
639 | } | 639 | } |
640 | } | 640 | } |
641 | 641 | ||
642 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); | 642 | spin_unlock_irqrestore(&il->sta_lock, flags_spin); |
643 | if (!found) | 643 | if (!found) |
644 | IL_DEBUG_INFO(priv, "Restoring all known stations" | 644 | IL_DEBUG_INFO(il, "Restoring all known stations" |
645 | " .... no stations to be restored.\n"); | 645 | " .... no stations to be restored.\n"); |
646 | else | 646 | else |
647 | IL_DEBUG_INFO(priv, "Restoring all known stations" | 647 | IL_DEBUG_INFO(il, "Restoring all known stations" |
648 | " .... complete.\n"); | 648 | " .... complete.\n"); |
649 | } | 649 | } |
650 | EXPORT_SYMBOL(il_restore_stations); | 650 | EXPORT_SYMBOL(il_restore_stations); |
651 | 651 | ||
652 | int il_get_free_ucode_key_index(struct il_priv *priv) | 652 | int il_get_free_ucode_key_index(struct il_priv *il) |
653 | { | 653 | { |
654 | int i; | 654 | int i; |
655 | 655 | ||
656 | for (i = 0; i < priv->sta_key_max_num; i++) | 656 | for (i = 0; i < il->sta_key_max_num; i++) |
657 | if (!test_and_set_bit(i, &priv->ucode_key_table)) | 657 | if (!test_and_set_bit(i, &il->ucode_key_table)) |
658 | return i; | 658 | return i; |
659 | 659 | ||
660 | return WEP_INVALID_OFFSET; | 660 | return WEP_INVALID_OFFSET; |
661 | } | 661 | } |
662 | EXPORT_SYMBOL(il_get_free_ucode_key_index); | 662 | EXPORT_SYMBOL(il_get_free_ucode_key_index); |
663 | 663 | ||
664 | void il_dealloc_bcast_stations(struct il_priv *priv) | 664 | void il_dealloc_bcast_stations(struct il_priv *il) |
665 | { | 665 | { |
666 | unsigned long flags; | 666 | unsigned long flags; |
667 | int i; | 667 | int i; |
668 | 668 | ||
669 | spin_lock_irqsave(&priv->sta_lock, flags); | 669 | spin_lock_irqsave(&il->sta_lock, flags); |
670 | for (i = 0; i < priv->hw_params.max_stations; i++) { | 670 | for (i = 0; i < il->hw_params.max_stations; i++) { |
671 | if (!(priv->stations[i].used & IL_STA_BCAST)) | 671 | if (!(il->stations[i].used & IL_STA_BCAST)) |
672 | continue; | 672 | continue; |
673 | 673 | ||
674 | priv->stations[i].used &= ~IL_STA_UCODE_ACTIVE; | 674 | il->stations[i].used &= ~IL_STA_UCODE_ACTIVE; |
675 | priv->num_stations--; | 675 | il->num_stations--; |
676 | BUG_ON(priv->num_stations < 0); | 676 | BUG_ON(il->num_stations < 0); |
677 | kfree(priv->stations[i].lq); | 677 | kfree(il->stations[i].lq); |
678 | priv->stations[i].lq = NULL; | 678 | il->stations[i].lq = NULL; |
679 | } | 679 | } |
680 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 680 | spin_unlock_irqrestore(&il->sta_lock, flags); |
681 | } | 681 | } |
682 | EXPORT_SYMBOL_GPL(il_dealloc_bcast_stations); | 682 | EXPORT_SYMBOL_GPL(il_dealloc_bcast_stations); |
683 | 683 | ||
684 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 684 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
685 | static void il_dump_lq_cmd(struct il_priv *priv, | 685 | static void il_dump_lq_cmd(struct il_priv *il, |
686 | struct il_link_quality_cmd *lq) | 686 | struct il_link_quality_cmd *lq) |
687 | { | 687 | { |
688 | int i; | 688 | int i; |
689 | IL_DEBUG_RATE(priv, "lq station id 0x%x\n", lq->sta_id); | 689 | IL_DEBUG_RATE(il, "lq station id 0x%x\n", lq->sta_id); |
690 | IL_DEBUG_RATE(priv, "lq ant 0x%X 0x%X\n", | 690 | IL_DEBUG_RATE(il, "lq ant 0x%X 0x%X\n", |
691 | lq->general_params.single_stream_ant_msk, | 691 | lq->general_params.single_stream_ant_msk, |
692 | lq->general_params.dual_stream_ant_msk); | 692 | lq->general_params.dual_stream_ant_msk); |
693 | 693 | ||
694 | for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) | 694 | for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) |
695 | IL_DEBUG_RATE(priv, "lq index %d 0x%X\n", | 695 | IL_DEBUG_RATE(il, "lq index %d 0x%X\n", |
696 | i, lq->rs_table[i].rate_n_flags); | 696 | i, lq->rs_table[i].rate_n_flags); |
697 | } | 697 | } |
698 | #else | 698 | #else |
699 | static inline void il_dump_lq_cmd(struct il_priv *priv, | 699 | static inline void il_dump_lq_cmd(struct il_priv *il, |
700 | struct il_link_quality_cmd *lq) | 700 | struct il_link_quality_cmd *lq) |
701 | { | 701 | { |
702 | } | 702 | } |
@@ -713,7 +713,7 @@ static inline void il_dump_lq_cmd(struct il_priv *priv, | |||
713 | * Test for this to prevent driver from sending LQ command between the time | 713 | * Test for this to prevent driver from sending LQ command between the time |
714 | * RXON flags are updated and when LQ command is updated. | 714 | * RXON flags are updated and when LQ command is updated. |
715 | */ | 715 | */ |
716 | static bool il_is_lq_table_valid(struct il_priv *priv, | 716 | static bool il_is_lq_table_valid(struct il_priv *il, |
717 | struct il_rxon_context *ctx, | 717 | struct il_rxon_context *ctx, |
718 | struct il_link_quality_cmd *lq) | 718 | struct il_link_quality_cmd *lq) |
719 | { | 719 | { |
@@ -722,12 +722,12 @@ static bool il_is_lq_table_valid(struct il_priv *priv, | |||
722 | if (ctx->ht.enabled) | 722 | if (ctx->ht.enabled) |
723 | return true; | 723 | return true; |
724 | 724 | ||
725 | IL_DEBUG_INFO(priv, "Channel %u is not an HT channel\n", | 725 | IL_DEBUG_INFO(il, "Channel %u is not an HT channel\n", |
726 | ctx->active.channel); | 726 | ctx->active.channel); |
727 | for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { | 727 | for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { |
728 | if (le32_to_cpu(lq->rs_table[i].rate_n_flags) & | 728 | if (le32_to_cpu(lq->rs_table[i].rate_n_flags) & |
729 | RATE_MCS_HT_MSK) { | 729 | RATE_MCS_HT_MSK) { |
730 | IL_DEBUG_INFO(priv, | 730 | IL_DEBUG_INFO(il, |
731 | "index %d of LQ expects HT channel\n", | 731 | "index %d of LQ expects HT channel\n", |
732 | i); | 732 | i); |
733 | return false; | 733 | return false; |
@@ -746,7 +746,7 @@ static bool il_is_lq_table_valid(struct il_priv *priv, | |||
746 | * this case to clear the state indicating that station creation is in | 746 | * this case to clear the state indicating that station creation is in |
747 | * progress. | 747 | * progress. |
748 | */ | 748 | */ |
749 | int il_send_lq_cmd(struct il_priv *priv, struct il_rxon_context *ctx, | 749 | int il_send_lq_cmd(struct il_priv *il, struct il_rxon_context *ctx, |
750 | struct il_link_quality_cmd *lq, u8 flags, bool init) | 750 | struct il_link_quality_cmd *lq, u8 flags, bool init) |
751 | { | 751 | { |
752 | int ret = 0; | 752 | int ret = 0; |
@@ -763,18 +763,18 @@ int il_send_lq_cmd(struct il_priv *priv, struct il_rxon_context *ctx, | |||
763 | return -EINVAL; | 763 | return -EINVAL; |
764 | 764 | ||
765 | 765 | ||
766 | spin_lock_irqsave(&priv->sta_lock, flags_spin); | 766 | spin_lock_irqsave(&il->sta_lock, flags_spin); |
767 | if (!(priv->stations[lq->sta_id].used & IL_STA_DRIVER_ACTIVE)) { | 767 | if (!(il->stations[lq->sta_id].used & IL_STA_DRIVER_ACTIVE)) { |
768 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); | 768 | spin_unlock_irqrestore(&il->sta_lock, flags_spin); |
769 | return -EINVAL; | 769 | return -EINVAL; |
770 | } | 770 | } |
771 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); | 771 | spin_unlock_irqrestore(&il->sta_lock, flags_spin); |
772 | 772 | ||
773 | il_dump_lq_cmd(priv, lq); | 773 | il_dump_lq_cmd(il, lq); |
774 | BUG_ON(init && (cmd.flags & CMD_ASYNC)); | 774 | BUG_ON(init && (cmd.flags & CMD_ASYNC)); |
775 | 775 | ||
776 | if (il_is_lq_table_valid(priv, ctx, lq)) | 776 | if (il_is_lq_table_valid(il, ctx, lq)) |
777 | ret = il_send_cmd(priv, &cmd); | 777 | ret = il_send_cmd(il, &cmd); |
778 | else | 778 | else |
779 | ret = -EINVAL; | 779 | ret = -EINVAL; |
780 | 780 | ||
@@ -782,12 +782,12 @@ int il_send_lq_cmd(struct il_priv *priv, struct il_rxon_context *ctx, | |||
782 | return ret; | 782 | return ret; |
783 | 783 | ||
784 | if (init) { | 784 | if (init) { |
785 | IL_DEBUG_INFO(priv, "init LQ command complete," | 785 | IL_DEBUG_INFO(il, "init LQ command complete," |
786 | " clearing sta addition status for sta %d\n", | 786 | " clearing sta addition status for sta %d\n", |
787 | lq->sta_id); | 787 | lq->sta_id); |
788 | spin_lock_irqsave(&priv->sta_lock, flags_spin); | 788 | spin_lock_irqsave(&il->sta_lock, flags_spin); |
789 | priv->stations[lq->sta_id].used &= ~IL_STA_UCODE_INPROGRESS; | 789 | il->stations[lq->sta_id].used &= ~IL_STA_UCODE_INPROGRESS; |
790 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); | 790 | spin_unlock_irqrestore(&il->sta_lock, flags_spin); |
791 | } | 791 | } |
792 | return ret; | 792 | return ret; |
793 | } | 793 | } |
@@ -797,20 +797,20 @@ int il_mac_sta_remove(struct ieee80211_hw *hw, | |||
797 | struct ieee80211_vif *vif, | 797 | struct ieee80211_vif *vif, |
798 | struct ieee80211_sta *sta) | 798 | struct ieee80211_sta *sta) |
799 | { | 799 | { |
800 | struct il_priv *priv = hw->priv; | 800 | struct il_priv *il = hw->priv; |
801 | struct il_station_priv_common *sta_common = (void *)sta->drv_priv; | 801 | struct il_station_priv_common *sta_common = (void *)sta->drv_priv; |
802 | int ret; | 802 | int ret; |
803 | 803 | ||
804 | IL_DEBUG_INFO(priv, "received request to remove station %pM\n", | 804 | IL_DEBUG_INFO(il, "received request to remove station %pM\n", |
805 | sta->addr); | 805 | sta->addr); |
806 | mutex_lock(&priv->mutex); | 806 | mutex_lock(&il->mutex); |
807 | IL_DEBUG_INFO(priv, "proceeding to remove station %pM\n", | 807 | IL_DEBUG_INFO(il, "proceeding to remove station %pM\n", |
808 | sta->addr); | 808 | sta->addr); |
809 | ret = il_remove_station(priv, sta_common->sta_id, sta->addr); | 809 | ret = il_remove_station(il, sta_common->sta_id, sta->addr); |
810 | if (ret) | 810 | if (ret) |
811 | IL_ERR(priv, "Error removing station %pM\n", | 811 | IL_ERR(il, "Error removing station %pM\n", |
812 | sta->addr); | 812 | sta->addr); |
813 | mutex_unlock(&priv->mutex); | 813 | mutex_unlock(&il->mutex); |
814 | return ret; | 814 | return ret; |
815 | } | 815 | } |
816 | EXPORT_SYMBOL(il_mac_sta_remove); | 816 | 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 555b0602cea..77cdfd4a667 100644 --- a/drivers/net/wireless/iwlegacy/iwl-sta.h +++ b/drivers/net/wireless/iwlegacy/iwl-sta.h | |||
@@ -43,56 +43,56 @@ | |||
43 | #define IL_STA_BCAST BIT(4) /* this station is the special bcast station */ | 43 | #define IL_STA_BCAST BIT(4) /* this station is the special bcast station */ |
44 | 44 | ||
45 | 45 | ||
46 | void il_restore_stations(struct il_priv *priv, | 46 | void il_restore_stations(struct il_priv *il, |
47 | struct il_rxon_context *ctx); | 47 | struct il_rxon_context *ctx); |
48 | void il_clear_ucode_stations(struct il_priv *priv, | 48 | void il_clear_ucode_stations(struct il_priv *il, |
49 | struct il_rxon_context *ctx); | 49 | struct il_rxon_context *ctx); |
50 | void il_dealloc_bcast_stations(struct il_priv *priv); | 50 | void il_dealloc_bcast_stations(struct il_priv *il); |
51 | int il_get_free_ucode_key_index(struct il_priv *priv); | 51 | int il_get_free_ucode_key_index(struct il_priv *il); |
52 | int il_send_add_sta(struct il_priv *priv, | 52 | int il_send_add_sta(struct il_priv *il, |
53 | struct il_addsta_cmd *sta, u8 flags); | 53 | struct il_addsta_cmd *sta, u8 flags); |
54 | int il_add_station_common(struct il_priv *priv, | 54 | int il_add_station_common(struct il_priv *il, |
55 | struct il_rxon_context *ctx, | 55 | struct il_rxon_context *ctx, |
56 | const u8 *addr, bool is_ap, | 56 | const u8 *addr, bool is_ap, |
57 | struct ieee80211_sta *sta, u8 *sta_id_r); | 57 | struct ieee80211_sta *sta, u8 *sta_id_r); |
58 | int il_remove_station(struct il_priv *priv, | 58 | int il_remove_station(struct il_priv *il, |
59 | const u8 sta_id, | 59 | const u8 sta_id, |
60 | const u8 *addr); | 60 | const u8 *addr); |
61 | int il_mac_sta_remove(struct ieee80211_hw *hw, | 61 | int il_mac_sta_remove(struct ieee80211_hw *hw, |
62 | struct ieee80211_vif *vif, | 62 | struct ieee80211_vif *vif, |
63 | struct ieee80211_sta *sta); | 63 | struct ieee80211_sta *sta); |
64 | 64 | ||
65 | u8 il_prep_station(struct il_priv *priv, | 65 | u8 il_prep_station(struct il_priv *il, |
66 | struct il_rxon_context *ctx, | 66 | struct il_rxon_context *ctx, |
67 | const u8 *addr, bool is_ap, | 67 | const u8 *addr, bool is_ap, |
68 | struct ieee80211_sta *sta); | 68 | struct ieee80211_sta *sta); |
69 | 69 | ||
70 | int il_send_lq_cmd(struct il_priv *priv, | 70 | int il_send_lq_cmd(struct il_priv *il, |
71 | struct il_rxon_context *ctx, | 71 | struct il_rxon_context *ctx, |
72 | struct il_link_quality_cmd *lq, | 72 | struct il_link_quality_cmd *lq, |
73 | u8 flags, bool init); | 73 | u8 flags, bool init); |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * il_clear_driver_stations - clear knowledge of all stations from driver | 76 | * il_clear_driver_stations - clear knowledge of all stations from driver |
77 | * @priv: iwl priv struct | 77 | * @il: iwl il struct |
78 | * | 78 | * |
79 | * This is called during il_down() to make sure that in the case | 79 | * This is called during il_down() to make sure that in the case |
80 | * we're coming there from a hardware restart mac80211 will be | 80 | * we're coming there from a hardware restart mac80211 will be |
81 | * able to reconfigure stations -- if we're getting there in the | 81 | * able to reconfigure stations -- if we're getting there in the |
82 | * normal down flow then the stations will already be cleared. | 82 | * normal down flow then the stations will already be cleared. |
83 | */ | 83 | */ |
84 | static inline void il_clear_driver_stations(struct il_priv *priv) | 84 | static inline void il_clear_driver_stations(struct il_priv *il) |
85 | { | 85 | { |
86 | unsigned long flags; | 86 | unsigned long flags; |
87 | struct il_rxon_context *ctx; | 87 | struct il_rxon_context *ctx; |
88 | 88 | ||
89 | spin_lock_irqsave(&priv->sta_lock, flags); | 89 | spin_lock_irqsave(&il->sta_lock, flags); |
90 | memset(priv->stations, 0, sizeof(priv->stations)); | 90 | memset(il->stations, 0, sizeof(il->stations)); |
91 | priv->num_stations = 0; | 91 | il->num_stations = 0; |
92 | 92 | ||
93 | priv->ucode_key_table = 0; | 93 | il->ucode_key_table = 0; |
94 | 94 | ||
95 | for_each_context(priv, ctx) { | 95 | for_each_context(il, ctx) { |
96 | /* | 96 | /* |
97 | * Remove all key information that is not stored as part | 97 | * Remove all key information that is not stored as part |
98 | * of station information since mac80211 may not have had | 98 | * of station information since mac80211 may not have had |
@@ -104,7 +104,7 @@ static inline void il_clear_driver_stations(struct il_priv *priv) | |||
104 | ctx->key_mapping_keys = 0; | 104 | ctx->key_mapping_keys = 0; |
105 | } | 105 | } |
106 | 106 | ||
107 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 107 | spin_unlock_irqrestore(&il->sta_lock, flags); |
108 | } | 108 | } |
109 | 109 | ||
110 | static inline int il_sta_id(struct ieee80211_sta *sta) | 110 | static inline int il_sta_id(struct ieee80211_sta *sta) |
@@ -117,7 +117,7 @@ static inline int il_sta_id(struct ieee80211_sta *sta) | |||
117 | 117 | ||
118 | /** | 118 | /** |
119 | * il_sta_id_or_broadcast - return sta_id or broadcast sta | 119 | * il_sta_id_or_broadcast - return sta_id or broadcast sta |
120 | * @priv: iwl priv | 120 | * @il: iwl il |
121 | * @context: the current context | 121 | * @context: the current context |
122 | * @sta: mac80211 station | 122 | * @sta: mac80211 station |
123 | * | 123 | * |
@@ -126,7 +126,7 @@ static inline int il_sta_id(struct ieee80211_sta *sta) | |||
126 | * that case, we need to use the broadcast station, so this | 126 | * that case, we need to use the broadcast station, so this |
127 | * inline wraps that pattern. | 127 | * inline wraps that pattern. |
128 | */ | 128 | */ |
129 | static inline int il_sta_id_or_broadcast(struct il_priv *priv, | 129 | static inline int il_sta_id_or_broadcast(struct il_priv *il, |
130 | struct il_rxon_context *context, | 130 | struct il_rxon_context *context, |
131 | struct ieee80211_sta *sta) | 131 | struct ieee80211_sta *sta) |
132 | { | 132 | { |
diff --git a/drivers/net/wireless/iwlegacy/iwl-tx.c b/drivers/net/wireless/iwlegacy/iwl-tx.c index 1c27c60c753..af6ac4fe267 100644 --- a/drivers/net/wireless/iwlegacy/iwl-tx.c +++ b/drivers/net/wireless/iwlegacy/iwl-tx.c | |||
@@ -42,7 +42,7 @@ | |||
42 | * il_txq_update_write_ptr - Send new write index to hardware | 42 | * il_txq_update_write_ptr - Send new write index to hardware |
43 | */ | 43 | */ |
44 | void | 44 | void |
45 | il_txq_update_write_ptr(struct il_priv *priv, struct il_tx_queue *txq) | 45 | il_txq_update_write_ptr(struct il_priv *il, struct il_tx_queue *txq) |
46 | { | 46 | { |
47 | u32 reg = 0; | 47 | u32 reg = 0; |
48 | int txq_id = txq->q.id; | 48 | int txq_id = txq->q.id; |
@@ -51,22 +51,22 @@ il_txq_update_write_ptr(struct il_priv *priv, struct il_tx_queue *txq) | |||
51 | return; | 51 | return; |
52 | 52 | ||
53 | /* if we're trying to save power */ | 53 | /* if we're trying to save power */ |
54 | if (test_bit(STATUS_POWER_PMI, &priv->status)) { | 54 | if (test_bit(STATUS_POWER_PMI, &il->status)) { |
55 | /* wake up nic if it's powered down ... | 55 | /* wake up nic if it's powered down ... |
56 | * uCode will wake up, and interrupt us again, so next | 56 | * uCode will wake up, and interrupt us again, so next |
57 | * time we'll skip this part. */ | 57 | * time we'll skip this part. */ |
58 | reg = il_read32(priv, CSR_UCODE_DRV_GP1); | 58 | reg = il_read32(il, CSR_UCODE_DRV_GP1); |
59 | 59 | ||
60 | if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { | 60 | if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { |
61 | IL_DEBUG_INFO(priv, | 61 | IL_DEBUG_INFO(il, |
62 | "Tx queue %d requesting wakeup," | 62 | "Tx queue %d requesting wakeup," |
63 | " GP1 = 0x%x\n", txq_id, reg); | 63 | " GP1 = 0x%x\n", txq_id, reg); |
64 | il_set_bit(priv, CSR_GP_CNTRL, | 64 | il_set_bit(il, CSR_GP_CNTRL, |
65 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); | 65 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); |
66 | return; | 66 | return; |
67 | } | 67 | } |
68 | 68 | ||
69 | il_write_direct32(priv, HBUS_TARG_WRPTR, | 69 | il_write_direct32(il, HBUS_TARG_WRPTR, |
70 | txq->q.write_ptr | (txq_id << 8)); | 70 | txq->q.write_ptr | (txq_id << 8)); |
71 | 71 | ||
72 | /* | 72 | /* |
@@ -75,7 +75,7 @@ il_txq_update_write_ptr(struct il_priv *priv, struct il_tx_queue *txq) | |||
75 | * trying to tx (during RFKILL, we're not trying to tx). | 75 | * trying to tx (during RFKILL, we're not trying to tx). |
76 | */ | 76 | */ |
77 | } else | 77 | } else |
78 | il_write32(priv, HBUS_TARG_WRPTR, | 78 | il_write32(il, HBUS_TARG_WRPTR, |
79 | txq->q.write_ptr | (txq_id << 8)); | 79 | txq->q.write_ptr | (txq_id << 8)); |
80 | txq->need_update = 0; | 80 | txq->need_update = 0; |
81 | } | 81 | } |
@@ -84,16 +84,16 @@ EXPORT_SYMBOL(il_txq_update_write_ptr); | |||
84 | /** | 84 | /** |
85 | * il_tx_queue_unmap - Unmap any remaining DMA mappings and free skb's | 85 | * il_tx_queue_unmap - Unmap any remaining DMA mappings and free skb's |
86 | */ | 86 | */ |
87 | void il_tx_queue_unmap(struct il_priv *priv, int txq_id) | 87 | void il_tx_queue_unmap(struct il_priv *il, int txq_id) |
88 | { | 88 | { |
89 | struct il_tx_queue *txq = &priv->txq[txq_id]; | 89 | struct il_tx_queue *txq = &il->txq[txq_id]; |
90 | struct il_queue *q = &txq->q; | 90 | struct il_queue *q = &txq->q; |
91 | 91 | ||
92 | if (q->n_bd == 0) | 92 | if (q->n_bd == 0) |
93 | return; | 93 | return; |
94 | 94 | ||
95 | while (q->write_ptr != q->read_ptr) { | 95 | while (q->write_ptr != q->read_ptr) { |
96 | priv->cfg->ops->lib->txq_free_tfd(priv, txq); | 96 | il->cfg->ops->lib->txq_free_tfd(il, txq); |
97 | q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd); | 97 | q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd); |
98 | } | 98 | } |
99 | } | 99 | } |
@@ -107,13 +107,13 @@ EXPORT_SYMBOL(il_tx_queue_unmap); | |||
107 | * Free all buffers. | 107 | * Free all buffers. |
108 | * 0-fill, but do not free "txq" descriptor structure. | 108 | * 0-fill, but do not free "txq" descriptor structure. |
109 | */ | 109 | */ |
110 | void il_tx_queue_free(struct il_priv *priv, int txq_id) | 110 | void il_tx_queue_free(struct il_priv *il, int txq_id) |
111 | { | 111 | { |
112 | struct il_tx_queue *txq = &priv->txq[txq_id]; | 112 | struct il_tx_queue *txq = &il->txq[txq_id]; |
113 | struct device *dev = &priv->pci_dev->dev; | 113 | struct device *dev = &il->pci_dev->dev; |
114 | int i; | 114 | int i; |
115 | 115 | ||
116 | il_tx_queue_unmap(priv, txq_id); | 116 | il_tx_queue_unmap(il, txq_id); |
117 | 117 | ||
118 | /* De-alloc array of command/tx buffers */ | 118 | /* De-alloc array of command/tx buffers */ |
119 | for (i = 0; i < TFD_TX_CMD_SLOTS; i++) | 119 | for (i = 0; i < TFD_TX_CMD_SLOTS; i++) |
@@ -121,7 +121,7 @@ void il_tx_queue_free(struct il_priv *priv, int txq_id) | |||
121 | 121 | ||
122 | /* De-alloc circular buffer of TFDs */ | 122 | /* De-alloc circular buffer of TFDs */ |
123 | if (txq->q.n_bd) | 123 | if (txq->q.n_bd) |
124 | dma_free_coherent(dev, priv->hw_params.tfd_size * | 124 | dma_free_coherent(dev, il->hw_params.tfd_size * |
125 | txq->q.n_bd, txq->tfds, txq->q.dma_addr); | 125 | txq->q.n_bd, txq->tfds, txq->q.dma_addr); |
126 | 126 | ||
127 | /* De-alloc array of per-TFD driver data */ | 127 | /* De-alloc array of per-TFD driver data */ |
@@ -142,9 +142,9 @@ EXPORT_SYMBOL(il_tx_queue_free); | |||
142 | /** | 142 | /** |
143 | * il_cmd_queue_unmap - Unmap any remaining DMA mappings from command queue | 143 | * il_cmd_queue_unmap - Unmap any remaining DMA mappings from command queue |
144 | */ | 144 | */ |
145 | void il_cmd_queue_unmap(struct il_priv *priv) | 145 | void il_cmd_queue_unmap(struct il_priv *il) |
146 | { | 146 | { |
147 | struct il_tx_queue *txq = &priv->txq[priv->cmd_queue]; | 147 | struct il_tx_queue *txq = &il->txq[il->cmd_queue]; |
148 | struct il_queue *q = &txq->q; | 148 | struct il_queue *q = &txq->q; |
149 | int i; | 149 | int i; |
150 | 150 | ||
@@ -155,7 +155,7 @@ void il_cmd_queue_unmap(struct il_priv *priv) | |||
155 | i = il_get_cmd_index(q, q->read_ptr, 0); | 155 | i = il_get_cmd_index(q, q->read_ptr, 0); |
156 | 156 | ||
157 | if (txq->meta[i].flags & CMD_MAPPED) { | 157 | if (txq->meta[i].flags & CMD_MAPPED) { |
158 | pci_unmap_single(priv->pci_dev, | 158 | pci_unmap_single(il->pci_dev, |
159 | dma_unmap_addr(&txq->meta[i], mapping), | 159 | dma_unmap_addr(&txq->meta[i], mapping), |
160 | dma_unmap_len(&txq->meta[i], len), | 160 | dma_unmap_len(&txq->meta[i], len), |
161 | PCI_DMA_BIDIRECTIONAL); | 161 | PCI_DMA_BIDIRECTIONAL); |
@@ -167,7 +167,7 @@ void il_cmd_queue_unmap(struct il_priv *priv) | |||
167 | 167 | ||
168 | i = q->n_window; | 168 | i = q->n_window; |
169 | if (txq->meta[i].flags & CMD_MAPPED) { | 169 | if (txq->meta[i].flags & CMD_MAPPED) { |
170 | pci_unmap_single(priv->pci_dev, | 170 | pci_unmap_single(il->pci_dev, |
171 | dma_unmap_addr(&txq->meta[i], mapping), | 171 | dma_unmap_addr(&txq->meta[i], mapping), |
172 | dma_unmap_len(&txq->meta[i], len), | 172 | dma_unmap_len(&txq->meta[i], len), |
173 | PCI_DMA_BIDIRECTIONAL); | 173 | PCI_DMA_BIDIRECTIONAL); |
@@ -184,13 +184,13 @@ EXPORT_SYMBOL(il_cmd_queue_unmap); | |||
184 | * Free all buffers. | 184 | * Free all buffers. |
185 | * 0-fill, but do not free "txq" descriptor structure. | 185 | * 0-fill, but do not free "txq" descriptor structure. |
186 | */ | 186 | */ |
187 | void il_cmd_queue_free(struct il_priv *priv) | 187 | void il_cmd_queue_free(struct il_priv *il) |
188 | { | 188 | { |
189 | struct il_tx_queue *txq = &priv->txq[priv->cmd_queue]; | 189 | struct il_tx_queue *txq = &il->txq[il->cmd_queue]; |
190 | struct device *dev = &priv->pci_dev->dev; | 190 | struct device *dev = &il->pci_dev->dev; |
191 | int i; | 191 | int i; |
192 | 192 | ||
193 | il_cmd_queue_unmap(priv); | 193 | il_cmd_queue_unmap(il); |
194 | 194 | ||
195 | /* De-alloc array of command/tx buffers */ | 195 | /* De-alloc array of command/tx buffers */ |
196 | for (i = 0; i <= TFD_CMD_SLOTS; i++) | 196 | for (i = 0; i <= TFD_CMD_SLOTS; i++) |
@@ -198,7 +198,7 @@ void il_cmd_queue_free(struct il_priv *priv) | |||
198 | 198 | ||
199 | /* De-alloc circular buffer of TFDs */ | 199 | /* De-alloc circular buffer of TFDs */ |
200 | if (txq->q.n_bd) | 200 | if (txq->q.n_bd) |
201 | dma_free_coherent(dev, priv->hw_params.tfd_size * txq->q.n_bd, | 201 | dma_free_coherent(dev, il->hw_params.tfd_size * txq->q.n_bd, |
202 | txq->tfds, txq->q.dma_addr); | 202 | txq->tfds, txq->q.dma_addr); |
203 | 203 | ||
204 | /* deallocate arrays */ | 204 | /* deallocate arrays */ |
@@ -256,7 +256,7 @@ EXPORT_SYMBOL(il_queue_space); | |||
256 | /** | 256 | /** |
257 | * il_queue_init - Initialize queue's high/low-water and read/write indexes | 257 | * il_queue_init - Initialize queue's high/low-water and read/write indexes |
258 | */ | 258 | */ |
259 | static int il_queue_init(struct il_priv *priv, struct il_queue *q, | 259 | static int il_queue_init(struct il_priv *il, struct il_queue *q, |
260 | int count, int slots_num, u32 id) | 260 | int count, int slots_num, u32 id) |
261 | { | 261 | { |
262 | q->n_bd = count; | 262 | q->n_bd = count; |
@@ -287,19 +287,19 @@ static int il_queue_init(struct il_priv *priv, struct il_queue *q, | |||
287 | /** | 287 | /** |
288 | * il_tx_queue_alloc - Alloc driver data and TFD CB for one Tx/cmd queue | 288 | * il_tx_queue_alloc - Alloc driver data and TFD CB for one Tx/cmd queue |
289 | */ | 289 | */ |
290 | static int il_tx_queue_alloc(struct il_priv *priv, | 290 | static int il_tx_queue_alloc(struct il_priv *il, |
291 | struct il_tx_queue *txq, u32 id) | 291 | struct il_tx_queue *txq, u32 id) |
292 | { | 292 | { |
293 | struct device *dev = &priv->pci_dev->dev; | 293 | struct device *dev = &il->pci_dev->dev; |
294 | size_t tfd_sz = priv->hw_params.tfd_size * TFD_QUEUE_SIZE_MAX; | 294 | size_t tfd_sz = il->hw_params.tfd_size * TFD_QUEUE_SIZE_MAX; |
295 | 295 | ||
296 | /* Driver private data, only for Tx (not command) queues, | 296 | /* Driver ilate data, only for Tx (not command) queues, |
297 | * not shared with device. */ | 297 | * not shared with device. */ |
298 | if (id != priv->cmd_queue) { | 298 | if (id != il->cmd_queue) { |
299 | txq->txb = kzalloc(sizeof(txq->txb[0]) * | 299 | txq->txb = kzalloc(sizeof(txq->txb[0]) * |
300 | TFD_QUEUE_SIZE_MAX, GFP_KERNEL); | 300 | TFD_QUEUE_SIZE_MAX, GFP_KERNEL); |
301 | if (!txq->txb) { | 301 | if (!txq->txb) { |
302 | IL_ERR(priv, "kmalloc for auxiliary BD " | 302 | IL_ERR(il, "kmalloc for auxiliary BD " |
303 | "structures failed\n"); | 303 | "structures failed\n"); |
304 | goto error; | 304 | goto error; |
305 | } | 305 | } |
@@ -312,7 +312,7 @@ static int il_tx_queue_alloc(struct il_priv *priv, | |||
312 | txq->tfds = dma_alloc_coherent(dev, tfd_sz, &txq->q.dma_addr, | 312 | txq->tfds = dma_alloc_coherent(dev, tfd_sz, &txq->q.dma_addr, |
313 | GFP_KERNEL); | 313 | GFP_KERNEL); |
314 | if (!txq->tfds) { | 314 | if (!txq->tfds) { |
315 | IL_ERR(priv, "pci_alloc_consistent(%zd) failed\n", tfd_sz); | 315 | IL_ERR(il, "pci_alloc_consistent(%zd) failed\n", tfd_sz); |
316 | goto error; | 316 | goto error; |
317 | } | 317 | } |
318 | txq->q.id = id; | 318 | txq->q.id = id; |
@@ -329,7 +329,7 @@ static int il_tx_queue_alloc(struct il_priv *priv, | |||
329 | /** | 329 | /** |
330 | * il_tx_queue_init - Allocate and initialize one tx/cmd queue | 330 | * il_tx_queue_init - Allocate and initialize one tx/cmd queue |
331 | */ | 331 | */ |
332 | int il_tx_queue_init(struct il_priv *priv, struct il_tx_queue *txq, | 332 | int il_tx_queue_init(struct il_priv *il, struct il_tx_queue *txq, |
333 | int slots_num, u32 txq_id) | 333 | int slots_num, u32 txq_id) |
334 | { | 334 | { |
335 | int i, len; | 335 | int i, len; |
@@ -344,7 +344,7 @@ int il_tx_queue_init(struct il_priv *priv, struct il_tx_queue *txq, | |||
344 | * For normal Tx queues (all other queues), no super-size command | 344 | * For normal Tx queues (all other queues), no super-size command |
345 | * space is needed. | 345 | * space is needed. |
346 | */ | 346 | */ |
347 | if (txq_id == priv->cmd_queue) | 347 | if (txq_id == il->cmd_queue) |
348 | actual_slots++; | 348 | actual_slots++; |
349 | 349 | ||
350 | txq->meta = kzalloc(sizeof(struct il_cmd_meta) * actual_slots, | 350 | 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, | |||
367 | } | 367 | } |
368 | 368 | ||
369 | /* Alloc driver data array and TFD circular buffer */ | 369 | /* Alloc driver data array and TFD circular buffer */ |
370 | ret = il_tx_queue_alloc(priv, txq, txq_id); | 370 | ret = il_tx_queue_alloc(il, txq, txq_id); |
371 | if (ret) | 371 | if (ret) |
372 | goto err; | 372 | goto err; |
373 | 373 | ||
@@ -386,11 +386,11 @@ int il_tx_queue_init(struct il_priv *priv, struct il_tx_queue *txq, | |||
386 | BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1)); | 386 | BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1)); |
387 | 387 | ||
388 | /* Initialize queue's high/low-water marks, and head/tail indexes */ | 388 | /* Initialize queue's high/low-water marks, and head/tail indexes */ |
389 | il_queue_init(priv, &txq->q, | 389 | il_queue_init(il, &txq->q, |
390 | TFD_QUEUE_SIZE_MAX, slots_num, txq_id); | 390 | TFD_QUEUE_SIZE_MAX, slots_num, txq_id); |
391 | 391 | ||
392 | /* Tell device where to find queue */ | 392 | /* Tell device where to find queue */ |
393 | priv->cfg->ops->lib->txq_init(priv, txq); | 393 | il->cfg->ops->lib->txq_init(il, txq); |
394 | 394 | ||
395 | return 0; | 395 | return 0; |
396 | err: | 396 | err: |
@@ -404,12 +404,12 @@ out_free_arrays: | |||
404 | } | 404 | } |
405 | EXPORT_SYMBOL(il_tx_queue_init); | 405 | EXPORT_SYMBOL(il_tx_queue_init); |
406 | 406 | ||
407 | void il_tx_queue_reset(struct il_priv *priv, struct il_tx_queue *txq, | 407 | void il_tx_queue_reset(struct il_priv *il, struct il_tx_queue *txq, |
408 | int slots_num, u32 txq_id) | 408 | int slots_num, u32 txq_id) |
409 | { | 409 | { |
410 | int actual_slots = slots_num; | 410 | int actual_slots = slots_num; |
411 | 411 | ||
412 | if (txq_id == priv->cmd_queue) | 412 | if (txq_id == il->cmd_queue) |
413 | actual_slots++; | 413 | actual_slots++; |
414 | 414 | ||
415 | memset(txq->meta, 0, sizeof(struct il_cmd_meta) * actual_slots); | 415 | 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, | |||
417 | txq->need_update = 0; | 417 | txq->need_update = 0; |
418 | 418 | ||
419 | /* Initialize queue's high/low-water marks, and head/tail indexes */ | 419 | /* Initialize queue's high/low-water marks, and head/tail indexes */ |
420 | il_queue_init(priv, &txq->q, | 420 | il_queue_init(il, &txq->q, |
421 | TFD_QUEUE_SIZE_MAX, slots_num, txq_id); | 421 | TFD_QUEUE_SIZE_MAX, slots_num, txq_id); |
422 | 422 | ||
423 | /* Tell device where to find queue */ | 423 | /* Tell device where to find queue */ |
424 | priv->cfg->ops->lib->txq_init(priv, txq); | 424 | il->cfg->ops->lib->txq_init(il, txq); |
425 | } | 425 | } |
426 | EXPORT_SYMBOL(il_tx_queue_reset); | 426 | EXPORT_SYMBOL(il_tx_queue_reset); |
427 | 427 | ||
@@ -429,16 +429,16 @@ EXPORT_SYMBOL(il_tx_queue_reset); | |||
429 | 429 | ||
430 | /** | 430 | /** |
431 | * il_enqueue_hcmd - enqueue a uCode command | 431 | * il_enqueue_hcmd - enqueue a uCode command |
432 | * @priv: device private data point | 432 | * @il: device ilate data point |
433 | * @cmd: a point to the ucode command structure | 433 | * @cmd: a point to the ucode command structure |
434 | * | 434 | * |
435 | * The function returns < 0 values to indicate the operation is | 435 | * The function returns < 0 values to indicate the operation is |
436 | * failed. On success, it turns the index (> 0) of command in the | 436 | * failed. On success, it turns the index (> 0) of command in the |
437 | * command queue. | 437 | * command queue. |
438 | */ | 438 | */ |
439 | int il_enqueue_hcmd(struct il_priv *priv, struct il_host_cmd *cmd) | 439 | int il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd) |
440 | { | 440 | { |
441 | struct il_tx_queue *txq = &priv->txq[priv->cmd_queue]; | 441 | struct il_tx_queue *txq = &il->txq[il->cmd_queue]; |
442 | struct il_queue *q = &txq->q; | 442 | struct il_queue *q = &txq->q; |
443 | struct il_device_cmd *out_cmd; | 443 | struct il_device_cmd *out_cmd; |
444 | struct il_cmd_meta *out_meta; | 444 | struct il_cmd_meta *out_meta; |
@@ -448,7 +448,7 @@ int il_enqueue_hcmd(struct il_priv *priv, struct il_host_cmd *cmd) | |||
448 | u32 idx; | 448 | u32 idx; |
449 | u16 fix_size; | 449 | u16 fix_size; |
450 | 450 | ||
451 | cmd->len = priv->cfg->ops->utils->get_hcmd_size(cmd->id, cmd->len); | 451 | cmd->len = il->cfg->ops->utils->get_hcmd_size(cmd->id, cmd->len); |
452 | fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr)); | 452 | fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr)); |
453 | 453 | ||
454 | /* If any of the command structures end up being larger than | 454 | /* 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) | |||
460 | !(cmd->flags & CMD_SIZE_HUGE)); | 460 | !(cmd->flags & CMD_SIZE_HUGE)); |
461 | BUG_ON(fix_size > IL_MAX_CMD_SIZE); | 461 | BUG_ON(fix_size > IL_MAX_CMD_SIZE); |
462 | 462 | ||
463 | if (il_is_rfkill(priv) || il_is_ctkill(priv)) { | 463 | if (il_is_rfkill(il) || il_is_ctkill(il)) { |
464 | IL_WARN(priv, "Not sending command - %s KILL\n", | 464 | IL_WARN(il, "Not sending command - %s KILL\n", |
465 | il_is_rfkill(priv) ? "RF" : "CT"); | 465 | il_is_rfkill(il) ? "RF" : "CT"); |
466 | return -EIO; | 466 | return -EIO; |
467 | } | 467 | } |
468 | 468 | ||
469 | spin_lock_irqsave(&priv->hcmd_lock, flags); | 469 | spin_lock_irqsave(&il->hcmd_lock, flags); |
470 | 470 | ||
471 | if (il_queue_space(q) < ((cmd->flags & CMD_ASYNC) ? 2 : 1)) { | 471 | if (il_queue_space(q) < ((cmd->flags & CMD_ASYNC) ? 2 : 1)) { |
472 | spin_unlock_irqrestore(&priv->hcmd_lock, flags); | 472 | spin_unlock_irqrestore(&il->hcmd_lock, flags); |
473 | 473 | ||
474 | IL_ERR(priv, "Restarting adapter due to command queue full\n"); | 474 | IL_ERR(il, "Restarting adapter due to command queue full\n"); |
475 | queue_work(priv->workqueue, &priv->restart); | 475 | queue_work(il->workqueue, &il->restart); |
476 | return -ENOSPC; | 476 | return -ENOSPC; |
477 | } | 477 | } |
478 | 478 | ||
@@ -481,7 +481,7 @@ int il_enqueue_hcmd(struct il_priv *priv, struct il_host_cmd *cmd) | |||
481 | out_meta = &txq->meta[idx]; | 481 | out_meta = &txq->meta[idx]; |
482 | 482 | ||
483 | if (WARN_ON(out_meta->flags & CMD_MAPPED)) { | 483 | if (WARN_ON(out_meta->flags & CMD_MAPPED)) { |
484 | spin_unlock_irqrestore(&priv->hcmd_lock, flags); | 484 | spin_unlock_irqrestore(&il->hcmd_lock, flags); |
485 | return -ENOSPC; | 485 | return -ENOSPC; |
486 | } | 486 | } |
487 | 487 | ||
@@ -499,7 +499,7 @@ int il_enqueue_hcmd(struct il_priv *priv, struct il_host_cmd *cmd) | |||
499 | * information */ | 499 | * information */ |
500 | 500 | ||
501 | out_cmd->hdr.flags = 0; | 501 | out_cmd->hdr.flags = 0; |
502 | out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(priv->cmd_queue) | | 502 | out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(il->cmd_queue) | |
503 | INDEX_TO_SEQ(q->write_ptr)); | 503 | INDEX_TO_SEQ(q->write_ptr)); |
504 | if (cmd->flags & CMD_SIZE_HUGE) | 504 | if (cmd->flags & CMD_SIZE_HUGE) |
505 | out_cmd->hdr.sequence |= SEQ_HUGE_FRAME; | 505 | out_cmd->hdr.sequence |= SEQ_HUGE_FRAME; |
@@ -511,43 +511,43 @@ int il_enqueue_hcmd(struct il_priv *priv, struct il_host_cmd *cmd) | |||
511 | switch (out_cmd->hdr.cmd) { | 511 | switch (out_cmd->hdr.cmd) { |
512 | case REPLY_TX_LINK_QUALITY_CMD: | 512 | case REPLY_TX_LINK_QUALITY_CMD: |
513 | case SENSITIVITY_CMD: | 513 | case SENSITIVITY_CMD: |
514 | IL_DEBUG_HC_DUMP(priv, | 514 | IL_DEBUG_HC_DUMP(il, |
515 | "Sending command %s (#%x), seq: 0x%04X, " | 515 | "Sending command %s (#%x), seq: 0x%04X, " |
516 | "%d bytes at %d[%d]:%d\n", | 516 | "%d bytes at %d[%d]:%d\n", |
517 | il_get_cmd_string(out_cmd->hdr.cmd), | 517 | il_get_cmd_string(out_cmd->hdr.cmd), |
518 | out_cmd->hdr.cmd, | 518 | out_cmd->hdr.cmd, |
519 | le16_to_cpu(out_cmd->hdr.sequence), fix_size, | 519 | le16_to_cpu(out_cmd->hdr.sequence), fix_size, |
520 | q->write_ptr, idx, priv->cmd_queue); | 520 | q->write_ptr, idx, il->cmd_queue); |
521 | break; | 521 | break; |
522 | default: | 522 | default: |
523 | IL_DEBUG_HC(priv, "Sending command %s (#%x), seq: 0x%04X, " | 523 | IL_DEBUG_HC(il, "Sending command %s (#%x), seq: 0x%04X, " |
524 | "%d bytes at %d[%d]:%d\n", | 524 | "%d bytes at %d[%d]:%d\n", |
525 | il_get_cmd_string(out_cmd->hdr.cmd), | 525 | il_get_cmd_string(out_cmd->hdr.cmd), |
526 | out_cmd->hdr.cmd, | 526 | out_cmd->hdr.cmd, |
527 | le16_to_cpu(out_cmd->hdr.sequence), fix_size, | 527 | le16_to_cpu(out_cmd->hdr.sequence), fix_size, |
528 | q->write_ptr, idx, priv->cmd_queue); | 528 | q->write_ptr, idx, il->cmd_queue); |
529 | } | 529 | } |
530 | #endif | 530 | #endif |
531 | txq->need_update = 1; | 531 | txq->need_update = 1; |
532 | 532 | ||
533 | if (priv->cfg->ops->lib->txq_update_byte_cnt_tbl) | 533 | if (il->cfg->ops->lib->txq_update_byte_cnt_tbl) |
534 | /* Set up entry in queue's byte count circular buffer */ | 534 | /* Set up entry in queue's byte count circular buffer */ |
535 | priv->cfg->ops->lib->txq_update_byte_cnt_tbl(priv, txq, 0); | 535 | il->cfg->ops->lib->txq_update_byte_cnt_tbl(il, txq, 0); |
536 | 536 | ||
537 | phys_addr = pci_map_single(priv->pci_dev, &out_cmd->hdr, | 537 | phys_addr = pci_map_single(il->pci_dev, &out_cmd->hdr, |
538 | fix_size, PCI_DMA_BIDIRECTIONAL); | 538 | fix_size, PCI_DMA_BIDIRECTIONAL); |
539 | dma_unmap_addr_set(out_meta, mapping, phys_addr); | 539 | dma_unmap_addr_set(out_meta, mapping, phys_addr); |
540 | dma_unmap_len_set(out_meta, len, fix_size); | 540 | dma_unmap_len_set(out_meta, len, fix_size); |
541 | 541 | ||
542 | priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq, | 542 | il->cfg->ops->lib->txq_attach_buf_to_tfd(il, txq, |
543 | phys_addr, fix_size, 1, | 543 | phys_addr, fix_size, 1, |
544 | U32_PAD(cmd->len)); | 544 | U32_PAD(cmd->len)); |
545 | 545 | ||
546 | /* Increment and update queue's write index */ | 546 | /* Increment and update queue's write index */ |
547 | q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd); | 547 | q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd); |
548 | il_txq_update_write_ptr(priv, txq); | 548 | il_txq_update_write_ptr(il, txq); |
549 | 549 | ||
550 | spin_unlock_irqrestore(&priv->hcmd_lock, flags); | 550 | spin_unlock_irqrestore(&il->hcmd_lock, flags); |
551 | return idx; | 551 | return idx; |
552 | } | 552 | } |
553 | 553 | ||
@@ -558,15 +558,15 @@ int il_enqueue_hcmd(struct il_priv *priv, struct il_host_cmd *cmd) | |||
558 | * need to be reclaimed. As result, some free space forms. If there is | 558 | * need to be reclaimed. As result, some free space forms. If there is |
559 | * enough free space (> low mark), wake the stack that feeds us. | 559 | * enough free space (> low mark), wake the stack that feeds us. |
560 | */ | 560 | */ |
561 | static void il_hcmd_queue_reclaim(struct il_priv *priv, int txq_id, | 561 | static void il_hcmd_queue_reclaim(struct il_priv *il, int txq_id, |
562 | int idx, int cmd_idx) | 562 | int idx, int cmd_idx) |
563 | { | 563 | { |
564 | struct il_tx_queue *txq = &priv->txq[txq_id]; | 564 | struct il_tx_queue *txq = &il->txq[txq_id]; |
565 | struct il_queue *q = &txq->q; | 565 | struct il_queue *q = &txq->q; |
566 | int nfreed = 0; | 566 | int nfreed = 0; |
567 | 567 | ||
568 | if ((idx >= q->n_bd) || (il_queue_used(q, idx) == 0)) { | 568 | if ((idx >= q->n_bd) || (il_queue_used(q, idx) == 0)) { |
569 | IL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, " | 569 | IL_ERR(il, "Read index for DMA queue txq id (%d), index %d, " |
570 | "is out of range [0-%d] %d %d.\n", txq_id, | 570 | "is out of range [0-%d] %d %d.\n", txq_id, |
571 | idx, q->n_bd, q->write_ptr, q->read_ptr); | 571 | idx, q->n_bd, q->write_ptr, q->read_ptr); |
572 | return; | 572 | return; |
@@ -576,9 +576,9 @@ static void il_hcmd_queue_reclaim(struct il_priv *priv, int txq_id, | |||
576 | q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd)) { | 576 | q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd)) { |
577 | 577 | ||
578 | if (nfreed++ > 0) { | 578 | if (nfreed++ > 0) { |
579 | IL_ERR(priv, "HCMD skipped: index (%d) %d %d\n", idx, | 579 | IL_ERR(il, "HCMD skipped: index (%d) %d %d\n", idx, |
580 | q->write_ptr, q->read_ptr); | 580 | q->write_ptr, q->read_ptr); |
581 | queue_work(priv->workqueue, &priv->restart); | 581 | queue_work(il->workqueue, &il->restart); |
582 | } | 582 | } |
583 | 583 | ||
584 | } | 584 | } |
@@ -593,7 +593,7 @@ static void il_hcmd_queue_reclaim(struct il_priv *priv, int txq_id, | |||
593 | * if the callback returns 1 | 593 | * if the callback returns 1 |
594 | */ | 594 | */ |
595 | void | 595 | void |
596 | il_tx_cmd_complete(struct il_priv *priv, struct il_rx_mem_buffer *rxb) | 596 | il_tx_cmd_complete(struct il_priv *il, struct il_rx_mem_buffer *rxb) |
597 | { | 597 | { |
598 | struct il_rx_packet *pkt = rxb_addr(rxb); | 598 | struct il_rx_packet *pkt = rxb_addr(rxb); |
599 | u16 sequence = le16_to_cpu(pkt->hdr.sequence); | 599 | u16 sequence = le16_to_cpu(pkt->hdr.sequence); |
@@ -603,18 +603,18 @@ il_tx_cmd_complete(struct il_priv *priv, struct il_rx_mem_buffer *rxb) | |||
603 | bool huge = !!(pkt->hdr.sequence & SEQ_HUGE_FRAME); | 603 | bool huge = !!(pkt->hdr.sequence & SEQ_HUGE_FRAME); |
604 | struct il_device_cmd *cmd; | 604 | struct il_device_cmd *cmd; |
605 | struct il_cmd_meta *meta; | 605 | struct il_cmd_meta *meta; |
606 | struct il_tx_queue *txq = &priv->txq[priv->cmd_queue]; | 606 | struct il_tx_queue *txq = &il->txq[il->cmd_queue]; |
607 | unsigned long flags; | 607 | unsigned long flags; |
608 | 608 | ||
609 | /* If a Tx command is being handled and it isn't in the actual | 609 | /* If a Tx command is being handled and it isn't in the actual |
610 | * command queue then there a command routing bug has been introduced | 610 | * command queue then there a command routing bug has been introduced |
611 | * in the queue management code. */ | 611 | * in the queue management code. */ |
612 | if (WARN(txq_id != priv->cmd_queue, | 612 | if (WARN(txq_id != il->cmd_queue, |
613 | "wrong command queue %d (should be %d), sequence 0x%X readp=%d writep=%d\n", | 613 | "wrong command queue %d (should be %d), sequence 0x%X readp=%d writep=%d\n", |
614 | txq_id, priv->cmd_queue, sequence, | 614 | txq_id, il->cmd_queue, sequence, |
615 | priv->txq[priv->cmd_queue].q.read_ptr, | 615 | il->txq[il->cmd_queue].q.read_ptr, |
616 | priv->txq[priv->cmd_queue].q.write_ptr)) { | 616 | il->txq[il->cmd_queue].q.write_ptr)) { |
617 | il_print_hex_error(priv, pkt, 32); | 617 | il_print_hex_error(il, pkt, 32); |
618 | return; | 618 | return; |
619 | } | 619 | } |
620 | 620 | ||
@@ -624,7 +624,7 @@ il_tx_cmd_complete(struct il_priv *priv, struct il_rx_mem_buffer *rxb) | |||
624 | 624 | ||
625 | txq->time_stamp = jiffies; | 625 | txq->time_stamp = jiffies; |
626 | 626 | ||
627 | pci_unmap_single(priv->pci_dev, | 627 | pci_unmap_single(il->pci_dev, |
628 | dma_unmap_addr(meta, mapping), | 628 | dma_unmap_addr(meta, mapping), |
629 | dma_unmap_len(meta, len), | 629 | dma_unmap_len(meta, len), |
630 | PCI_DMA_BIDIRECTIONAL); | 630 | PCI_DMA_BIDIRECTIONAL); |
@@ -634,22 +634,22 @@ il_tx_cmd_complete(struct il_priv *priv, struct il_rx_mem_buffer *rxb) | |||
634 | meta->source->reply_page = (unsigned long)rxb_addr(rxb); | 634 | meta->source->reply_page = (unsigned long)rxb_addr(rxb); |
635 | rxb->page = NULL; | 635 | rxb->page = NULL; |
636 | } else if (meta->callback) | 636 | } else if (meta->callback) |
637 | meta->callback(priv, cmd, pkt); | 637 | meta->callback(il, cmd, pkt); |
638 | 638 | ||
639 | spin_lock_irqsave(&priv->hcmd_lock, flags); | 639 | spin_lock_irqsave(&il->hcmd_lock, flags); |
640 | 640 | ||
641 | il_hcmd_queue_reclaim(priv, txq_id, index, cmd_index); | 641 | il_hcmd_queue_reclaim(il, txq_id, index, cmd_index); |
642 | 642 | ||
643 | if (!(meta->flags & CMD_ASYNC)) { | 643 | if (!(meta->flags & CMD_ASYNC)) { |
644 | clear_bit(STATUS_HCMD_ACTIVE, &priv->status); | 644 | clear_bit(STATUS_HCMD_ACTIVE, &il->status); |
645 | IL_DEBUG_INFO(priv, "Clearing HCMD_ACTIVE for command %s\n", | 645 | IL_DEBUG_INFO(il, "Clearing HCMD_ACTIVE for command %s\n", |
646 | il_get_cmd_string(cmd->hdr.cmd)); | 646 | il_get_cmd_string(cmd->hdr.cmd)); |
647 | wake_up(&priv->wait_command_queue); | 647 | wake_up(&il->wait_command_queue); |
648 | } | 648 | } |
649 | 649 | ||
650 | /* Mark as unmapped */ | 650 | /* Mark as unmapped */ |
651 | meta->flags = 0; | 651 | meta->flags = 0; |
652 | 652 | ||
653 | spin_unlock_irqrestore(&priv->hcmd_lock, flags); | 653 | spin_unlock_irqrestore(&il->hcmd_lock, flags); |
654 | } | 654 | } |
655 | EXPORT_SYMBOL(il_tx_cmd_complete); | 655 | 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 d24937a0014..2c336a701dc 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 = { | |||
98 | 98 | ||
99 | /** | 99 | /** |
100 | * il3945_get_antenna_flags - Get antenna flags for RXON command | 100 | * il3945_get_antenna_flags - Get antenna flags for RXON command |
101 | * @priv: eeprom and antenna fields are used to determine antenna flags | 101 | * @il: eeprom and antenna fields are used to determine antenna flags |
102 | * | 102 | * |
103 | * priv->eeprom39 is used to determine if antenna AUX/MAIN are reversed | 103 | * il->eeprom39 is used to determine if antenna AUX/MAIN are reversed |
104 | * il3945_mod_params.antenna specifies the antenna diversity mode: | 104 | * il3945_mod_params.antenna specifies the antenna diversity mode: |
105 | * | 105 | * |
106 | * IL_ANTENNA_DIVERSITY - NIC selects best antenna by itself | 106 | * IL_ANTENNA_DIVERSITY - NIC selects best antenna by itself |
107 | * IL_ANTENNA_MAIN - Force MAIN antenna | 107 | * IL_ANTENNA_MAIN - Force MAIN antenna |
108 | * IL_ANTENNA_AUX - Force AUX antenna | 108 | * IL_ANTENNA_AUX - Force AUX antenna |
109 | */ | 109 | */ |
110 | __le32 il3945_get_antenna_flags(const struct il_priv *priv) | 110 | __le32 il3945_get_antenna_flags(const struct il_priv *il) |
111 | { | 111 | { |
112 | struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; | 112 | struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; |
113 | 113 | ||
114 | switch (il3945_mod_params.antenna) { | 114 | switch (il3945_mod_params.antenna) { |
115 | case IL_ANTENNA_DIVERSITY: | 115 | case IL_ANTENNA_DIVERSITY: |
@@ -127,13 +127,13 @@ __le32 il3945_get_antenna_flags(const struct il_priv *priv) | |||
127 | } | 127 | } |
128 | 128 | ||
129 | /* bad antenna selector value */ | 129 | /* bad antenna selector value */ |
130 | IL_ERR(priv, "Bad antenna selector value (0x%x)\n", | 130 | IL_ERR(il, "Bad antenna selector value (0x%x)\n", |
131 | il3945_mod_params.antenna); | 131 | il3945_mod_params.antenna); |
132 | 132 | ||
133 | return 0; /* "diversity" is default if error */ | 133 | return 0; /* "diversity" is default if error */ |
134 | } | 134 | } |
135 | 135 | ||
136 | static int il3945_set_ccmp_dynamic_key_info(struct il_priv *priv, | 136 | static int il3945_set_ccmp_dynamic_key_info(struct il_priv *il, |
137 | struct ieee80211_key_conf *keyconf, | 137 | struct ieee80211_key_conf *keyconf, |
138 | u8 sta_id) | 138 | u8 sta_id) |
139 | { | 139 | { |
@@ -144,80 +144,80 @@ static int il3945_set_ccmp_dynamic_key_info(struct il_priv *priv, | |||
144 | key_flags |= (STA_KEY_FLG_CCMP | STA_KEY_FLG_MAP_KEY_MSK); | 144 | key_flags |= (STA_KEY_FLG_CCMP | STA_KEY_FLG_MAP_KEY_MSK); |
145 | key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); | 145 | key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); |
146 | 146 | ||
147 | if (sta_id == priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id) | 147 | if (sta_id == il->contexts[IL_RXON_CTX_BSS].bcast_sta_id) |
148 | key_flags |= STA_KEY_MULTICAST_MSK; | 148 | key_flags |= STA_KEY_MULTICAST_MSK; |
149 | 149 | ||
150 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; | 150 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; |
151 | keyconf->hw_key_idx = keyconf->keyidx; | 151 | keyconf->hw_key_idx = keyconf->keyidx; |
152 | key_flags &= ~STA_KEY_FLG_INVALID; | 152 | key_flags &= ~STA_KEY_FLG_INVALID; |
153 | 153 | ||
154 | spin_lock_irqsave(&priv->sta_lock, flags); | 154 | spin_lock_irqsave(&il->sta_lock, flags); |
155 | priv->stations[sta_id].keyinfo.cipher = keyconf->cipher; | 155 | il->stations[sta_id].keyinfo.cipher = keyconf->cipher; |
156 | priv->stations[sta_id].keyinfo.keylen = keyconf->keylen; | 156 | il->stations[sta_id].keyinfo.keylen = keyconf->keylen; |
157 | memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, | 157 | memcpy(il->stations[sta_id].keyinfo.key, keyconf->key, |
158 | keyconf->keylen); | 158 | keyconf->keylen); |
159 | 159 | ||
160 | memcpy(priv->stations[sta_id].sta.key.key, keyconf->key, | 160 | memcpy(il->stations[sta_id].sta.key.key, keyconf->key, |
161 | keyconf->keylen); | 161 | keyconf->keylen); |
162 | 162 | ||
163 | if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK) | 163 | if ((il->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK) |
164 | == STA_KEY_FLG_NO_ENC) | 164 | == STA_KEY_FLG_NO_ENC) |
165 | priv->stations[sta_id].sta.key.key_offset = | 165 | il->stations[sta_id].sta.key.key_offset = |
166 | il_get_free_ucode_key_index(priv); | 166 | il_get_free_ucode_key_index(il); |
167 | /* else, we are overriding an existing key => no need to allocated room | 167 | /* else, we are overriding an existing key => no need to allocated room |
168 | * in uCode. */ | 168 | * in uCode. */ |
169 | 169 | ||
170 | WARN(priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET, | 170 | WARN(il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET, |
171 | "no space for a new key"); | 171 | "no space for a new key"); |
172 | 172 | ||
173 | priv->stations[sta_id].sta.key.key_flags = key_flags; | 173 | il->stations[sta_id].sta.key.key_flags = key_flags; |
174 | priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; | 174 | il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; |
175 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | 175 | il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; |
176 | 176 | ||
177 | IL_DEBUG_INFO(priv, "hwcrypto: modify ucode station key info\n"); | 177 | IL_DEBUG_INFO(il, "hwcrypto: modify ucode station key info\n"); |
178 | 178 | ||
179 | ret = il_send_add_sta(priv, | 179 | ret = il_send_add_sta(il, |
180 | &priv->stations[sta_id].sta, CMD_ASYNC); | 180 | &il->stations[sta_id].sta, CMD_ASYNC); |
181 | 181 | ||
182 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 182 | spin_unlock_irqrestore(&il->sta_lock, flags); |
183 | 183 | ||
184 | return ret; | 184 | return ret; |
185 | } | 185 | } |
186 | 186 | ||
187 | static int il3945_set_tkip_dynamic_key_info(struct il_priv *priv, | 187 | static int il3945_set_tkip_dynamic_key_info(struct il_priv *il, |
188 | struct ieee80211_key_conf *keyconf, | 188 | struct ieee80211_key_conf *keyconf, |
189 | u8 sta_id) | 189 | u8 sta_id) |
190 | { | 190 | { |
191 | return -EOPNOTSUPP; | 191 | return -EOPNOTSUPP; |
192 | } | 192 | } |
193 | 193 | ||
194 | static int il3945_set_wep_dynamic_key_info(struct il_priv *priv, | 194 | static int il3945_set_wep_dynamic_key_info(struct il_priv *il, |
195 | struct ieee80211_key_conf *keyconf, | 195 | struct ieee80211_key_conf *keyconf, |
196 | u8 sta_id) | 196 | u8 sta_id) |
197 | { | 197 | { |
198 | return -EOPNOTSUPP; | 198 | return -EOPNOTSUPP; |
199 | } | 199 | } |
200 | 200 | ||
201 | static int il3945_clear_sta_key_info(struct il_priv *priv, u8 sta_id) | 201 | static int il3945_clear_sta_key_info(struct il_priv *il, u8 sta_id) |
202 | { | 202 | { |
203 | unsigned long flags; | 203 | unsigned long flags; |
204 | struct il_addsta_cmd sta_cmd; | 204 | struct il_addsta_cmd sta_cmd; |
205 | 205 | ||
206 | spin_lock_irqsave(&priv->sta_lock, flags); | 206 | spin_lock_irqsave(&il->sta_lock, flags); |
207 | memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct il_hw_key)); | 207 | memset(&il->stations[sta_id].keyinfo, 0, sizeof(struct il_hw_key)); |
208 | memset(&priv->stations[sta_id].sta.key, 0, | 208 | memset(&il->stations[sta_id].sta.key, 0, |
209 | sizeof(struct il4965_keyinfo)); | 209 | sizeof(struct il4965_keyinfo)); |
210 | priv->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC; | 210 | il->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC; |
211 | priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; | 211 | il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; |
212 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | 212 | il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; |
213 | memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct il_addsta_cmd)); | 213 | memcpy(&sta_cmd, &il->stations[sta_id].sta, sizeof(struct il_addsta_cmd)); |
214 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 214 | spin_unlock_irqrestore(&il->sta_lock, flags); |
215 | 215 | ||
216 | IL_DEBUG_INFO(priv, "hwcrypto: clear ucode station key info\n"); | 216 | IL_DEBUG_INFO(il, "hwcrypto: clear ucode station key info\n"); |
217 | return il_send_add_sta(priv, &sta_cmd, CMD_SYNC); | 217 | return il_send_add_sta(il, &sta_cmd, CMD_SYNC); |
218 | } | 218 | } |
219 | 219 | ||
220 | static int il3945_set_dynamic_key(struct il_priv *priv, | 220 | static int il3945_set_dynamic_key(struct il_priv *il, |
221 | struct ieee80211_key_conf *keyconf, u8 sta_id) | 221 | struct ieee80211_key_conf *keyconf, u8 sta_id) |
222 | { | 222 | { |
223 | int ret = 0; | 223 | int ret = 0; |
@@ -226,154 +226,154 @@ static int il3945_set_dynamic_key(struct il_priv *priv, | |||
226 | 226 | ||
227 | switch (keyconf->cipher) { | 227 | switch (keyconf->cipher) { |
228 | case WLAN_CIPHER_SUITE_CCMP: | 228 | case WLAN_CIPHER_SUITE_CCMP: |
229 | ret = il3945_set_ccmp_dynamic_key_info(priv, keyconf, sta_id); | 229 | ret = il3945_set_ccmp_dynamic_key_info(il, keyconf, sta_id); |
230 | break; | 230 | break; |
231 | case WLAN_CIPHER_SUITE_TKIP: | 231 | case WLAN_CIPHER_SUITE_TKIP: |
232 | ret = il3945_set_tkip_dynamic_key_info(priv, keyconf, sta_id); | 232 | ret = il3945_set_tkip_dynamic_key_info(il, keyconf, sta_id); |
233 | break; | 233 | break; |
234 | case WLAN_CIPHER_SUITE_WEP40: | 234 | case WLAN_CIPHER_SUITE_WEP40: |
235 | case WLAN_CIPHER_SUITE_WEP104: | 235 | case WLAN_CIPHER_SUITE_WEP104: |
236 | ret = il3945_set_wep_dynamic_key_info(priv, keyconf, sta_id); | 236 | ret = il3945_set_wep_dynamic_key_info(il, keyconf, sta_id); |
237 | break; | 237 | break; |
238 | default: | 238 | default: |
239 | IL_ERR(priv, "Unknown alg: %s alg=%x\n", __func__, | 239 | IL_ERR(il, "Unknown alg: %s alg=%x\n", __func__, |
240 | keyconf->cipher); | 240 | keyconf->cipher); |
241 | ret = -EINVAL; | 241 | ret = -EINVAL; |
242 | } | 242 | } |
243 | 243 | ||
244 | IL_DEBUG_WEP(priv, "Set dynamic key: alg=%x len=%d idx=%d sta=%d ret=%d\n", | 244 | IL_DEBUG_WEP(il, "Set dynamic key: alg=%x len=%d idx=%d sta=%d ret=%d\n", |
245 | keyconf->cipher, keyconf->keylen, keyconf->keyidx, | 245 | keyconf->cipher, keyconf->keylen, keyconf->keyidx, |
246 | sta_id, ret); | 246 | sta_id, ret); |
247 | 247 | ||
248 | return ret; | 248 | return ret; |
249 | } | 249 | } |
250 | 250 | ||
251 | static int il3945_remove_static_key(struct il_priv *priv) | 251 | static int il3945_remove_static_key(struct il_priv *il) |
252 | { | 252 | { |
253 | int ret = -EOPNOTSUPP; | 253 | int ret = -EOPNOTSUPP; |
254 | 254 | ||
255 | return ret; | 255 | return ret; |
256 | } | 256 | } |
257 | 257 | ||
258 | static int il3945_set_static_key(struct il_priv *priv, | 258 | static int il3945_set_static_key(struct il_priv *il, |
259 | struct ieee80211_key_conf *key) | 259 | struct ieee80211_key_conf *key) |
260 | { | 260 | { |
261 | if (key->cipher == WLAN_CIPHER_SUITE_WEP40 || | 261 | if (key->cipher == WLAN_CIPHER_SUITE_WEP40 || |
262 | key->cipher == WLAN_CIPHER_SUITE_WEP104) | 262 | key->cipher == WLAN_CIPHER_SUITE_WEP104) |
263 | return -EOPNOTSUPP; | 263 | return -EOPNOTSUPP; |
264 | 264 | ||
265 | IL_ERR(priv, "Static key invalid: cipher %x\n", key->cipher); | 265 | IL_ERR(il, "Static key invalid: cipher %x\n", key->cipher); |
266 | return -EINVAL; | 266 | return -EINVAL; |
267 | } | 267 | } |
268 | 268 | ||
269 | static void il3945_clear_free_frames(struct il_priv *priv) | 269 | static void il3945_clear_free_frames(struct il_priv *il) |
270 | { | 270 | { |
271 | struct list_head *element; | 271 | struct list_head *element; |
272 | 272 | ||
273 | IL_DEBUG_INFO(priv, "%d frames on pre-allocated heap on clear.\n", | 273 | IL_DEBUG_INFO(il, "%d frames on pre-allocated heap on clear.\n", |
274 | priv->frames_count); | 274 | il->frames_count); |
275 | 275 | ||
276 | while (!list_empty(&priv->free_frames)) { | 276 | while (!list_empty(&il->free_frames)) { |
277 | element = priv->free_frames.next; | 277 | element = il->free_frames.next; |
278 | list_del(element); | 278 | list_del(element); |
279 | kfree(list_entry(element, struct il3945_frame, list)); | 279 | kfree(list_entry(element, struct il3945_frame, list)); |
280 | priv->frames_count--; | 280 | il->frames_count--; |
281 | } | 281 | } |
282 | 282 | ||
283 | if (priv->frames_count) { | 283 | if (il->frames_count) { |
284 | IL_WARN(priv, "%d frames still in use. Did we lose one?\n", | 284 | IL_WARN(il, "%d frames still in use. Did we lose one?\n", |
285 | priv->frames_count); | 285 | il->frames_count); |
286 | priv->frames_count = 0; | 286 | il->frames_count = 0; |
287 | } | 287 | } |
288 | } | 288 | } |
289 | 289 | ||
290 | static struct il3945_frame *il3945_get_free_frame(struct il_priv *priv) | 290 | static struct il3945_frame *il3945_get_free_frame(struct il_priv *il) |
291 | { | 291 | { |
292 | struct il3945_frame *frame; | 292 | struct il3945_frame *frame; |
293 | struct list_head *element; | 293 | struct list_head *element; |
294 | if (list_empty(&priv->free_frames)) { | 294 | if (list_empty(&il->free_frames)) { |
295 | frame = kzalloc(sizeof(*frame), GFP_KERNEL); | 295 | frame = kzalloc(sizeof(*frame), GFP_KERNEL); |
296 | if (!frame) { | 296 | if (!frame) { |
297 | IL_ERR(priv, "Could not allocate frame!\n"); | 297 | IL_ERR(il, "Could not allocate frame!\n"); |
298 | return NULL; | 298 | return NULL; |
299 | } | 299 | } |
300 | 300 | ||
301 | priv->frames_count++; | 301 | il->frames_count++; |
302 | return frame; | 302 | return frame; |
303 | } | 303 | } |
304 | 304 | ||
305 | element = priv->free_frames.next; | 305 | element = il->free_frames.next; |
306 | list_del(element); | 306 | list_del(element); |
307 | return list_entry(element, struct il3945_frame, list); | 307 | return list_entry(element, struct il3945_frame, list); |
308 | } | 308 | } |
309 | 309 | ||
310 | static void il3945_free_frame(struct il_priv *priv, struct il3945_frame *frame) | 310 | static void il3945_free_frame(struct il_priv *il, struct il3945_frame *frame) |
311 | { | 311 | { |
312 | memset(frame, 0, sizeof(*frame)); | 312 | memset(frame, 0, sizeof(*frame)); |
313 | list_add(&frame->list, &priv->free_frames); | 313 | list_add(&frame->list, &il->free_frames); |
314 | } | 314 | } |
315 | 315 | ||
316 | unsigned int il3945_fill_beacon_frame(struct il_priv *priv, | 316 | unsigned int il3945_fill_beacon_frame(struct il_priv *il, |
317 | struct ieee80211_hdr *hdr, | 317 | struct ieee80211_hdr *hdr, |
318 | int left) | 318 | int left) |
319 | { | 319 | { |
320 | 320 | ||
321 | if (!il_is_associated(priv, IL_RXON_CTX_BSS) || !priv->beacon_skb) | 321 | if (!il_is_associated(il, IL_RXON_CTX_BSS) || !il->beacon_skb) |
322 | return 0; | 322 | return 0; |
323 | 323 | ||
324 | if (priv->beacon_skb->len > left) | 324 | if (il->beacon_skb->len > left) |
325 | return 0; | 325 | return 0; |
326 | 326 | ||
327 | memcpy(hdr, priv->beacon_skb->data, priv->beacon_skb->len); | 327 | memcpy(hdr, il->beacon_skb->data, il->beacon_skb->len); |
328 | 328 | ||
329 | return priv->beacon_skb->len; | 329 | return il->beacon_skb->len; |
330 | } | 330 | } |
331 | 331 | ||
332 | static int il3945_send_beacon_cmd(struct il_priv *priv) | 332 | static int il3945_send_beacon_cmd(struct il_priv *il) |
333 | { | 333 | { |
334 | struct il3945_frame *frame; | 334 | struct il3945_frame *frame; |
335 | unsigned int frame_size; | 335 | unsigned int frame_size; |
336 | int rc; | 336 | int rc; |
337 | u8 rate; | 337 | u8 rate; |
338 | 338 | ||
339 | frame = il3945_get_free_frame(priv); | 339 | frame = il3945_get_free_frame(il); |
340 | 340 | ||
341 | if (!frame) { | 341 | if (!frame) { |
342 | IL_ERR(priv, "Could not obtain free frame buffer for beacon " | 342 | IL_ERR(il, "Could not obtain free frame buffer for beacon " |
343 | "command.\n"); | 343 | "command.\n"); |
344 | return -ENOMEM; | 344 | return -ENOMEM; |
345 | } | 345 | } |
346 | 346 | ||
347 | rate = il_get_lowest_plcp(priv, | 347 | rate = il_get_lowest_plcp(il, |
348 | &priv->contexts[IL_RXON_CTX_BSS]); | 348 | &il->contexts[IL_RXON_CTX_BSS]); |
349 | 349 | ||
350 | frame_size = il3945_hw_get_beacon_cmd(priv, frame, rate); | 350 | frame_size = il3945_hw_get_beacon_cmd(il, frame, rate); |
351 | 351 | ||
352 | rc = il_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, | 352 | rc = il_send_cmd_pdu(il, REPLY_TX_BEACON, frame_size, |
353 | &frame->u.cmd[0]); | 353 | &frame->u.cmd[0]); |
354 | 354 | ||
355 | il3945_free_frame(priv, frame); | 355 | il3945_free_frame(il, frame); |
356 | 356 | ||
357 | return rc; | 357 | return rc; |
358 | } | 358 | } |
359 | 359 | ||
360 | static void il3945_unset_hw_params(struct il_priv *priv) | 360 | static void il3945_unset_hw_params(struct il_priv *il) |
361 | { | 361 | { |
362 | if (priv->_3945.shared_virt) | 362 | if (il->_3945.shared_virt) |
363 | dma_free_coherent(&priv->pci_dev->dev, | 363 | dma_free_coherent(&il->pci_dev->dev, |
364 | sizeof(struct il3945_shared), | 364 | sizeof(struct il3945_shared), |
365 | priv->_3945.shared_virt, | 365 | il->_3945.shared_virt, |
366 | priv->_3945.shared_phys); | 366 | il->_3945.shared_phys); |
367 | } | 367 | } |
368 | 368 | ||
369 | static void il3945_build_tx_cmd_hwcrypto(struct il_priv *priv, | 369 | static void il3945_build_tx_cmd_hwcrypto(struct il_priv *il, |
370 | struct ieee80211_tx_info *info, | 370 | struct ieee80211_tx_info *info, |
371 | struct il_device_cmd *cmd, | 371 | struct il_device_cmd *cmd, |
372 | struct sk_buff *skb_frag, | 372 | struct sk_buff *skb_frag, |
373 | int sta_id) | 373 | int sta_id) |
374 | { | 374 | { |
375 | struct il3945_tx_cmd *tx_cmd = (struct il3945_tx_cmd *)cmd->cmd.payload; | 375 | struct il3945_tx_cmd *tx_cmd = (struct il3945_tx_cmd *)cmd->cmd.payload; |
376 | struct il_hw_key *keyinfo = &priv->stations[sta_id].keyinfo; | 376 | struct il_hw_key *keyinfo = &il->stations[sta_id].keyinfo; |
377 | 377 | ||
378 | tx_cmd->sec_ctl = 0; | 378 | tx_cmd->sec_ctl = 0; |
379 | 379 | ||
@@ -381,7 +381,7 @@ static void il3945_build_tx_cmd_hwcrypto(struct il_priv *priv, | |||
381 | case WLAN_CIPHER_SUITE_CCMP: | 381 | case WLAN_CIPHER_SUITE_CCMP: |
382 | tx_cmd->sec_ctl = TX_CMD_SEC_CCM; | 382 | tx_cmd->sec_ctl = TX_CMD_SEC_CCM; |
383 | memcpy(tx_cmd->key, keyinfo->key, keyinfo->keylen); | 383 | memcpy(tx_cmd->key, keyinfo->key, keyinfo->keylen); |
384 | IL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n"); | 384 | IL_DEBUG_TX(il, "tx_cmd with AES hwcrypto\n"); |
385 | break; | 385 | break; |
386 | 386 | ||
387 | case WLAN_CIPHER_SUITE_TKIP: | 387 | case WLAN_CIPHER_SUITE_TKIP: |
@@ -396,12 +396,12 @@ static void il3945_build_tx_cmd_hwcrypto(struct il_priv *priv, | |||
396 | 396 | ||
397 | memcpy(&tx_cmd->key[3], keyinfo->key, keyinfo->keylen); | 397 | memcpy(&tx_cmd->key[3], keyinfo->key, keyinfo->keylen); |
398 | 398 | ||
399 | IL_DEBUG_TX(priv, "Configuring packet for WEP encryption " | 399 | IL_DEBUG_TX(il, "Configuring packet for WEP encryption " |
400 | "with key %d\n", info->control.hw_key->hw_key_idx); | 400 | "with key %d\n", info->control.hw_key->hw_key_idx); |
401 | break; | 401 | break; |
402 | 402 | ||
403 | default: | 403 | default: |
404 | IL_ERR(priv, "Unknown encode cipher %x\n", keyinfo->cipher); | 404 | IL_ERR(il, "Unknown encode cipher %x\n", keyinfo->cipher); |
405 | break; | 405 | break; |
406 | } | 406 | } |
407 | } | 407 | } |
@@ -409,7 +409,7 @@ static void il3945_build_tx_cmd_hwcrypto(struct il_priv *priv, | |||
409 | /* | 409 | /* |
410 | * handle build REPLY_TX command notification. | 410 | * handle build REPLY_TX command notification. |
411 | */ | 411 | */ |
412 | static void il3945_build_tx_cmd_basic(struct il_priv *priv, | 412 | static void il3945_build_tx_cmd_basic(struct il_priv *il, |
413 | struct il_device_cmd *cmd, | 413 | struct il_device_cmd *cmd, |
414 | struct ieee80211_tx_info *info, | 414 | struct ieee80211_tx_info *info, |
415 | struct ieee80211_hdr *hdr, u8 std_id) | 415 | struct ieee80211_hdr *hdr, u8 std_id) |
@@ -443,7 +443,7 @@ static void il3945_build_tx_cmd_basic(struct il_priv *priv, | |||
443 | tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; | 443 | tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; |
444 | } | 444 | } |
445 | 445 | ||
446 | il_tx_cmd_protection(priv, info, fc, &tx_flags); | 446 | il_tx_cmd_protection(il, info, fc, &tx_flags); |
447 | 447 | ||
448 | tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK); | 448 | tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK); |
449 | if (ieee80211_is_mgmt(fc)) { | 449 | if (ieee80211_is_mgmt(fc)) { |
@@ -463,7 +463,7 @@ static void il3945_build_tx_cmd_basic(struct il_priv *priv, | |||
463 | /* | 463 | /* |
464 | * start REPLY_TX command process | 464 | * start REPLY_TX command process |
465 | */ | 465 | */ |
466 | static int il3945_tx_skb(struct il_priv *priv, struct sk_buff *skb) | 466 | static int il3945_tx_skb(struct il_priv *il, struct sk_buff *skb) |
467 | { | 467 | { |
468 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 468 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
469 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 469 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
@@ -484,14 +484,14 @@ static int il3945_tx_skb(struct il_priv *priv, struct sk_buff *skb) | |||
484 | u8 wait_write_ptr = 0; | 484 | u8 wait_write_ptr = 0; |
485 | unsigned long flags; | 485 | unsigned long flags; |
486 | 486 | ||
487 | spin_lock_irqsave(&priv->lock, flags); | 487 | spin_lock_irqsave(&il->lock, flags); |
488 | if (il_is_rfkill(priv)) { | 488 | if (il_is_rfkill(il)) { |
489 | IL_DEBUG_DROP(priv, "Dropping - RF KILL\n"); | 489 | IL_DEBUG_DROP(il, "Dropping - RF KILL\n"); |
490 | goto drop_unlock; | 490 | goto drop_unlock; |
491 | } | 491 | } |
492 | 492 | ||
493 | if ((ieee80211_get_tx_rate(priv->hw, info)->hw_value & 0xFF) == IL_INVALID_RATE) { | 493 | if ((ieee80211_get_tx_rate(il->hw, info)->hw_value & 0xFF) == IL_INVALID_RATE) { |
494 | IL_ERR(priv, "ERROR: No TX rate available.\n"); | 494 | IL_ERR(il, "ERROR: No TX rate available.\n"); |
495 | goto drop_unlock; | 495 | goto drop_unlock; |
496 | } | 496 | } |
497 | 497 | ||
@@ -502,28 +502,28 @@ static int il3945_tx_skb(struct il_priv *priv, struct sk_buff *skb) | |||
502 | 502 | ||
503 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 503 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
504 | if (ieee80211_is_auth(fc)) | 504 | if (ieee80211_is_auth(fc)) |
505 | IL_DEBUG_TX(priv, "Sending AUTH frame\n"); | 505 | IL_DEBUG_TX(il, "Sending AUTH frame\n"); |
506 | else if (ieee80211_is_assoc_req(fc)) | 506 | else if (ieee80211_is_assoc_req(fc)) |
507 | IL_DEBUG_TX(priv, "Sending ASSOC frame\n"); | 507 | IL_DEBUG_TX(il, "Sending ASSOC frame\n"); |
508 | else if (ieee80211_is_reassoc_req(fc)) | 508 | else if (ieee80211_is_reassoc_req(fc)) |
509 | IL_DEBUG_TX(priv, "Sending REASSOC frame\n"); | 509 | IL_DEBUG_TX(il, "Sending REASSOC frame\n"); |
510 | #endif | 510 | #endif |
511 | 511 | ||
512 | spin_unlock_irqrestore(&priv->lock, flags); | 512 | spin_unlock_irqrestore(&il->lock, flags); |
513 | 513 | ||
514 | hdr_len = ieee80211_hdrlen(fc); | 514 | hdr_len = ieee80211_hdrlen(fc); |
515 | 515 | ||
516 | /* Find index into station table for destination station */ | 516 | /* Find index into station table for destination station */ |
517 | sta_id = il_sta_id_or_broadcast( | 517 | sta_id = il_sta_id_or_broadcast( |
518 | priv, &priv->contexts[IL_RXON_CTX_BSS], | 518 | il, &il->contexts[IL_RXON_CTX_BSS], |
519 | info->control.sta); | 519 | info->control.sta); |
520 | if (sta_id == IL_INVALID_STATION) { | 520 | if (sta_id == IL_INVALID_STATION) { |
521 | IL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", | 521 | IL_DEBUG_DROP(il, "Dropping - INVALID STATION: %pM\n", |
522 | hdr->addr1); | 522 | hdr->addr1); |
523 | goto drop; | 523 | goto drop; |
524 | } | 524 | } |
525 | 525 | ||
526 | IL_DEBUG_RATE(priv, "station Id %d\n", sta_id); | 526 | IL_DEBUG_RATE(il, "station Id %d\n", sta_id); |
527 | 527 | ||
528 | if (ieee80211_is_data_qos(fc)) { | 528 | if (ieee80211_is_data_qos(fc)) { |
529 | u8 *qc = ieee80211_get_qos_ctl(hdr); | 529 | u8 *qc = ieee80211_get_qos_ctl(hdr); |
@@ -533,20 +533,20 @@ static int il3945_tx_skb(struct il_priv *priv, struct sk_buff *skb) | |||
533 | } | 533 | } |
534 | 534 | ||
535 | /* Descriptor for chosen Tx queue */ | 535 | /* Descriptor for chosen Tx queue */ |
536 | txq = &priv->txq[txq_id]; | 536 | txq = &il->txq[txq_id]; |
537 | q = &txq->q; | 537 | q = &txq->q; |
538 | 538 | ||
539 | if ((il_queue_space(q) < q->high_mark)) | 539 | if ((il_queue_space(q) < q->high_mark)) |
540 | goto drop; | 540 | goto drop; |
541 | 541 | ||
542 | spin_lock_irqsave(&priv->lock, flags); | 542 | spin_lock_irqsave(&il->lock, flags); |
543 | 543 | ||
544 | idx = il_get_cmd_index(q, q->write_ptr, 0); | 544 | idx = il_get_cmd_index(q, q->write_ptr, 0); |
545 | 545 | ||
546 | /* Set up driver data for this TFD */ | 546 | /* Set up driver data for this TFD */ |
547 | memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct il_tx_info)); | 547 | memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct il_tx_info)); |
548 | txq->txb[q->write_ptr].skb = skb; | 548 | txq->txb[q->write_ptr].skb = skb; |
549 | txq->txb[q->write_ptr].ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 549 | txq->txb[q->write_ptr].ctx = &il->contexts[IL_RXON_CTX_BSS]; |
550 | 550 | ||
551 | /* Init first empty entry in queue's array of Tx/cmd buffers */ | 551 | /* Init first empty entry in queue's array of Tx/cmd buffers */ |
552 | out_cmd = txq->cmd[idx]; | 552 | out_cmd = txq->cmd[idx]; |
@@ -570,20 +570,20 @@ static int il3945_tx_skb(struct il_priv *priv, struct sk_buff *skb) | |||
570 | 570 | ||
571 | 571 | ||
572 | if (info->control.hw_key) | 572 | if (info->control.hw_key) |
573 | il3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, sta_id); | 573 | il3945_build_tx_cmd_hwcrypto(il, info, out_cmd, skb, sta_id); |
574 | 574 | ||
575 | /* TODO need this for burst mode later on */ | 575 | /* TODO need this for burst mode later on */ |
576 | il3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, sta_id); | 576 | il3945_build_tx_cmd_basic(il, out_cmd, info, hdr, sta_id); |
577 | 577 | ||
578 | /* set is_hcca to 0; it probably will never be implemented */ | 578 | /* set is_hcca to 0; it probably will never be implemented */ |
579 | il3945_hw_build_tx_cmd_rate(priv, out_cmd, info, hdr, sta_id, 0); | 579 | il3945_hw_build_tx_cmd_rate(il, out_cmd, info, hdr, sta_id, 0); |
580 | 580 | ||
581 | /* Total # bytes to be transmitted */ | 581 | /* Total # bytes to be transmitted */ |
582 | len = (u16)skb->len; | 582 | len = (u16)skb->len; |
583 | tx_cmd->len = cpu_to_le16(len); | 583 | tx_cmd->len = cpu_to_le16(len); |
584 | 584 | ||
585 | il_dbg_log_tx_data_frame(priv, len, hdr); | 585 | il_dbg_log_tx_data_frame(il, len, hdr); |
586 | il_update_stats(priv, true, fc, len); | 586 | il_update_stats(il, true, fc, len); |
587 | tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK; | 587 | tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK; |
588 | tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK; | 588 | tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK; |
589 | 589 | ||
@@ -594,11 +594,11 @@ static int il3945_tx_skb(struct il_priv *priv, struct sk_buff *skb) | |||
594 | txq->need_update = 0; | 594 | txq->need_update = 0; |
595 | } | 595 | } |
596 | 596 | ||
597 | IL_DEBUG_TX(priv, "sequence nr = 0X%x\n", | 597 | IL_DEBUG_TX(il, "sequence nr = 0X%x\n", |
598 | le16_to_cpu(out_cmd->hdr.sequence)); | 598 | le16_to_cpu(out_cmd->hdr.sequence)); |
599 | IL_DEBUG_TX(priv, "tx_flags = 0X%x\n", le32_to_cpu(tx_cmd->tx_flags)); | 599 | IL_DEBUG_TX(il, "tx_flags = 0X%x\n", le32_to_cpu(tx_cmd->tx_flags)); |
600 | il_print_hex_dump(priv, IL_DL_TX, tx_cmd, sizeof(*tx_cmd)); | 600 | il_print_hex_dump(il, IL_DL_TX, tx_cmd, sizeof(*tx_cmd)); |
601 | il_print_hex_dump(priv, IL_DL_TX, (u8 *)tx_cmd->hdr, | 601 | il_print_hex_dump(il, IL_DL_TX, (u8 *)tx_cmd->hdr, |
602 | ieee80211_hdrlen(fc)); | 602 | ieee80211_hdrlen(fc)); |
603 | 603 | ||
604 | /* | 604 | /* |
@@ -616,7 +616,7 @@ static int il3945_tx_skb(struct il_priv *priv, struct sk_buff *skb) | |||
616 | 616 | ||
617 | /* Physical address of this Tx command's header (not MAC header!), | 617 | /* Physical address of this Tx command's header (not MAC header!), |
618 | * within command buffer array. */ | 618 | * within command buffer array. */ |
619 | txcmd_phys = pci_map_single(priv->pci_dev, &out_cmd->hdr, | 619 | txcmd_phys = pci_map_single(il->pci_dev, &out_cmd->hdr, |
620 | len, PCI_DMA_TODEVICE); | 620 | len, PCI_DMA_TODEVICE); |
621 | /* we do not map meta data ... so we can safely access address to | 621 | /* we do not map meta data ... so we can safely access address to |
622 | * provide to unmap command*/ | 622 | * provide to unmap command*/ |
@@ -625,7 +625,7 @@ static int il3945_tx_skb(struct il_priv *priv, struct sk_buff *skb) | |||
625 | 625 | ||
626 | /* Add buffer containing Tx command and MAC(!) header to TFD's | 626 | /* Add buffer containing Tx command and MAC(!) header to TFD's |
627 | * first entry */ | 627 | * first entry */ |
628 | priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq, | 628 | il->cfg->ops->lib->txq_attach_buf_to_tfd(il, txq, |
629 | txcmd_phys, len, 1, 0); | 629 | txcmd_phys, len, 1, 0); |
630 | 630 | ||
631 | 631 | ||
@@ -633,9 +633,9 @@ static int il3945_tx_skb(struct il_priv *priv, struct sk_buff *skb) | |||
633 | * if any (802.11 null frames have no payload). */ | 633 | * if any (802.11 null frames have no payload). */ |
634 | len = skb->len - hdr_len; | 634 | len = skb->len - hdr_len; |
635 | if (len) { | 635 | if (len) { |
636 | phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len, | 636 | phys_addr = pci_map_single(il->pci_dev, skb->data + hdr_len, |
637 | len, PCI_DMA_TODEVICE); | 637 | len, PCI_DMA_TODEVICE); |
638 | priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq, | 638 | il->cfg->ops->lib->txq_attach_buf_to_tfd(il, txq, |
639 | phys_addr, len, | 639 | phys_addr, len, |
640 | 0, U32_PAD(len)); | 640 | 0, U32_PAD(len)); |
641 | } | 641 | } |
@@ -643,30 +643,30 @@ static int il3945_tx_skb(struct il_priv *priv, struct sk_buff *skb) | |||
643 | 643 | ||
644 | /* Tell device the write index *just past* this latest filled TFD */ | 644 | /* Tell device the write index *just past* this latest filled TFD */ |
645 | q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd); | 645 | q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd); |
646 | il_txq_update_write_ptr(priv, txq); | 646 | il_txq_update_write_ptr(il, txq); |
647 | spin_unlock_irqrestore(&priv->lock, flags); | 647 | spin_unlock_irqrestore(&il->lock, flags); |
648 | 648 | ||
649 | if ((il_queue_space(q) < q->high_mark) | 649 | if ((il_queue_space(q) < q->high_mark) |
650 | && priv->mac80211_registered) { | 650 | && il->mac80211_registered) { |
651 | if (wait_write_ptr) { | 651 | if (wait_write_ptr) { |
652 | spin_lock_irqsave(&priv->lock, flags); | 652 | spin_lock_irqsave(&il->lock, flags); |
653 | txq->need_update = 1; | 653 | txq->need_update = 1; |
654 | il_txq_update_write_ptr(priv, txq); | 654 | il_txq_update_write_ptr(il, txq); |
655 | spin_unlock_irqrestore(&priv->lock, flags); | 655 | spin_unlock_irqrestore(&il->lock, flags); |
656 | } | 656 | } |
657 | 657 | ||
658 | il_stop_queue(priv, txq); | 658 | il_stop_queue(il, txq); |
659 | } | 659 | } |
660 | 660 | ||
661 | return 0; | 661 | return 0; |
662 | 662 | ||
663 | drop_unlock: | 663 | drop_unlock: |
664 | spin_unlock_irqrestore(&priv->lock, flags); | 664 | spin_unlock_irqrestore(&il->lock, flags); |
665 | drop: | 665 | drop: |
666 | return -1; | 666 | return -1; |
667 | } | 667 | } |
668 | 668 | ||
669 | static int il3945_get_measurement(struct il_priv *priv, | 669 | static int il3945_get_measurement(struct il_priv *il, |
670 | struct ieee80211_measurement_params *params, | 670 | struct ieee80211_measurement_params *params, |
671 | u8 type) | 671 | u8 type) |
672 | { | 672 | { |
@@ -681,11 +681,11 @@ static int il3945_get_measurement(struct il_priv *priv, | |||
681 | int rc; | 681 | int rc; |
682 | int spectrum_resp_status; | 682 | int spectrum_resp_status; |
683 | int duration = le16_to_cpu(params->duration); | 683 | int duration = le16_to_cpu(params->duration); |
684 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 684 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
685 | 685 | ||
686 | if (il_is_associated(priv, IL_RXON_CTX_BSS)) | 686 | if (il_is_associated(il, IL_RXON_CTX_BSS)) |
687 | add_time = il_usecs_to_beacons(priv, | 687 | add_time = il_usecs_to_beacons(il, |
688 | le64_to_cpu(params->start_time) - priv->_3945.last_tsf, | 688 | le64_to_cpu(params->start_time) - il->_3945.last_tsf, |
689 | le16_to_cpu(ctx->timing.beacon_interval)); | 689 | le16_to_cpu(ctx->timing.beacon_interval)); |
690 | 690 | ||
691 | memset(&spectrum, 0, sizeof(spectrum)); | 691 | memset(&spectrum, 0, sizeof(spectrum)); |
@@ -697,10 +697,10 @@ static int il3945_get_measurement(struct il_priv *priv, | |||
697 | cmd.len = sizeof(spectrum); | 697 | cmd.len = sizeof(spectrum); |
698 | spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len)); | 698 | spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len)); |
699 | 699 | ||
700 | if (il_is_associated(priv, IL_RXON_CTX_BSS)) | 700 | if (il_is_associated(il, IL_RXON_CTX_BSS)) |
701 | spectrum.start_time = | 701 | spectrum.start_time = |
702 | il_add_beacon_time(priv, | 702 | il_add_beacon_time(il, |
703 | priv->_3945.last_beacon_time, add_time, | 703 | il->_3945.last_beacon_time, add_time, |
704 | le16_to_cpu(ctx->timing.beacon_interval)); | 704 | le16_to_cpu(ctx->timing.beacon_interval)); |
705 | else | 705 | else |
706 | spectrum.start_time = 0; | 706 | spectrum.start_time = 0; |
@@ -712,13 +712,13 @@ static int il3945_get_measurement(struct il_priv *priv, | |||
712 | spectrum.flags |= RXON_FLG_BAND_24G_MSK | | 712 | spectrum.flags |= RXON_FLG_BAND_24G_MSK | |
713 | RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK; | 713 | RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK; |
714 | 714 | ||
715 | rc = il_send_cmd_sync(priv, &cmd); | 715 | rc = il_send_cmd_sync(il, &cmd); |
716 | if (rc) | 716 | if (rc) |
717 | return rc; | 717 | return rc; |
718 | 718 | ||
719 | pkt = (struct il_rx_packet *)cmd.reply_page; | 719 | pkt = (struct il_rx_packet *)cmd.reply_page; |
720 | if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { | 720 | if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { |
721 | IL_ERR(priv, "Bad return from REPLY_RX_ON_ASSOC command\n"); | 721 | IL_ERR(il, "Bad return from REPLY_RX_ON_ASSOC command\n"); |
722 | rc = -EIO; | 722 | rc = -EIO; |
723 | } | 723 | } |
724 | 724 | ||
@@ -726,11 +726,11 @@ static int il3945_get_measurement(struct il_priv *priv, | |||
726 | switch (spectrum_resp_status) { | 726 | switch (spectrum_resp_status) { |
727 | case 0: /* Command will be handled */ | 727 | case 0: /* Command will be handled */ |
728 | if (pkt->u.spectrum.id != 0xff) { | 728 | if (pkt->u.spectrum.id != 0xff) { |
729 | IL_DEBUG_INFO(priv, "Replaced existing measurement: %d\n", | 729 | IL_DEBUG_INFO(il, "Replaced existing measurement: %d\n", |
730 | pkt->u.spectrum.id); | 730 | pkt->u.spectrum.id); |
731 | priv->measurement_status &= ~MEASUREMENT_READY; | 731 | il->measurement_status &= ~MEASUREMENT_READY; |
732 | } | 732 | } |
733 | priv->measurement_status |= MEASUREMENT_ACTIVE; | 733 | il->measurement_status |= MEASUREMENT_ACTIVE; |
734 | rc = 0; | 734 | rc = 0; |
735 | break; | 735 | break; |
736 | 736 | ||
@@ -739,12 +739,12 @@ static int il3945_get_measurement(struct il_priv *priv, | |||
739 | break; | 739 | break; |
740 | } | 740 | } |
741 | 741 | ||
742 | il_free_pages(priv, cmd.reply_page); | 742 | il_free_pages(il, cmd.reply_page); |
743 | 743 | ||
744 | return rc; | 744 | return rc; |
745 | } | 745 | } |
746 | 746 | ||
747 | static void il3945_rx_reply_alive(struct il_priv *priv, | 747 | static void il3945_rx_reply_alive(struct il_priv *il, |
748 | struct il_rx_mem_buffer *rxb) | 748 | struct il_rx_mem_buffer *rxb) |
749 | { | 749 | { |
750 | struct il_rx_packet *pkt = rxb_addr(rxb); | 750 | struct il_rx_packet *pkt = rxb_addr(rxb); |
@@ -753,44 +753,44 @@ static void il3945_rx_reply_alive(struct il_priv *priv, | |||
753 | 753 | ||
754 | palive = &pkt->u.alive_frame; | 754 | palive = &pkt->u.alive_frame; |
755 | 755 | ||
756 | IL_DEBUG_INFO(priv, "Alive ucode status 0x%08X revision " | 756 | IL_DEBUG_INFO(il, "Alive ucode status 0x%08X revision " |
757 | "0x%01X 0x%01X\n", | 757 | "0x%01X 0x%01X\n", |
758 | palive->is_valid, palive->ver_type, | 758 | palive->is_valid, palive->ver_type, |
759 | palive->ver_subtype); | 759 | palive->ver_subtype); |
760 | 760 | ||
761 | if (palive->ver_subtype == INITIALIZE_SUBTYPE) { | 761 | if (palive->ver_subtype == INITIALIZE_SUBTYPE) { |
762 | IL_DEBUG_INFO(priv, "Initialization Alive received.\n"); | 762 | IL_DEBUG_INFO(il, "Initialization Alive received.\n"); |
763 | memcpy(&priv->card_alive_init, &pkt->u.alive_frame, | 763 | memcpy(&il->card_alive_init, &pkt->u.alive_frame, |
764 | sizeof(struct il_alive_resp)); | 764 | sizeof(struct il_alive_resp)); |
765 | pwork = &priv->init_alive_start; | 765 | pwork = &il->init_alive_start; |
766 | } else { | 766 | } else { |
767 | IL_DEBUG_INFO(priv, "Runtime Alive received.\n"); | 767 | IL_DEBUG_INFO(il, "Runtime Alive received.\n"); |
768 | memcpy(&priv->card_alive, &pkt->u.alive_frame, | 768 | memcpy(&il->card_alive, &pkt->u.alive_frame, |
769 | sizeof(struct il_alive_resp)); | 769 | sizeof(struct il_alive_resp)); |
770 | pwork = &priv->alive_start; | 770 | pwork = &il->alive_start; |
771 | il3945_disable_events(priv); | 771 | il3945_disable_events(il); |
772 | } | 772 | } |
773 | 773 | ||
774 | /* We delay the ALIVE response by 5ms to | 774 | /* We delay the ALIVE response by 5ms to |
775 | * give the HW RF Kill time to activate... */ | 775 | * give the HW RF Kill time to activate... */ |
776 | if (palive->is_valid == UCODE_VALID_OK) | 776 | if (palive->is_valid == UCODE_VALID_OK) |
777 | queue_delayed_work(priv->workqueue, pwork, | 777 | queue_delayed_work(il->workqueue, pwork, |
778 | msecs_to_jiffies(5)); | 778 | msecs_to_jiffies(5)); |
779 | else | 779 | else |
780 | IL_WARN(priv, "uCode did not respond OK.\n"); | 780 | IL_WARN(il, "uCode did not respond OK.\n"); |
781 | } | 781 | } |
782 | 782 | ||
783 | static void il3945_rx_reply_add_sta(struct il_priv *priv, | 783 | static void il3945_rx_reply_add_sta(struct il_priv *il, |
784 | struct il_rx_mem_buffer *rxb) | 784 | struct il_rx_mem_buffer *rxb) |
785 | { | 785 | { |
786 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 786 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
787 | struct il_rx_packet *pkt = rxb_addr(rxb); | 787 | struct il_rx_packet *pkt = rxb_addr(rxb); |
788 | #endif | 788 | #endif |
789 | 789 | ||
790 | IL_DEBUG_RX(priv, "Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status); | 790 | IL_DEBUG_RX(il, "Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status); |
791 | } | 791 | } |
792 | 792 | ||
793 | static void il3945_rx_beacon_notif(struct il_priv *priv, | 793 | static void il3945_rx_beacon_notif(struct il_priv *il, |
794 | struct il_rx_mem_buffer *rxb) | 794 | struct il_rx_mem_buffer *rxb) |
795 | { | 795 | { |
796 | struct il_rx_packet *pkt = rxb_addr(rxb); | 796 | struct il_rx_packet *pkt = rxb_addr(rxb); |
@@ -798,7 +798,7 @@ static void il3945_rx_beacon_notif(struct il_priv *priv, | |||
798 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 798 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
799 | u8 rate = beacon->beacon_notify_hdr.rate; | 799 | u8 rate = beacon->beacon_notify_hdr.rate; |
800 | 800 | ||
801 | IL_DEBUG_RX(priv, "beacon status %x retries %d iss %d " | 801 | IL_DEBUG_RX(il, "beacon status %x retries %d iss %d " |
802 | "tsf %d %d rate %d\n", | 802 | "tsf %d %d rate %d\n", |
803 | le32_to_cpu(beacon->beacon_notify_hdr.status) & TX_STATUS_MSK, | 803 | le32_to_cpu(beacon->beacon_notify_hdr.status) & TX_STATUS_MSK, |
804 | beacon->beacon_notify_hdr.failure_frame, | 804 | beacon->beacon_notify_hdr.failure_frame, |
@@ -807,40 +807,40 @@ static void il3945_rx_beacon_notif(struct il_priv *priv, | |||
807 | le32_to_cpu(beacon->low_tsf), rate); | 807 | le32_to_cpu(beacon->low_tsf), rate); |
808 | #endif | 808 | #endif |
809 | 809 | ||
810 | priv->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status); | 810 | il->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status); |
811 | 811 | ||
812 | } | 812 | } |
813 | 813 | ||
814 | /* Handle notification from uCode that card's power state is changing | 814 | /* Handle notification from uCode that card's power state is changing |
815 | * due to software, hardware, or critical temperature RFKILL */ | 815 | * due to software, hardware, or critical temperature RFKILL */ |
816 | static void il3945_rx_card_state_notif(struct il_priv *priv, | 816 | static void il3945_rx_card_state_notif(struct il_priv *il, |
817 | struct il_rx_mem_buffer *rxb) | 817 | struct il_rx_mem_buffer *rxb) |
818 | { | 818 | { |
819 | struct il_rx_packet *pkt = rxb_addr(rxb); | 819 | struct il_rx_packet *pkt = rxb_addr(rxb); |
820 | u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags); | 820 | u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags); |
821 | unsigned long status = priv->status; | 821 | unsigned long status = il->status; |
822 | 822 | ||
823 | IL_WARN(priv, "Card state received: HW:%s SW:%s\n", | 823 | IL_WARN(il, "Card state received: HW:%s SW:%s\n", |
824 | (flags & HW_CARD_DISABLED) ? "Kill" : "On", | 824 | (flags & HW_CARD_DISABLED) ? "Kill" : "On", |
825 | (flags & SW_CARD_DISABLED) ? "Kill" : "On"); | 825 | (flags & SW_CARD_DISABLED) ? "Kill" : "On"); |
826 | 826 | ||
827 | il_write32(priv, CSR_UCODE_DRV_GP1_SET, | 827 | il_write32(il, CSR_UCODE_DRV_GP1_SET, |
828 | CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); | 828 | CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); |
829 | 829 | ||
830 | if (flags & HW_CARD_DISABLED) | 830 | if (flags & HW_CARD_DISABLED) |
831 | set_bit(STATUS_RF_KILL_HW, &priv->status); | 831 | set_bit(STATUS_RF_KILL_HW, &il->status); |
832 | else | 832 | else |
833 | clear_bit(STATUS_RF_KILL_HW, &priv->status); | 833 | clear_bit(STATUS_RF_KILL_HW, &il->status); |
834 | 834 | ||
835 | 835 | ||
836 | il_scan_cancel(priv); | 836 | il_scan_cancel(il); |
837 | 837 | ||
838 | if ((test_bit(STATUS_RF_KILL_HW, &status) != | 838 | if ((test_bit(STATUS_RF_KILL_HW, &status) != |
839 | test_bit(STATUS_RF_KILL_HW, &priv->status))) | 839 | test_bit(STATUS_RF_KILL_HW, &il->status))) |
840 | wiphy_rfkill_set_hw_state(priv->hw->wiphy, | 840 | wiphy_rfkill_set_hw_state(il->hw->wiphy, |
841 | test_bit(STATUS_RF_KILL_HW, &priv->status)); | 841 | test_bit(STATUS_RF_KILL_HW, &il->status)); |
842 | else | 842 | else |
843 | wake_up(&priv->wait_command_queue); | 843 | wake_up(&il->wait_command_queue); |
844 | } | 844 | } |
845 | 845 | ||
846 | /** | 846 | /** |
@@ -852,32 +852,32 @@ static void il3945_rx_card_state_notif(struct il_priv *priv, | |||
852 | * This function chains into the hardware specific files for them to setup | 852 | * This function chains into the hardware specific files for them to setup |
853 | * any hardware specific handlers as well. | 853 | * any hardware specific handlers as well. |
854 | */ | 854 | */ |
855 | static void il3945_setup_rx_handlers(struct il_priv *priv) | 855 | static void il3945_setup_rx_handlers(struct il_priv *il) |
856 | { | 856 | { |
857 | priv->rx_handlers[REPLY_ALIVE] = il3945_rx_reply_alive; | 857 | il->rx_handlers[REPLY_ALIVE] = il3945_rx_reply_alive; |
858 | priv->rx_handlers[REPLY_ADD_STA] = il3945_rx_reply_add_sta; | 858 | il->rx_handlers[REPLY_ADD_STA] = il3945_rx_reply_add_sta; |
859 | priv->rx_handlers[REPLY_ERROR] = il_rx_reply_error; | 859 | il->rx_handlers[REPLY_ERROR] = il_rx_reply_error; |
860 | priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = il_rx_csa; | 860 | il->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = il_rx_csa; |
861 | priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] = | 861 | il->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] = |
862 | il_rx_spectrum_measure_notif; | 862 | il_rx_spectrum_measure_notif; |
863 | priv->rx_handlers[PM_SLEEP_NOTIFICATION] = il_rx_pm_sleep_notif; | 863 | il->rx_handlers[PM_SLEEP_NOTIFICATION] = il_rx_pm_sleep_notif; |
864 | priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] = | 864 | il->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] = |
865 | il_rx_pm_debug_statistics_notif; | 865 | il_rx_pm_debug_statistics_notif; |
866 | priv->rx_handlers[BEACON_NOTIFICATION] = il3945_rx_beacon_notif; | 866 | il->rx_handlers[BEACON_NOTIFICATION] = il3945_rx_beacon_notif; |
867 | 867 | ||
868 | /* | 868 | /* |
869 | * The same handler is used for both the REPLY to a discrete | 869 | * The same handler is used for both the REPLY to a discrete |
870 | * statistics request from the host as well as for the periodic | 870 | * statistics request from the host as well as for the periodic |
871 | * statistics notifications (after received beacons) from the uCode. | 871 | * statistics notifications (after received beacons) from the uCode. |
872 | */ | 872 | */ |
873 | priv->rx_handlers[REPLY_STATISTICS_CMD] = il3945_reply_statistics; | 873 | il->rx_handlers[REPLY_STATISTICS_CMD] = il3945_reply_statistics; |
874 | priv->rx_handlers[STATISTICS_NOTIFICATION] = il3945_hw_rx_statistics; | 874 | il->rx_handlers[STATISTICS_NOTIFICATION] = il3945_hw_rx_statistics; |
875 | 875 | ||
876 | il_setup_rx_scan_handlers(priv); | 876 | il_setup_rx_scan_handlers(il); |
877 | priv->rx_handlers[CARD_STATE_NOTIFICATION] = il3945_rx_card_state_notif; | 877 | il->rx_handlers[CARD_STATE_NOTIFICATION] = il3945_rx_card_state_notif; |
878 | 878 | ||
879 | /* Set up hardware specific Rx handlers */ | 879 | /* Set up hardware specific Rx handlers */ |
880 | il3945_hw_rx_handler_setup(priv); | 880 | il3945_hw_rx_handler_setup(il); |
881 | } | 881 | } |
882 | 882 | ||
883 | /************************** RX-FUNCTIONS ****************************/ | 883 | /************************** RX-FUNCTIONS ****************************/ |
@@ -947,7 +947,7 @@ static void il3945_setup_rx_handlers(struct il_priv *priv) | |||
947 | /** | 947 | /** |
948 | * il3945_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr | 948 | * il3945_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr |
949 | */ | 949 | */ |
950 | static inline __le32 il3945_dma_addr2rbd_ptr(struct il_priv *priv, | 950 | static inline __le32 il3945_dma_addr2rbd_ptr(struct il_priv *il, |
951 | dma_addr_t dma_addr) | 951 | dma_addr_t dma_addr) |
952 | { | 952 | { |
953 | return cpu_to_le32((u32)dma_addr); | 953 | return cpu_to_le32((u32)dma_addr); |
@@ -964,9 +964,9 @@ static inline __le32 il3945_dma_addr2rbd_ptr(struct il_priv *priv, | |||
964 | * also updates the memory address in the firmware to reference the new | 964 | * also updates the memory address in the firmware to reference the new |
965 | * target buffer. | 965 | * target buffer. |
966 | */ | 966 | */ |
967 | static void il3945_rx_queue_restock(struct il_priv *priv) | 967 | static void il3945_rx_queue_restock(struct il_priv *il) |
968 | { | 968 | { |
969 | struct il_rx_queue *rxq = &priv->rxq; | 969 | struct il_rx_queue *rxq = &il->rxq; |
970 | struct list_head *element; | 970 | struct list_head *element; |
971 | struct il_rx_mem_buffer *rxb; | 971 | struct il_rx_mem_buffer *rxb; |
972 | unsigned long flags; | 972 | unsigned long flags; |
@@ -981,7 +981,7 @@ static void il3945_rx_queue_restock(struct il_priv *priv) | |||
981 | list_del(element); | 981 | list_del(element); |
982 | 982 | ||
983 | /* Point to Rx buffer via next RBD in circular buffer */ | 983 | /* Point to Rx buffer via next RBD in circular buffer */ |
984 | rxq->bd[rxq->write] = il3945_dma_addr2rbd_ptr(priv, rxb->page_dma); | 984 | rxq->bd[rxq->write] = il3945_dma_addr2rbd_ptr(il, rxb->page_dma); |
985 | rxq->queue[rxq->write] = rxb; | 985 | rxq->queue[rxq->write] = rxb; |
986 | rxq->write = (rxq->write + 1) & RX_QUEUE_MASK; | 986 | rxq->write = (rxq->write + 1) & RX_QUEUE_MASK; |
987 | rxq->free_count--; | 987 | rxq->free_count--; |
@@ -990,7 +990,7 @@ static void il3945_rx_queue_restock(struct il_priv *priv) | |||
990 | /* If the pre-allocated buffer pool is dropping low, schedule to | 990 | /* If the pre-allocated buffer pool is dropping low, schedule to |
991 | * refill it */ | 991 | * refill it */ |
992 | if (rxq->free_count <= RX_LOW_WATERMARK) | 992 | if (rxq->free_count <= RX_LOW_WATERMARK) |
993 | queue_work(priv->workqueue, &priv->rx_replenish); | 993 | queue_work(il->workqueue, &il->rx_replenish); |
994 | 994 | ||
995 | 995 | ||
996 | /* If we've added more space for the firmware to place data, tell it. | 996 | /* 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) | |||
1000 | spin_lock_irqsave(&rxq->lock, flags); | 1000 | spin_lock_irqsave(&rxq->lock, flags); |
1001 | rxq->need_update = 1; | 1001 | rxq->need_update = 1; |
1002 | spin_unlock_irqrestore(&rxq->lock, flags); | 1002 | spin_unlock_irqrestore(&rxq->lock, flags); |
1003 | il_rx_queue_update_write_ptr(priv, rxq); | 1003 | il_rx_queue_update_write_ptr(il, rxq); |
1004 | } | 1004 | } |
1005 | } | 1005 | } |
1006 | 1006 | ||
@@ -1012,9 +1012,9 @@ static void il3945_rx_queue_restock(struct il_priv *priv) | |||
1012 | * Also restock the Rx queue via il3945_rx_queue_restock. | 1012 | * Also restock the Rx queue via il3945_rx_queue_restock. |
1013 | * This is called as a scheduled work item (except for during initialization) | 1013 | * This is called as a scheduled work item (except for during initialization) |
1014 | */ | 1014 | */ |
1015 | static void il3945_rx_allocate(struct il_priv *priv, gfp_t priority) | 1015 | static void il3945_rx_allocate(struct il_priv *il, gfp_t priority) |
1016 | { | 1016 | { |
1017 | struct il_rx_queue *rxq = &priv->rxq; | 1017 | struct il_rx_queue *rxq = &il->rxq; |
1018 | struct list_head *element; | 1018 | struct list_head *element; |
1019 | struct il_rx_mem_buffer *rxb; | 1019 | struct il_rx_mem_buffer *rxb; |
1020 | struct page *page; | 1020 | struct page *page; |
@@ -1033,17 +1033,17 @@ static void il3945_rx_allocate(struct il_priv *priv, gfp_t priority) | |||
1033 | if (rxq->free_count > RX_LOW_WATERMARK) | 1033 | if (rxq->free_count > RX_LOW_WATERMARK) |
1034 | gfp_mask |= __GFP_NOWARN; | 1034 | gfp_mask |= __GFP_NOWARN; |
1035 | 1035 | ||
1036 | if (priv->hw_params.rx_page_order > 0) | 1036 | if (il->hw_params.rx_page_order > 0) |
1037 | gfp_mask |= __GFP_COMP; | 1037 | gfp_mask |= __GFP_COMP; |
1038 | 1038 | ||
1039 | /* Alloc a new receive buffer */ | 1039 | /* Alloc a new receive buffer */ |
1040 | page = alloc_pages(gfp_mask, priv->hw_params.rx_page_order); | 1040 | page = alloc_pages(gfp_mask, il->hw_params.rx_page_order); |
1041 | if (!page) { | 1041 | if (!page) { |
1042 | if (net_ratelimit()) | 1042 | if (net_ratelimit()) |
1043 | IL_DEBUG_INFO(priv, "Failed to allocate SKB buffer.\n"); | 1043 | IL_DEBUG_INFO(il, "Failed to allocate SKB buffer.\n"); |
1044 | if ((rxq->free_count <= RX_LOW_WATERMARK) && | 1044 | if ((rxq->free_count <= RX_LOW_WATERMARK) && |
1045 | net_ratelimit()) | 1045 | net_ratelimit()) |
1046 | IL_CRIT(priv, "Failed to allocate SKB buffer with %s. Only %u free buffers remaining.\n", | 1046 | IL_CRIT(il, "Failed to allocate SKB buffer with %s. Only %u free buffers remaining.\n", |
1047 | priority == GFP_ATOMIC ? "GFP_ATOMIC" : "GFP_KERNEL", | 1047 | priority == GFP_ATOMIC ? "GFP_ATOMIC" : "GFP_KERNEL", |
1048 | rxq->free_count); | 1048 | rxq->free_count); |
1049 | /* We don't reschedule replenish work here -- we will | 1049 | /* We don't reschedule replenish work here -- we will |
@@ -1055,7 +1055,7 @@ static void il3945_rx_allocate(struct il_priv *priv, gfp_t priority) | |||
1055 | spin_lock_irqsave(&rxq->lock, flags); | 1055 | spin_lock_irqsave(&rxq->lock, flags); |
1056 | if (list_empty(&rxq->rx_used)) { | 1056 | if (list_empty(&rxq->rx_used)) { |
1057 | spin_unlock_irqrestore(&rxq->lock, flags); | 1057 | spin_unlock_irqrestore(&rxq->lock, flags); |
1058 | __free_pages(page, priv->hw_params.rx_page_order); | 1058 | __free_pages(page, il->hw_params.rx_page_order); |
1059 | return; | 1059 | return; |
1060 | } | 1060 | } |
1061 | element = rxq->rx_used.next; | 1061 | element = rxq->rx_used.next; |
@@ -1065,21 +1065,21 @@ static void il3945_rx_allocate(struct il_priv *priv, gfp_t priority) | |||
1065 | 1065 | ||
1066 | rxb->page = page; | 1066 | rxb->page = page; |
1067 | /* Get physical address of RB/SKB */ | 1067 | /* Get physical address of RB/SKB */ |
1068 | rxb->page_dma = pci_map_page(priv->pci_dev, page, 0, | 1068 | rxb->page_dma = pci_map_page(il->pci_dev, page, 0, |
1069 | PAGE_SIZE << priv->hw_params.rx_page_order, | 1069 | PAGE_SIZE << il->hw_params.rx_page_order, |
1070 | PCI_DMA_FROMDEVICE); | 1070 | PCI_DMA_FROMDEVICE); |
1071 | 1071 | ||
1072 | spin_lock_irqsave(&rxq->lock, flags); | 1072 | spin_lock_irqsave(&rxq->lock, flags); |
1073 | 1073 | ||
1074 | list_add_tail(&rxb->list, &rxq->rx_free); | 1074 | list_add_tail(&rxb->list, &rxq->rx_free); |
1075 | rxq->free_count++; | 1075 | rxq->free_count++; |
1076 | priv->alloc_rxb_page++; | 1076 | il->alloc_rxb_page++; |
1077 | 1077 | ||
1078 | spin_unlock_irqrestore(&rxq->lock, flags); | 1078 | spin_unlock_irqrestore(&rxq->lock, flags); |
1079 | } | 1079 | } |
1080 | } | 1080 | } |
1081 | 1081 | ||
1082 | void il3945_rx_queue_reset(struct il_priv *priv, struct il_rx_queue *rxq) | 1082 | void il3945_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq) |
1083 | { | 1083 | { |
1084 | unsigned long flags; | 1084 | unsigned long flags; |
1085 | int i; | 1085 | int i; |
@@ -1091,10 +1091,10 @@ void il3945_rx_queue_reset(struct il_priv *priv, struct il_rx_queue *rxq) | |||
1091 | /* In the reset function, these buffers may have been allocated | 1091 | /* In the reset function, these buffers may have been allocated |
1092 | * to an SKB, so we need to unmap and free potential storage */ | 1092 | * to an SKB, so we need to unmap and free potential storage */ |
1093 | if (rxq->pool[i].page != NULL) { | 1093 | if (rxq->pool[i].page != NULL) { |
1094 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 1094 | pci_unmap_page(il->pci_dev, rxq->pool[i].page_dma, |
1095 | PAGE_SIZE << priv->hw_params.rx_page_order, | 1095 | PAGE_SIZE << il->hw_params.rx_page_order, |
1096 | PCI_DMA_FROMDEVICE); | 1096 | PCI_DMA_FROMDEVICE); |
1097 | __il_free_pages(priv, rxq->pool[i].page); | 1097 | __il_free_pages(il, rxq->pool[i].page); |
1098 | rxq->pool[i].page = NULL; | 1098 | rxq->pool[i].page = NULL; |
1099 | } | 1099 | } |
1100 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); | 1100 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); |
@@ -1110,21 +1110,21 @@ void il3945_rx_queue_reset(struct il_priv *priv, struct il_rx_queue *rxq) | |||
1110 | 1110 | ||
1111 | void il3945_rx_replenish(void *data) | 1111 | void il3945_rx_replenish(void *data) |
1112 | { | 1112 | { |
1113 | struct il_priv *priv = data; | 1113 | struct il_priv *il = data; |
1114 | unsigned long flags; | 1114 | unsigned long flags; |
1115 | 1115 | ||
1116 | il3945_rx_allocate(priv, GFP_KERNEL); | 1116 | il3945_rx_allocate(il, GFP_KERNEL); |
1117 | 1117 | ||
1118 | spin_lock_irqsave(&priv->lock, flags); | 1118 | spin_lock_irqsave(&il->lock, flags); |
1119 | il3945_rx_queue_restock(priv); | 1119 | il3945_rx_queue_restock(il); |
1120 | spin_unlock_irqrestore(&priv->lock, flags); | 1120 | spin_unlock_irqrestore(&il->lock, flags); |
1121 | } | 1121 | } |
1122 | 1122 | ||
1123 | static void il3945_rx_replenish_now(struct il_priv *priv) | 1123 | static void il3945_rx_replenish_now(struct il_priv *il) |
1124 | { | 1124 | { |
1125 | il3945_rx_allocate(priv, GFP_ATOMIC); | 1125 | il3945_rx_allocate(il, GFP_ATOMIC); |
1126 | 1126 | ||
1127 | il3945_rx_queue_restock(priv); | 1127 | il3945_rx_queue_restock(il); |
1128 | } | 1128 | } |
1129 | 1129 | ||
1130 | 1130 | ||
@@ -1133,22 +1133,22 @@ static void il3945_rx_replenish_now(struct il_priv *priv) | |||
1133 | * This free routine walks the list of POOL entries and if SKB is set to | 1133 | * This free routine walks the list of POOL entries and if SKB is set to |
1134 | * non NULL it is unmapped and freed | 1134 | * non NULL it is unmapped and freed |
1135 | */ | 1135 | */ |
1136 | static void il3945_rx_queue_free(struct il_priv *priv, struct il_rx_queue *rxq) | 1136 | static void il3945_rx_queue_free(struct il_priv *il, struct il_rx_queue *rxq) |
1137 | { | 1137 | { |
1138 | int i; | 1138 | int i; |
1139 | for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { | 1139 | for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { |
1140 | if (rxq->pool[i].page != NULL) { | 1140 | if (rxq->pool[i].page != NULL) { |
1141 | pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma, | 1141 | pci_unmap_page(il->pci_dev, rxq->pool[i].page_dma, |
1142 | PAGE_SIZE << priv->hw_params.rx_page_order, | 1142 | PAGE_SIZE << il->hw_params.rx_page_order, |
1143 | PCI_DMA_FROMDEVICE); | 1143 | PCI_DMA_FROMDEVICE); |
1144 | __il_free_pages(priv, rxq->pool[i].page); | 1144 | __il_free_pages(il, rxq->pool[i].page); |
1145 | rxq->pool[i].page = NULL; | 1145 | rxq->pool[i].page = NULL; |
1146 | } | 1146 | } |
1147 | } | 1147 | } |
1148 | 1148 | ||
1149 | dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, | 1149 | dma_free_coherent(&il->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, |
1150 | rxq->bd_dma); | 1150 | rxq->bd_dma); |
1151 | dma_free_coherent(&priv->pci_dev->dev, sizeof(struct il_rb_status), | 1151 | dma_free_coherent(&il->pci_dev->dev, sizeof(struct il_rb_status), |
1152 | rxq->rb_stts, rxq->rb_stts_dma); | 1152 | rxq->rb_stts, rxq->rb_stts_dma); |
1153 | rxq->bd = NULL; | 1153 | rxq->bd = NULL; |
1154 | rxq->rb_stts = NULL; | 1154 | rxq->rb_stts = NULL; |
@@ -1195,15 +1195,15 @@ int il3945_calc_db_from_ratio(int sig_ratio) | |||
1195 | /** | 1195 | /** |
1196 | * il3945_rx_handle - Main entry function for receiving responses from uCode | 1196 | * il3945_rx_handle - Main entry function for receiving responses from uCode |
1197 | * | 1197 | * |
1198 | * Uses the priv->rx_handlers callback function array to invoke | 1198 | * Uses the il->rx_handlers callback function array to invoke |
1199 | * the appropriate handlers, including command responses, | 1199 | * the appropriate handlers, including command responses, |
1200 | * frame-received notifications, and other notifications. | 1200 | * frame-received notifications, and other notifications. |
1201 | */ | 1201 | */ |
1202 | static void il3945_rx_handle(struct il_priv *priv) | 1202 | static void il3945_rx_handle(struct il_priv *il) |
1203 | { | 1203 | { |
1204 | struct il_rx_mem_buffer *rxb; | 1204 | struct il_rx_mem_buffer *rxb; |
1205 | struct il_rx_packet *pkt; | 1205 | struct il_rx_packet *pkt; |
1206 | struct il_rx_queue *rxq = &priv->rxq; | 1206 | struct il_rx_queue *rxq = &il->rxq; |
1207 | u32 r, i; | 1207 | u32 r, i; |
1208 | int reclaim; | 1208 | int reclaim; |
1209 | unsigned long flags; | 1209 | unsigned long flags; |
@@ -1225,7 +1225,7 @@ static void il3945_rx_handle(struct il_priv *priv) | |||
1225 | fill_rx = 1; | 1225 | fill_rx = 1; |
1226 | /* Rx interrupt, but nothing sent from uCode */ | 1226 | /* Rx interrupt, but nothing sent from uCode */ |
1227 | if (i == r) | 1227 | if (i == r) |
1228 | IL_DEBUG_RX(priv, "r = %d, i = %d\n", r, i); | 1228 | IL_DEBUG_RX(il, "r = %d, i = %d\n", r, i); |
1229 | 1229 | ||
1230 | while (i != r) { | 1230 | while (i != r) { |
1231 | int len; | 1231 | int len; |
@@ -1239,8 +1239,8 @@ static void il3945_rx_handle(struct il_priv *priv) | |||
1239 | 1239 | ||
1240 | rxq->queue[i] = NULL; | 1240 | rxq->queue[i] = NULL; |
1241 | 1241 | ||
1242 | pci_unmap_page(priv->pci_dev, rxb->page_dma, | 1242 | pci_unmap_page(il->pci_dev, rxb->page_dma, |
1243 | PAGE_SIZE << priv->hw_params.rx_page_order, | 1243 | PAGE_SIZE << il->hw_params.rx_page_order, |
1244 | PCI_DMA_FROMDEVICE); | 1244 | PCI_DMA_FROMDEVICE); |
1245 | pkt = rxb_addr(rxb); | 1245 | pkt = rxb_addr(rxb); |
1246 | 1246 | ||
@@ -1260,14 +1260,14 @@ static void il3945_rx_handle(struct il_priv *priv) | |||
1260 | /* Based on type of command response or notification, | 1260 | /* Based on type of command response or notification, |
1261 | * handle those that need handling via function in | 1261 | * handle those that need handling via function in |
1262 | * rx_handlers table. See il3945_setup_rx_handlers() */ | 1262 | * rx_handlers table. See il3945_setup_rx_handlers() */ |
1263 | if (priv->rx_handlers[pkt->hdr.cmd]) { | 1263 | if (il->rx_handlers[pkt->hdr.cmd]) { |
1264 | IL_DEBUG_RX(priv, "r = %d, i = %d, %s, 0x%02x\n", r, i, | 1264 | IL_DEBUG_RX(il, "r = %d, i = %d, %s, 0x%02x\n", r, i, |
1265 | il_get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); | 1265 | il_get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); |
1266 | priv->isr_stats.rx_handlers[pkt->hdr.cmd]++; | 1266 | il->isr_stats.rx_handlers[pkt->hdr.cmd]++; |
1267 | priv->rx_handlers[pkt->hdr.cmd] (priv, rxb); | 1267 | il->rx_handlers[pkt->hdr.cmd] (il, rxb); |
1268 | } else { | 1268 | } else { |
1269 | /* No handling needed */ | 1269 | /* No handling needed */ |
1270 | IL_DEBUG_RX(priv, | 1270 | IL_DEBUG_RX(il, |
1271 | "r %d i %d No handler needed for %s, 0x%02x\n", | 1271 | "r %d i %d No handler needed for %s, 0x%02x\n", |
1272 | r, i, il_get_cmd_string(pkt->hdr.cmd), | 1272 | r, i, il_get_cmd_string(pkt->hdr.cmd), |
1273 | pkt->hdr.cmd); | 1273 | pkt->hdr.cmd); |
@@ -1285,9 +1285,9 @@ static void il3945_rx_handle(struct il_priv *priv) | |||
1285 | * and fire off the (possibly) blocking il_send_cmd() | 1285 | * and fire off the (possibly) blocking il_send_cmd() |
1286 | * as we reclaim the driver command queue */ | 1286 | * as we reclaim the driver command queue */ |
1287 | if (rxb->page) | 1287 | if (rxb->page) |
1288 | il_tx_cmd_complete(priv, rxb); | 1288 | il_tx_cmd_complete(il, rxb); |
1289 | else | 1289 | else |
1290 | IL_WARN(priv, "Claim null rxb?\n"); | 1290 | IL_WARN(il, "Claim null rxb?\n"); |
1291 | } | 1291 | } |
1292 | 1292 | ||
1293 | /* Reuse the page if possible. For notification packets and | 1293 | /* Reuse the page if possible. For notification packets and |
@@ -1295,8 +1295,8 @@ static void il3945_rx_handle(struct il_priv *priv) | |||
1295 | * rx_free list for reuse later. */ | 1295 | * rx_free list for reuse later. */ |
1296 | spin_lock_irqsave(&rxq->lock, flags); | 1296 | spin_lock_irqsave(&rxq->lock, flags); |
1297 | if (rxb->page != NULL) { | 1297 | if (rxb->page != NULL) { |
1298 | rxb->page_dma = pci_map_page(priv->pci_dev, rxb->page, | 1298 | rxb->page_dma = pci_map_page(il->pci_dev, rxb->page, |
1299 | 0, PAGE_SIZE << priv->hw_params.rx_page_order, | 1299 | 0, PAGE_SIZE << il->hw_params.rx_page_order, |
1300 | PCI_DMA_FROMDEVICE); | 1300 | PCI_DMA_FROMDEVICE); |
1301 | list_add_tail(&rxb->list, &rxq->rx_free); | 1301 | list_add_tail(&rxb->list, &rxq->rx_free); |
1302 | rxq->free_count++; | 1302 | rxq->free_count++; |
@@ -1312,7 +1312,7 @@ static void il3945_rx_handle(struct il_priv *priv) | |||
1312 | count++; | 1312 | count++; |
1313 | if (count >= 8) { | 1313 | if (count >= 8) { |
1314 | rxq->read = i; | 1314 | rxq->read = i; |
1315 | il3945_rx_replenish_now(priv); | 1315 | il3945_rx_replenish_now(il); |
1316 | count = 0; | 1316 | count = 0; |
1317 | } | 1317 | } |
1318 | } | 1318 | } |
@@ -1321,17 +1321,17 @@ static void il3945_rx_handle(struct il_priv *priv) | |||
1321 | /* Backtrack one entry */ | 1321 | /* Backtrack one entry */ |
1322 | rxq->read = i; | 1322 | rxq->read = i; |
1323 | if (fill_rx) | 1323 | if (fill_rx) |
1324 | il3945_rx_replenish_now(priv); | 1324 | il3945_rx_replenish_now(il); |
1325 | else | 1325 | else |
1326 | il3945_rx_queue_restock(priv); | 1326 | il3945_rx_queue_restock(il); |
1327 | } | 1327 | } |
1328 | 1328 | ||
1329 | /* call this function to flush any scheduled tasklet */ | 1329 | /* call this function to flush any scheduled tasklet */ |
1330 | static inline void il3945_synchronize_irq(struct il_priv *priv) | 1330 | static inline void il3945_synchronize_irq(struct il_priv *il) |
1331 | { | 1331 | { |
1332 | /* wait to make sure we flush pending tasklet*/ | 1332 | /* wait to make sure we flush pending tasklet*/ |
1333 | synchronize_irq(priv->pci_dev->irq); | 1333 | synchronize_irq(il->pci_dev->irq); |
1334 | tasklet_kill(&priv->irq_tasklet); | 1334 | tasklet_kill(&il->irq_tasklet); |
1335 | } | 1335 | } |
1336 | 1336 | ||
1337 | static const char *il3945_desc_lookup(int i) | 1337 | static const char *il3945_desc_lookup(int i) |
@@ -1357,55 +1357,55 @@ static const char *il3945_desc_lookup(int i) | |||
1357 | #define ERROR_START_OFFSET (1 * sizeof(u32)) | 1357 | #define ERROR_START_OFFSET (1 * sizeof(u32)) |
1358 | #define ERROR_ELEM_SIZE (7 * sizeof(u32)) | 1358 | #define ERROR_ELEM_SIZE (7 * sizeof(u32)) |
1359 | 1359 | ||
1360 | void il3945_dump_nic_error_log(struct il_priv *priv) | 1360 | void il3945_dump_nic_error_log(struct il_priv *il) |
1361 | { | 1361 | { |
1362 | u32 i; | 1362 | u32 i; |
1363 | u32 desc, time, count, base, data1; | 1363 | u32 desc, time, count, base, data1; |
1364 | u32 blink1, blink2, ilink1, ilink2; | 1364 | u32 blink1, blink2, ilink1, ilink2; |
1365 | 1365 | ||
1366 | base = le32_to_cpu(priv->card_alive.error_event_table_ptr); | 1366 | base = le32_to_cpu(il->card_alive.error_event_table_ptr); |
1367 | 1367 | ||
1368 | if (!il3945_hw_valid_rtc_data_addr(base)) { | 1368 | if (!il3945_hw_valid_rtc_data_addr(base)) { |
1369 | IL_ERR(priv, "Not valid error log pointer 0x%08X\n", base); | 1369 | IL_ERR(il, "Not valid error log pointer 0x%08X\n", base); |
1370 | return; | 1370 | return; |
1371 | } | 1371 | } |
1372 | 1372 | ||
1373 | 1373 | ||
1374 | count = il_read_targ_mem(priv, base); | 1374 | count = il_read_targ_mem(il, base); |
1375 | 1375 | ||
1376 | if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { | 1376 | if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { |
1377 | IL_ERR(priv, "Start IWL Error Log Dump:\n"); | 1377 | IL_ERR(il, "Start IWL Error Log Dump:\n"); |
1378 | IL_ERR(priv, "Status: 0x%08lX, count: %d\n", | 1378 | IL_ERR(il, "Status: 0x%08lX, count: %d\n", |
1379 | priv->status, count); | 1379 | il->status, count); |
1380 | } | 1380 | } |
1381 | 1381 | ||
1382 | IL_ERR(priv, "Desc Time asrtPC blink2 " | 1382 | IL_ERR(il, "Desc Time asrtPC blink2 " |
1383 | "ilink1 nmiPC Line\n"); | 1383 | "ilink1 nmiPC Line\n"); |
1384 | for (i = ERROR_START_OFFSET; | 1384 | for (i = ERROR_START_OFFSET; |
1385 | i < (count * ERROR_ELEM_SIZE) + ERROR_START_OFFSET; | 1385 | i < (count * ERROR_ELEM_SIZE) + ERROR_START_OFFSET; |
1386 | i += ERROR_ELEM_SIZE) { | 1386 | i += ERROR_ELEM_SIZE) { |
1387 | desc = il_read_targ_mem(priv, base + i); | 1387 | desc = il_read_targ_mem(il, base + i); |
1388 | time = | 1388 | time = |
1389 | il_read_targ_mem(priv, base + i + 1 * sizeof(u32)); | 1389 | il_read_targ_mem(il, base + i + 1 * sizeof(u32)); |
1390 | blink1 = | 1390 | blink1 = |
1391 | il_read_targ_mem(priv, base + i + 2 * sizeof(u32)); | 1391 | il_read_targ_mem(il, base + i + 2 * sizeof(u32)); |
1392 | blink2 = | 1392 | blink2 = |
1393 | il_read_targ_mem(priv, base + i + 3 * sizeof(u32)); | 1393 | il_read_targ_mem(il, base + i + 3 * sizeof(u32)); |
1394 | ilink1 = | 1394 | ilink1 = |
1395 | il_read_targ_mem(priv, base + i + 4 * sizeof(u32)); | 1395 | il_read_targ_mem(il, base + i + 4 * sizeof(u32)); |
1396 | ilink2 = | 1396 | ilink2 = |
1397 | il_read_targ_mem(priv, base + i + 5 * sizeof(u32)); | 1397 | il_read_targ_mem(il, base + i + 5 * sizeof(u32)); |
1398 | data1 = | 1398 | data1 = |
1399 | il_read_targ_mem(priv, base + i + 6 * sizeof(u32)); | 1399 | il_read_targ_mem(il, base + i + 6 * sizeof(u32)); |
1400 | 1400 | ||
1401 | IL_ERR(priv, | 1401 | IL_ERR(il, |
1402 | "%-13s (0x%X) %010u 0x%05X 0x%05X 0x%05X 0x%05X %u\n\n", | 1402 | "%-13s (0x%X) %010u 0x%05X 0x%05X 0x%05X 0x%05X %u\n\n", |
1403 | il3945_desc_lookup(desc), desc, time, blink1, blink2, | 1403 | il3945_desc_lookup(desc), desc, time, blink1, blink2, |
1404 | ilink1, ilink2, data1); | 1404 | ilink1, ilink2, data1); |
1405 | } | 1405 | } |
1406 | } | 1406 | } |
1407 | 1407 | ||
1408 | static void il3945_irq_tasklet(struct il_priv *priv) | 1408 | static void il3945_irq_tasklet(struct il_priv *il) |
1409 | { | 1409 | { |
1410 | u32 inta, handled = 0; | 1410 | u32 inta, handled = 0; |
1411 | u32 inta_fh; | 1411 | u32 inta_fh; |
@@ -1414,30 +1414,30 @@ static void il3945_irq_tasklet(struct il_priv *priv) | |||
1414 | u32 inta_mask; | 1414 | u32 inta_mask; |
1415 | #endif | 1415 | #endif |
1416 | 1416 | ||
1417 | spin_lock_irqsave(&priv->lock, flags); | 1417 | spin_lock_irqsave(&il->lock, flags); |
1418 | 1418 | ||
1419 | /* Ack/clear/reset pending uCode interrupts. | 1419 | /* Ack/clear/reset pending uCode interrupts. |
1420 | * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS, | 1420 | * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS, |
1421 | * and will clear only when CSR_FH_INT_STATUS gets cleared. */ | 1421 | * and will clear only when CSR_FH_INT_STATUS gets cleared. */ |
1422 | inta = il_read32(priv, CSR_INT); | 1422 | inta = il_read32(il, CSR_INT); |
1423 | il_write32(priv, CSR_INT, inta); | 1423 | il_write32(il, CSR_INT, inta); |
1424 | 1424 | ||
1425 | /* Ack/clear/reset pending flow-handler (DMA) interrupts. | 1425 | /* Ack/clear/reset pending flow-handler (DMA) interrupts. |
1426 | * Any new interrupts that happen after this, either while we're | 1426 | * Any new interrupts that happen after this, either while we're |
1427 | * in this tasklet, or later, will show up in next ISR/tasklet. */ | 1427 | * in this tasklet, or later, will show up in next ISR/tasklet. */ |
1428 | inta_fh = il_read32(priv, CSR_FH_INT_STATUS); | 1428 | inta_fh = il_read32(il, CSR_FH_INT_STATUS); |
1429 | il_write32(priv, CSR_FH_INT_STATUS, inta_fh); | 1429 | il_write32(il, CSR_FH_INT_STATUS, inta_fh); |
1430 | 1430 | ||
1431 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 1431 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
1432 | if (il_get_debug_level(priv) & IL_DL_ISR) { | 1432 | if (il_get_debug_level(il) & IL_DL_ISR) { |
1433 | /* just for debug */ | 1433 | /* just for debug */ |
1434 | inta_mask = il_read32(priv, CSR_INT_MASK); | 1434 | inta_mask = il_read32(il, CSR_INT_MASK); |
1435 | IL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", | 1435 | IL_DEBUG_ISR(il, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", |
1436 | inta, inta_mask, inta_fh); | 1436 | inta, inta_mask, inta_fh); |
1437 | } | 1437 | } |
1438 | #endif | 1438 | #endif |
1439 | 1439 | ||
1440 | spin_unlock_irqrestore(&priv->lock, flags); | 1440 | spin_unlock_irqrestore(&il->lock, flags); |
1441 | 1441 | ||
1442 | /* Since CSR_INT and CSR_FH_INT_STATUS reads and clears are not | 1442 | /* Since CSR_INT and CSR_FH_INT_STATUS reads and clears are not |
1443 | * atomic, make sure that inta covers all the interrupts that | 1443 | * atomic, make sure that inta covers all the interrupts that |
@@ -1450,13 +1450,13 @@ static void il3945_irq_tasklet(struct il_priv *priv) | |||
1450 | 1450 | ||
1451 | /* Now service all interrupt bits discovered above. */ | 1451 | /* Now service all interrupt bits discovered above. */ |
1452 | if (inta & CSR_INT_BIT_HW_ERR) { | 1452 | if (inta & CSR_INT_BIT_HW_ERR) { |
1453 | IL_ERR(priv, "Hardware error detected. Restarting.\n"); | 1453 | IL_ERR(il, "Hardware error detected. Restarting.\n"); |
1454 | 1454 | ||
1455 | /* Tell the device to stop sending interrupts */ | 1455 | /* Tell the device to stop sending interrupts */ |
1456 | il_disable_interrupts(priv); | 1456 | il_disable_interrupts(il); |
1457 | 1457 | ||
1458 | priv->isr_stats.hw++; | 1458 | il->isr_stats.hw++; |
1459 | il_irq_handle_error(priv); | 1459 | il_irq_handle_error(il); |
1460 | 1460 | ||
1461 | handled |= CSR_INT_BIT_HW_ERR; | 1461 | handled |= CSR_INT_BIT_HW_ERR; |
1462 | 1462 | ||
@@ -1464,18 +1464,18 @@ static void il3945_irq_tasklet(struct il_priv *priv) | |||
1464 | } | 1464 | } |
1465 | 1465 | ||
1466 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 1466 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
1467 | if (il_get_debug_level(priv) & (IL_DL_ISR)) { | 1467 | if (il_get_debug_level(il) & (IL_DL_ISR)) { |
1468 | /* NIC fires this, but we don't use it, redundant with WAKEUP */ | 1468 | /* NIC fires this, but we don't use it, redundant with WAKEUP */ |
1469 | if (inta & CSR_INT_BIT_SCD) { | 1469 | if (inta & CSR_INT_BIT_SCD) { |
1470 | IL_DEBUG_ISR(priv, "Scheduler finished to transmit " | 1470 | IL_DEBUG_ISR(il, "Scheduler finished to transmit " |
1471 | "the frame/frames.\n"); | 1471 | "the frame/frames.\n"); |
1472 | priv->isr_stats.sch++; | 1472 | il->isr_stats.sch++; |
1473 | } | 1473 | } |
1474 | 1474 | ||
1475 | /* Alive notification via Rx interrupt will do the real work */ | 1475 | /* Alive notification via Rx interrupt will do the real work */ |
1476 | if (inta & CSR_INT_BIT_ALIVE) { | 1476 | if (inta & CSR_INT_BIT_ALIVE) { |
1477 | IL_DEBUG_ISR(priv, "Alive interrupt\n"); | 1477 | IL_DEBUG_ISR(il, "Alive interrupt\n"); |
1478 | priv->isr_stats.alive++; | 1478 | il->isr_stats.alive++; |
1479 | } | 1479 | } |
1480 | } | 1480 | } |
1481 | #endif | 1481 | #endif |
@@ -1484,25 +1484,25 @@ static void il3945_irq_tasklet(struct il_priv *priv) | |||
1484 | 1484 | ||
1485 | /* Error detected by uCode */ | 1485 | /* Error detected by uCode */ |
1486 | if (inta & CSR_INT_BIT_SW_ERR) { | 1486 | if (inta & CSR_INT_BIT_SW_ERR) { |
1487 | IL_ERR(priv, "Microcode SW error detected. " | 1487 | IL_ERR(il, "Microcode SW error detected. " |
1488 | "Restarting 0x%X.\n", inta); | 1488 | "Restarting 0x%X.\n", inta); |
1489 | priv->isr_stats.sw++; | 1489 | il->isr_stats.sw++; |
1490 | il_irq_handle_error(priv); | 1490 | il_irq_handle_error(il); |
1491 | handled |= CSR_INT_BIT_SW_ERR; | 1491 | handled |= CSR_INT_BIT_SW_ERR; |
1492 | } | 1492 | } |
1493 | 1493 | ||
1494 | /* uCode wakes up after power-down sleep */ | 1494 | /* uCode wakes up after power-down sleep */ |
1495 | if (inta & CSR_INT_BIT_WAKEUP) { | 1495 | if (inta & CSR_INT_BIT_WAKEUP) { |
1496 | IL_DEBUG_ISR(priv, "Wakeup interrupt\n"); | 1496 | IL_DEBUG_ISR(il, "Wakeup interrupt\n"); |
1497 | il_rx_queue_update_write_ptr(priv, &priv->rxq); | 1497 | il_rx_queue_update_write_ptr(il, &il->rxq); |
1498 | il_txq_update_write_ptr(priv, &priv->txq[0]); | 1498 | il_txq_update_write_ptr(il, &il->txq[0]); |
1499 | il_txq_update_write_ptr(priv, &priv->txq[1]); | 1499 | il_txq_update_write_ptr(il, &il->txq[1]); |
1500 | il_txq_update_write_ptr(priv, &priv->txq[2]); | 1500 | il_txq_update_write_ptr(il, &il->txq[2]); |
1501 | il_txq_update_write_ptr(priv, &priv->txq[3]); | 1501 | il_txq_update_write_ptr(il, &il->txq[3]); |
1502 | il_txq_update_write_ptr(priv, &priv->txq[4]); | 1502 | il_txq_update_write_ptr(il, &il->txq[4]); |
1503 | il_txq_update_write_ptr(priv, &priv->txq[5]); | 1503 | il_txq_update_write_ptr(il, &il->txq[5]); |
1504 | 1504 | ||
1505 | priv->isr_stats.wakeup++; | 1505 | il->isr_stats.wakeup++; |
1506 | handled |= CSR_INT_BIT_WAKEUP; | 1506 | handled |= CSR_INT_BIT_WAKEUP; |
1507 | } | 1507 | } |
1508 | 1508 | ||
@@ -1510,49 +1510,49 @@ static void il3945_irq_tasklet(struct il_priv *priv) | |||
1510 | * Rx "responses" (frame-received notification), and other | 1510 | * Rx "responses" (frame-received notification), and other |
1511 | * notifications from uCode come through here*/ | 1511 | * notifications from uCode come through here*/ |
1512 | if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) { | 1512 | if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) { |
1513 | il3945_rx_handle(priv); | 1513 | il3945_rx_handle(il); |
1514 | priv->isr_stats.rx++; | 1514 | il->isr_stats.rx++; |
1515 | handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX); | 1515 | handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX); |
1516 | } | 1516 | } |
1517 | 1517 | ||
1518 | if (inta & CSR_INT_BIT_FH_TX) { | 1518 | if (inta & CSR_INT_BIT_FH_TX) { |
1519 | IL_DEBUG_ISR(priv, "Tx interrupt\n"); | 1519 | IL_DEBUG_ISR(il, "Tx interrupt\n"); |
1520 | priv->isr_stats.tx++; | 1520 | il->isr_stats.tx++; |
1521 | 1521 | ||
1522 | il_write32(priv, CSR_FH_INT_STATUS, (1 << 6)); | 1522 | il_write32(il, CSR_FH_INT_STATUS, (1 << 6)); |
1523 | il_write_direct32(priv, FH39_TCSR_CREDIT | 1523 | il_write_direct32(il, FH39_TCSR_CREDIT |
1524 | (FH39_SRVC_CHNL), 0x0); | 1524 | (FH39_SRVC_CHNL), 0x0); |
1525 | handled |= CSR_INT_BIT_FH_TX; | 1525 | handled |= CSR_INT_BIT_FH_TX; |
1526 | } | 1526 | } |
1527 | 1527 | ||
1528 | if (inta & ~handled) { | 1528 | if (inta & ~handled) { |
1529 | IL_ERR(priv, "Unhandled INTA bits 0x%08x\n", inta & ~handled); | 1529 | IL_ERR(il, "Unhandled INTA bits 0x%08x\n", inta & ~handled); |
1530 | priv->isr_stats.unhandled++; | 1530 | il->isr_stats.unhandled++; |
1531 | } | 1531 | } |
1532 | 1532 | ||
1533 | if (inta & ~priv->inta_mask) { | 1533 | if (inta & ~il->inta_mask) { |
1534 | IL_WARN(priv, "Disabled INTA bits 0x%08x were pending\n", | 1534 | IL_WARN(il, "Disabled INTA bits 0x%08x were pending\n", |
1535 | inta & ~priv->inta_mask); | 1535 | inta & ~il->inta_mask); |
1536 | IL_WARN(priv, " with FH_INT = 0x%08x\n", inta_fh); | 1536 | IL_WARN(il, " with FH_INT = 0x%08x\n", inta_fh); |
1537 | } | 1537 | } |
1538 | 1538 | ||
1539 | /* Re-enable all interrupts */ | 1539 | /* Re-enable all interrupts */ |
1540 | /* only Re-enable if disabled by irq */ | 1540 | /* only Re-enable if disabled by irq */ |
1541 | if (test_bit(STATUS_INT_ENABLED, &priv->status)) | 1541 | if (test_bit(STATUS_INT_ENABLED, &il->status)) |
1542 | il_enable_interrupts(priv); | 1542 | il_enable_interrupts(il); |
1543 | 1543 | ||
1544 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 1544 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
1545 | if (il_get_debug_level(priv) & (IL_DL_ISR)) { | 1545 | if (il_get_debug_level(il) & (IL_DL_ISR)) { |
1546 | inta = il_read32(priv, CSR_INT); | 1546 | inta = il_read32(il, CSR_INT); |
1547 | inta_mask = il_read32(priv, CSR_INT_MASK); | 1547 | inta_mask = il_read32(il, CSR_INT_MASK); |
1548 | inta_fh = il_read32(priv, CSR_FH_INT_STATUS); | 1548 | inta_fh = il_read32(il, CSR_FH_INT_STATUS); |
1549 | IL_DEBUG_ISR(priv, "End inta 0x%08x, enabled 0x%08x, fh 0x%08x, " | 1549 | IL_DEBUG_ISR(il, "End inta 0x%08x, enabled 0x%08x, fh 0x%08x, " |
1550 | "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags); | 1550 | "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags); |
1551 | } | 1551 | } |
1552 | #endif | 1552 | #endif |
1553 | } | 1553 | } |
1554 | 1554 | ||
1555 | static int il3945_get_channels_for_scan(struct il_priv *priv, | 1555 | static int il3945_get_channels_for_scan(struct il_priv *il, |
1556 | enum ieee80211_band band, | 1556 | enum ieee80211_band band, |
1557 | u8 is_active, u8 n_probes, | 1557 | u8 is_active, u8 n_probes, |
1558 | struct il3945_scan_channel *scan_ch, | 1558 | struct il3945_scan_channel *scan_ch, |
@@ -1565,28 +1565,28 @@ static int il3945_get_channels_for_scan(struct il_priv *priv, | |||
1565 | u16 active_dwell = 0; | 1565 | u16 active_dwell = 0; |
1566 | int added, i; | 1566 | int added, i; |
1567 | 1567 | ||
1568 | sband = il_get_hw_mode(priv, band); | 1568 | sband = il_get_hw_mode(il, band); |
1569 | if (!sband) | 1569 | if (!sband) |
1570 | return 0; | 1570 | return 0; |
1571 | 1571 | ||
1572 | active_dwell = il_get_active_dwell_time(priv, band, n_probes); | 1572 | active_dwell = il_get_active_dwell_time(il, band, n_probes); |
1573 | passive_dwell = il_get_passive_dwell_time(priv, band, vif); | 1573 | passive_dwell = il_get_passive_dwell_time(il, band, vif); |
1574 | 1574 | ||
1575 | if (passive_dwell <= active_dwell) | 1575 | if (passive_dwell <= active_dwell) |
1576 | passive_dwell = active_dwell + 1; | 1576 | passive_dwell = active_dwell + 1; |
1577 | 1577 | ||
1578 | for (i = 0, added = 0; i < priv->scan_request->n_channels; i++) { | 1578 | for (i = 0, added = 0; i < il->scan_request->n_channels; i++) { |
1579 | chan = priv->scan_request->channels[i]; | 1579 | chan = il->scan_request->channels[i]; |
1580 | 1580 | ||
1581 | if (chan->band != band) | 1581 | if (chan->band != band) |
1582 | continue; | 1582 | continue; |
1583 | 1583 | ||
1584 | scan_ch->channel = chan->hw_value; | 1584 | scan_ch->channel = chan->hw_value; |
1585 | 1585 | ||
1586 | ch_info = il_get_channel_info(priv, band, | 1586 | ch_info = il_get_channel_info(il, band, |
1587 | scan_ch->channel); | 1587 | scan_ch->channel); |
1588 | if (!il_is_channel_valid(ch_info)) { | 1588 | if (!il_is_channel_valid(ch_info)) { |
1589 | IL_DEBUG_SCAN(priv, | 1589 | IL_DEBUG_SCAN(il, |
1590 | "Channel %d is INVALID for this band.\n", | 1590 | "Channel %d is INVALID for this band.\n", |
1591 | scan_ch->channel); | 1591 | scan_ch->channel); |
1592 | continue; | 1592 | continue; |
@@ -1600,7 +1600,7 @@ static int il3945_get_channels_for_scan(struct il_priv *priv, | |||
1600 | if (!is_active || il_is_channel_passive(ch_info) || | 1600 | if (!is_active || il_is_channel_passive(ch_info) || |
1601 | (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN)) { | 1601 | (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN)) { |
1602 | scan_ch->type = 0; /* passive */ | 1602 | scan_ch->type = 0; /* passive */ |
1603 | if (IL_UCODE_API(priv->ucode_ver) == 1) | 1603 | if (IL_UCODE_API(il->ucode_ver) == 1) |
1604 | scan_ch->active_dwell = cpu_to_le16(passive_dwell - 1); | 1604 | scan_ch->active_dwell = cpu_to_le16(passive_dwell - 1); |
1605 | } else { | 1605 | } else { |
1606 | scan_ch->type = 1; /* active */ | 1606 | scan_ch->type = 1; /* active */ |
@@ -1610,7 +1610,7 @@ static int il3945_get_channels_for_scan(struct il_priv *priv, | |||
1610 | * scan channels (probes gets sent right away), | 1610 | * scan channels (probes gets sent right away), |
1611 | * or for passive channels (probes get se sent only after | 1611 | * or for passive channels (probes get se sent only after |
1612 | * hearing clear Rx packet).*/ | 1612 | * hearing clear Rx packet).*/ |
1613 | if (IL_UCODE_API(priv->ucode_ver) >= 2) { | 1613 | if (IL_UCODE_API(il->ucode_ver) >= 2) { |
1614 | if (n_probes) | 1614 | if (n_probes) |
1615 | scan_ch->type |= IWL39_SCAN_PROBE_MASK(n_probes); | 1615 | scan_ch->type |= IWL39_SCAN_PROBE_MASK(n_probes); |
1616 | } else { | 1616 | } else { |
@@ -1635,7 +1635,7 @@ static int il3945_get_channels_for_scan(struct il_priv *priv, | |||
1635 | */ | 1635 | */ |
1636 | } | 1636 | } |
1637 | 1637 | ||
1638 | IL_DEBUG_SCAN(priv, "Scanning %d [%s %d]\n", | 1638 | IL_DEBUG_SCAN(il, "Scanning %d [%s %d]\n", |
1639 | scan_ch->channel, | 1639 | scan_ch->channel, |
1640 | (scan_ch->type & 1) ? "ACTIVE" : "PASSIVE", | 1640 | (scan_ch->type & 1) ? "ACTIVE" : "PASSIVE", |
1641 | (scan_ch->type & 1) ? | 1641 | (scan_ch->type & 1) ? |
@@ -1645,11 +1645,11 @@ static int il3945_get_channels_for_scan(struct il_priv *priv, | |||
1645 | added++; | 1645 | added++; |
1646 | } | 1646 | } |
1647 | 1647 | ||
1648 | IL_DEBUG_SCAN(priv, "total channels to scan %d\n", added); | 1648 | IL_DEBUG_SCAN(il, "total channels to scan %d\n", added); |
1649 | return added; | 1649 | return added; |
1650 | } | 1650 | } |
1651 | 1651 | ||
1652 | static void il3945_init_hw_rates(struct il_priv *priv, | 1652 | static void il3945_init_hw_rates(struct il_priv *il, |
1653 | struct ieee80211_rate *rates) | 1653 | struct ieee80211_rate *rates) |
1654 | { | 1654 | { |
1655 | int i; | 1655 | int i; |
@@ -1675,30 +1675,30 @@ static void il3945_init_hw_rates(struct il_priv *priv, | |||
1675 | * | 1675 | * |
1676 | ******************************************************************************/ | 1676 | ******************************************************************************/ |
1677 | 1677 | ||
1678 | static void il3945_dealloc_ucode_pci(struct il_priv *priv) | 1678 | static void il3945_dealloc_ucode_pci(struct il_priv *il) |
1679 | { | 1679 | { |
1680 | il_free_fw_desc(priv->pci_dev, &priv->ucode_code); | 1680 | il_free_fw_desc(il->pci_dev, &il->ucode_code); |
1681 | il_free_fw_desc(priv->pci_dev, &priv->ucode_data); | 1681 | il_free_fw_desc(il->pci_dev, &il->ucode_data); |
1682 | il_free_fw_desc(priv->pci_dev, &priv->ucode_data_backup); | 1682 | il_free_fw_desc(il->pci_dev, &il->ucode_data_backup); |
1683 | il_free_fw_desc(priv->pci_dev, &priv->ucode_init); | 1683 | il_free_fw_desc(il->pci_dev, &il->ucode_init); |
1684 | il_free_fw_desc(priv->pci_dev, &priv->ucode_init_data); | 1684 | il_free_fw_desc(il->pci_dev, &il->ucode_init_data); |
1685 | il_free_fw_desc(priv->pci_dev, &priv->ucode_boot); | 1685 | il_free_fw_desc(il->pci_dev, &il->ucode_boot); |
1686 | } | 1686 | } |
1687 | 1687 | ||
1688 | /** | 1688 | /** |
1689 | * il3945_verify_inst_full - verify runtime uCode image in card vs. host, | 1689 | * il3945_verify_inst_full - verify runtime uCode image in card vs. host, |
1690 | * looking at all data. | 1690 | * looking at all data. |
1691 | */ | 1691 | */ |
1692 | static int il3945_verify_inst_full(struct il_priv *priv, __le32 *image, u32 len) | 1692 | static int il3945_verify_inst_full(struct il_priv *il, __le32 *image, u32 len) |
1693 | { | 1693 | { |
1694 | u32 val; | 1694 | u32 val; |
1695 | u32 save_len = len; | 1695 | u32 save_len = len; |
1696 | int rc = 0; | 1696 | int rc = 0; |
1697 | u32 errcnt; | 1697 | u32 errcnt; |
1698 | 1698 | ||
1699 | IL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len); | 1699 | IL_DEBUG_INFO(il, "ucode inst image size is %u\n", len); |
1700 | 1700 | ||
1701 | il_write_direct32(priv, HBUS_TARG_MEM_RADDR, | 1701 | il_write_direct32(il, HBUS_TARG_MEM_RADDR, |
1702 | IWL39_RTC_INST_LOWER_BOUND); | 1702 | IWL39_RTC_INST_LOWER_BOUND); |
1703 | 1703 | ||
1704 | errcnt = 0; | 1704 | errcnt = 0; |
@@ -1706,9 +1706,9 @@ static int il3945_verify_inst_full(struct il_priv *priv, __le32 *image, u32 len) | |||
1706 | /* read data comes through single port, auto-incr addr */ | 1706 | /* read data comes through single port, auto-incr addr */ |
1707 | /* NOTE: Use the debugless read so we don't flood kernel log | 1707 | /* NOTE: Use the debugless read so we don't flood kernel log |
1708 | * if IL_DL_IO is set */ | 1708 | * if IL_DL_IO is set */ |
1709 | val = _il_read_direct32(priv, HBUS_TARG_MEM_RDAT); | 1709 | val = _il_read_direct32(il, HBUS_TARG_MEM_RDAT); |
1710 | if (val != le32_to_cpu(*image)) { | 1710 | if (val != le32_to_cpu(*image)) { |
1711 | IL_ERR(priv, "uCode INST section is invalid at " | 1711 | IL_ERR(il, "uCode INST section is invalid at " |
1712 | "offset 0x%x, is 0x%x, s/b 0x%x\n", | 1712 | "offset 0x%x, is 0x%x, s/b 0x%x\n", |
1713 | save_len - len, val, le32_to_cpu(*image)); | 1713 | save_len - len, val, le32_to_cpu(*image)); |
1714 | rc = -EIO; | 1714 | rc = -EIO; |
@@ -1720,7 +1720,7 @@ static int il3945_verify_inst_full(struct il_priv *priv, __le32 *image, u32 len) | |||
1720 | 1720 | ||
1721 | 1721 | ||
1722 | if (!errcnt) | 1722 | if (!errcnt) |
1723 | IL_DEBUG_INFO(priv, | 1723 | IL_DEBUG_INFO(il, |
1724 | "ucode image in INSTRUCTION memory is good\n"); | 1724 | "ucode image in INSTRUCTION memory is good\n"); |
1725 | 1725 | ||
1726 | return rc; | 1726 | return rc; |
@@ -1732,25 +1732,25 @@ static int il3945_verify_inst_full(struct il_priv *priv, __le32 *image, u32 len) | |||
1732 | * using sample data 100 bytes apart. If these sample points are good, | 1732 | * using sample data 100 bytes apart. If these sample points are good, |
1733 | * it's a pretty good bet that everything between them is good, too. | 1733 | * it's a pretty good bet that everything between them is good, too. |
1734 | */ | 1734 | */ |
1735 | static int il3945_verify_inst_sparse(struct il_priv *priv, __le32 *image, u32 len) | 1735 | static int il3945_verify_inst_sparse(struct il_priv *il, __le32 *image, u32 len) |
1736 | { | 1736 | { |
1737 | u32 val; | 1737 | u32 val; |
1738 | int rc = 0; | 1738 | int rc = 0; |
1739 | u32 errcnt = 0; | 1739 | u32 errcnt = 0; |
1740 | u32 i; | 1740 | u32 i; |
1741 | 1741 | ||
1742 | IL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len); | 1742 | IL_DEBUG_INFO(il, "ucode inst image size is %u\n", len); |
1743 | 1743 | ||
1744 | for (i = 0; i < len; i += 100, image += 100/sizeof(u32)) { | 1744 | for (i = 0; i < len; i += 100, image += 100/sizeof(u32)) { |
1745 | /* read data comes through single port, auto-incr addr */ | 1745 | /* read data comes through single port, auto-incr addr */ |
1746 | /* NOTE: Use the debugless read so we don't flood kernel log | 1746 | /* NOTE: Use the debugless read so we don't flood kernel log |
1747 | * if IL_DL_IO is set */ | 1747 | * if IL_DL_IO is set */ |
1748 | il_write_direct32(priv, HBUS_TARG_MEM_RADDR, | 1748 | il_write_direct32(il, HBUS_TARG_MEM_RADDR, |
1749 | i + IWL39_RTC_INST_LOWER_BOUND); | 1749 | i + IWL39_RTC_INST_LOWER_BOUND); |
1750 | val = _il_read_direct32(priv, HBUS_TARG_MEM_RDAT); | 1750 | val = _il_read_direct32(il, HBUS_TARG_MEM_RDAT); |
1751 | if (val != le32_to_cpu(*image)) { | 1751 | if (val != le32_to_cpu(*image)) { |
1752 | #if 0 /* Enable this if you want to see details */ | 1752 | #if 0 /* Enable this if you want to see details */ |
1753 | IL_ERR(priv, "uCode INST section is invalid at " | 1753 | IL_ERR(il, "uCode INST section is invalid at " |
1754 | "offset 0x%x, is 0x%x, s/b 0x%x\n", | 1754 | "offset 0x%x, is 0x%x, s/b 0x%x\n", |
1755 | i, val, *image); | 1755 | i, val, *image); |
1756 | #endif | 1756 | #endif |
@@ -1769,55 +1769,55 @@ static int il3945_verify_inst_sparse(struct il_priv *priv, __le32 *image, u32 le | |||
1769 | * il3945_verify_ucode - determine which instruction image is in SRAM, | 1769 | * il3945_verify_ucode - determine which instruction image is in SRAM, |
1770 | * and verify its contents | 1770 | * and verify its contents |
1771 | */ | 1771 | */ |
1772 | static int il3945_verify_ucode(struct il_priv *priv) | 1772 | static int il3945_verify_ucode(struct il_priv *il) |
1773 | { | 1773 | { |
1774 | __le32 *image; | 1774 | __le32 *image; |
1775 | u32 len; | 1775 | u32 len; |
1776 | int rc = 0; | 1776 | int rc = 0; |
1777 | 1777 | ||
1778 | /* Try bootstrap */ | 1778 | /* Try bootstrap */ |
1779 | image = (__le32 *)priv->ucode_boot.v_addr; | 1779 | image = (__le32 *)il->ucode_boot.v_addr; |
1780 | len = priv->ucode_boot.len; | 1780 | len = il->ucode_boot.len; |
1781 | rc = il3945_verify_inst_sparse(priv, image, len); | 1781 | rc = il3945_verify_inst_sparse(il, image, len); |
1782 | if (rc == 0) { | 1782 | if (rc == 0) { |
1783 | IL_DEBUG_INFO(priv, "Bootstrap uCode is good in inst SRAM\n"); | 1783 | IL_DEBUG_INFO(il, "Bootstrap uCode is good in inst SRAM\n"); |
1784 | return 0; | 1784 | return 0; |
1785 | } | 1785 | } |
1786 | 1786 | ||
1787 | /* Try initialize */ | 1787 | /* Try initialize */ |
1788 | image = (__le32 *)priv->ucode_init.v_addr; | 1788 | image = (__le32 *)il->ucode_init.v_addr; |
1789 | len = priv->ucode_init.len; | 1789 | len = il->ucode_init.len; |
1790 | rc = il3945_verify_inst_sparse(priv, image, len); | 1790 | rc = il3945_verify_inst_sparse(il, image, len); |
1791 | if (rc == 0) { | 1791 | if (rc == 0) { |
1792 | IL_DEBUG_INFO(priv, "Initialize uCode is good in inst SRAM\n"); | 1792 | IL_DEBUG_INFO(il, "Initialize uCode is good in inst SRAM\n"); |
1793 | return 0; | 1793 | return 0; |
1794 | } | 1794 | } |
1795 | 1795 | ||
1796 | /* Try runtime/protocol */ | 1796 | /* Try runtime/protocol */ |
1797 | image = (__le32 *)priv->ucode_code.v_addr; | 1797 | image = (__le32 *)il->ucode_code.v_addr; |
1798 | len = priv->ucode_code.len; | 1798 | len = il->ucode_code.len; |
1799 | rc = il3945_verify_inst_sparse(priv, image, len); | 1799 | rc = il3945_verify_inst_sparse(il, image, len); |
1800 | if (rc == 0) { | 1800 | if (rc == 0) { |
1801 | IL_DEBUG_INFO(priv, "Runtime uCode is good in inst SRAM\n"); | 1801 | IL_DEBUG_INFO(il, "Runtime uCode is good in inst SRAM\n"); |
1802 | return 0; | 1802 | return 0; |
1803 | } | 1803 | } |
1804 | 1804 | ||
1805 | IL_ERR(priv, "NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n"); | 1805 | IL_ERR(il, "NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n"); |
1806 | 1806 | ||
1807 | /* Since nothing seems to match, show first several data entries in | 1807 | /* Since nothing seems to match, show first several data entries in |
1808 | * instruction SRAM, so maybe visual inspection will give a clue. | 1808 | * instruction SRAM, so maybe visual inspection will give a clue. |
1809 | * Selection of bootstrap image (vs. other images) is arbitrary. */ | 1809 | * Selection of bootstrap image (vs. other images) is arbitrary. */ |
1810 | image = (__le32 *)priv->ucode_boot.v_addr; | 1810 | image = (__le32 *)il->ucode_boot.v_addr; |
1811 | len = priv->ucode_boot.len; | 1811 | len = il->ucode_boot.len; |
1812 | rc = il3945_verify_inst_full(priv, image, len); | 1812 | rc = il3945_verify_inst_full(il, image, len); |
1813 | 1813 | ||
1814 | return rc; | 1814 | return rc; |
1815 | } | 1815 | } |
1816 | 1816 | ||
1817 | static void il3945_nic_start(struct il_priv *priv) | 1817 | static void il3945_nic_start(struct il_priv *il) |
1818 | { | 1818 | { |
1819 | /* Remove all resets to allow NIC to operate */ | 1819 | /* Remove all resets to allow NIC to operate */ |
1820 | il_write32(priv, CSR_RESET, 0); | 1820 | il_write32(il, CSR_RESET, 0); |
1821 | } | 1821 | } |
1822 | 1822 | ||
1823 | #define IWL3945_UCODE_GET(item) \ | 1823 | #define IWL3945_UCODE_GET(item) \ |
@@ -1847,15 +1847,15 @@ IWL3945_UCODE_GET(boot_size); | |||
1847 | * | 1847 | * |
1848 | * Copy into buffers for card to fetch via bus-mastering | 1848 | * Copy into buffers for card to fetch via bus-mastering |
1849 | */ | 1849 | */ |
1850 | static int il3945_read_ucode(struct il_priv *priv) | 1850 | static int il3945_read_ucode(struct il_priv *il) |
1851 | { | 1851 | { |
1852 | const struct il_ucode_header *ucode; | 1852 | const struct il_ucode_header *ucode; |
1853 | int ret = -EINVAL, index; | 1853 | int ret = -EINVAL, index; |
1854 | const struct firmware *ucode_raw; | 1854 | const struct firmware *ucode_raw; |
1855 | /* firmware file name contains uCode/driver compatibility version */ | 1855 | /* firmware file name contains uCode/driver compatibility version */ |
1856 | const char *name_pre = priv->cfg->fw_name_pre; | 1856 | const char *name_pre = il->cfg->fw_name_pre; |
1857 | const unsigned int api_max = priv->cfg->ucode_api_max; | 1857 | const unsigned int api_max = il->cfg->ucode_api_max; |
1858 | const unsigned int api_min = priv->cfg->ucode_api_min; | 1858 | const unsigned int api_min = il->cfg->ucode_api_min; |
1859 | char buf[25]; | 1859 | char buf[25]; |
1860 | u8 *src; | 1860 | u8 *src; |
1861 | size_t len; | 1861 | size_t len; |
@@ -1865,9 +1865,9 @@ static int il3945_read_ucode(struct il_priv *priv) | |||
1865 | * request_firmware() is synchronous, file is in memory on return. */ | 1865 | * request_firmware() is synchronous, file is in memory on return. */ |
1866 | for (index = api_max; index >= api_min; index--) { | 1866 | for (index = api_max; index >= api_min; index--) { |
1867 | sprintf(buf, "%s%u%s", name_pre, index, ".ucode"); | 1867 | sprintf(buf, "%s%u%s", name_pre, index, ".ucode"); |
1868 | ret = request_firmware(&ucode_raw, buf, &priv->pci_dev->dev); | 1868 | ret = request_firmware(&ucode_raw, buf, &il->pci_dev->dev); |
1869 | if (ret < 0) { | 1869 | if (ret < 0) { |
1870 | IL_ERR(priv, "%s firmware file req failed: %d\n", | 1870 | IL_ERR(il, "%s firmware file req failed: %d\n", |
1871 | buf, ret); | 1871 | buf, ret); |
1872 | if (ret == -ENOENT) | 1872 | if (ret == -ENOENT) |
1873 | continue; | 1873 | continue; |
@@ -1875,11 +1875,11 @@ static int il3945_read_ucode(struct il_priv *priv) | |||
1875 | goto error; | 1875 | goto error; |
1876 | } else { | 1876 | } else { |
1877 | if (index < api_max) | 1877 | if (index < api_max) |
1878 | IL_ERR(priv, "Loaded firmware %s, " | 1878 | IL_ERR(il, "Loaded firmware %s, " |
1879 | "which is deprecated. " | 1879 | "which is deprecated. " |
1880 | " Please use API v%u instead.\n", | 1880 | " Please use API v%u instead.\n", |
1881 | buf, api_max); | 1881 | buf, api_max); |
1882 | IL_DEBUG_INFO(priv, "Got firmware '%s' file " | 1882 | IL_DEBUG_INFO(il, "Got firmware '%s' file " |
1883 | "(%zd bytes) from disk\n", | 1883 | "(%zd bytes) from disk\n", |
1884 | buf, ucode_raw->size); | 1884 | buf, ucode_raw->size); |
1885 | break; | 1885 | break; |
@@ -1891,7 +1891,7 @@ static int il3945_read_ucode(struct il_priv *priv) | |||
1891 | 1891 | ||
1892 | /* Make sure that we got at least our header! */ | 1892 | /* Make sure that we got at least our header! */ |
1893 | if (ucode_raw->size < il3945_ucode_get_header_size(1)) { | 1893 | if (ucode_raw->size < il3945_ucode_get_header_size(1)) { |
1894 | IL_ERR(priv, "File size way too small!\n"); | 1894 | IL_ERR(il, "File size way too small!\n"); |
1895 | ret = -EINVAL; | 1895 | ret = -EINVAL; |
1896 | goto err_release; | 1896 | goto err_release; |
1897 | } | 1897 | } |
@@ -1899,8 +1899,8 @@ static int il3945_read_ucode(struct il_priv *priv) | |||
1899 | /* Data from ucode file: header followed by uCode images */ | 1899 | /* Data from ucode file: header followed by uCode images */ |
1900 | ucode = (struct il_ucode_header *)ucode_raw->data; | 1900 | ucode = (struct il_ucode_header *)ucode_raw->data; |
1901 | 1901 | ||
1902 | priv->ucode_ver = le32_to_cpu(ucode->ver); | 1902 | il->ucode_ver = le32_to_cpu(ucode->ver); |
1903 | api_ver = IL_UCODE_API(priv->ucode_ver); | 1903 | api_ver = IL_UCODE_API(il->ucode_ver); |
1904 | inst_size = il3945_ucode_get_inst_size(ucode); | 1904 | inst_size = il3945_ucode_get_inst_size(ucode); |
1905 | data_size = il3945_ucode_get_data_size(ucode); | 1905 | data_size = il3945_ucode_get_data_size(ucode); |
1906 | init_size = il3945_ucode_get_init_size(ucode); | 1906 | init_size = il3945_ucode_get_init_size(ucode); |
@@ -1913,44 +1913,44 @@ static int il3945_read_ucode(struct il_priv *priv) | |||
1913 | * on the API version read from firmware header from here on forward */ | 1913 | * on the API version read from firmware header from here on forward */ |
1914 | 1914 | ||
1915 | if (api_ver < api_min || api_ver > api_max) { | 1915 | if (api_ver < api_min || api_ver > api_max) { |
1916 | IL_ERR(priv, "Driver unable to support your firmware API. " | 1916 | IL_ERR(il, "Driver unable to support your firmware API. " |
1917 | "Driver supports v%u, firmware is v%u.\n", | 1917 | "Driver supports v%u, firmware is v%u.\n", |
1918 | api_max, api_ver); | 1918 | api_max, api_ver); |
1919 | priv->ucode_ver = 0; | 1919 | il->ucode_ver = 0; |
1920 | ret = -EINVAL; | 1920 | ret = -EINVAL; |
1921 | goto err_release; | 1921 | goto err_release; |
1922 | } | 1922 | } |
1923 | if (api_ver != api_max) | 1923 | if (api_ver != api_max) |
1924 | IL_ERR(priv, "Firmware has old API version. Expected %u, " | 1924 | IL_ERR(il, "Firmware has old API version. Expected %u, " |
1925 | "got %u. New firmware can be obtained " | 1925 | "got %u. New firmware can be obtained " |
1926 | "from http://www.intellinuxwireless.org.\n", | 1926 | "from http://www.intellinuxwireless.org.\n", |
1927 | api_max, api_ver); | 1927 | api_max, api_ver); |
1928 | 1928 | ||
1929 | IL_INFO(priv, "loaded firmware version %u.%u.%u.%u\n", | 1929 | IL_INFO(il, "loaded firmware version %u.%u.%u.%u\n", |
1930 | IL_UCODE_MAJOR(priv->ucode_ver), | 1930 | IL_UCODE_MAJOR(il->ucode_ver), |
1931 | IL_UCODE_MINOR(priv->ucode_ver), | 1931 | IL_UCODE_MINOR(il->ucode_ver), |
1932 | IL_UCODE_API(priv->ucode_ver), | 1932 | IL_UCODE_API(il->ucode_ver), |
1933 | IL_UCODE_SERIAL(priv->ucode_ver)); | 1933 | IL_UCODE_SERIAL(il->ucode_ver)); |
1934 | 1934 | ||
1935 | snprintf(priv->hw->wiphy->fw_version, | 1935 | snprintf(il->hw->wiphy->fw_version, |
1936 | sizeof(priv->hw->wiphy->fw_version), | 1936 | sizeof(il->hw->wiphy->fw_version), |
1937 | "%u.%u.%u.%u", | 1937 | "%u.%u.%u.%u", |
1938 | IL_UCODE_MAJOR(priv->ucode_ver), | 1938 | IL_UCODE_MAJOR(il->ucode_ver), |
1939 | IL_UCODE_MINOR(priv->ucode_ver), | 1939 | IL_UCODE_MINOR(il->ucode_ver), |
1940 | IL_UCODE_API(priv->ucode_ver), | 1940 | IL_UCODE_API(il->ucode_ver), |
1941 | IL_UCODE_SERIAL(priv->ucode_ver)); | 1941 | IL_UCODE_SERIAL(il->ucode_ver)); |
1942 | 1942 | ||
1943 | IL_DEBUG_INFO(priv, "f/w package hdr ucode version raw = 0x%x\n", | 1943 | IL_DEBUG_INFO(il, "f/w package hdr ucode version raw = 0x%x\n", |
1944 | priv->ucode_ver); | 1944 | il->ucode_ver); |
1945 | IL_DEBUG_INFO(priv, "f/w package hdr runtime inst size = %u\n", | 1945 | IL_DEBUG_INFO(il, "f/w package hdr runtime inst size = %u\n", |
1946 | inst_size); | 1946 | inst_size); |
1947 | IL_DEBUG_INFO(priv, "f/w package hdr runtime data size = %u\n", | 1947 | IL_DEBUG_INFO(il, "f/w package hdr runtime data size = %u\n", |
1948 | data_size); | 1948 | data_size); |
1949 | IL_DEBUG_INFO(priv, "f/w package hdr init inst size = %u\n", | 1949 | IL_DEBUG_INFO(il, "f/w package hdr init inst size = %u\n", |
1950 | init_size); | 1950 | init_size); |
1951 | IL_DEBUG_INFO(priv, "f/w package hdr init data size = %u\n", | 1951 | IL_DEBUG_INFO(il, "f/w package hdr init data size = %u\n", |
1952 | init_data_size); | 1952 | init_data_size); |
1953 | IL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %u\n", | 1953 | IL_DEBUG_INFO(il, "f/w package hdr boot inst size = %u\n", |
1954 | boot_size); | 1954 | boot_size); |
1955 | 1955 | ||
1956 | 1956 | ||
@@ -1959,7 +1959,7 @@ static int il3945_read_ucode(struct il_priv *priv) | |||
1959 | inst_size + data_size + init_size + | 1959 | inst_size + data_size + init_size + |
1960 | init_data_size + boot_size) { | 1960 | init_data_size + boot_size) { |
1961 | 1961 | ||
1962 | IL_DEBUG_INFO(priv, | 1962 | IL_DEBUG_INFO(il, |
1963 | "uCode file size %zd does not match expected size\n", | 1963 | "uCode file size %zd does not match expected size\n", |
1964 | ucode_raw->size); | 1964 | ucode_raw->size); |
1965 | ret = -EINVAL; | 1965 | ret = -EINVAL; |
@@ -1968,34 +1968,34 @@ static int il3945_read_ucode(struct il_priv *priv) | |||
1968 | 1968 | ||
1969 | /* Verify that uCode images will fit in card's SRAM */ | 1969 | /* Verify that uCode images will fit in card's SRAM */ |
1970 | if (inst_size > IWL39_MAX_INST_SIZE) { | 1970 | if (inst_size > IWL39_MAX_INST_SIZE) { |
1971 | IL_DEBUG_INFO(priv, "uCode instr len %d too large to fit in\n", | 1971 | IL_DEBUG_INFO(il, "uCode instr len %d too large to fit in\n", |
1972 | inst_size); | 1972 | inst_size); |
1973 | ret = -EINVAL; | 1973 | ret = -EINVAL; |
1974 | goto err_release; | 1974 | goto err_release; |
1975 | } | 1975 | } |
1976 | 1976 | ||
1977 | if (data_size > IWL39_MAX_DATA_SIZE) { | 1977 | if (data_size > IWL39_MAX_DATA_SIZE) { |
1978 | IL_DEBUG_INFO(priv, "uCode data len %d too large to fit in\n", | 1978 | IL_DEBUG_INFO(il, "uCode data len %d too large to fit in\n", |
1979 | data_size); | 1979 | data_size); |
1980 | ret = -EINVAL; | 1980 | ret = -EINVAL; |
1981 | goto err_release; | 1981 | goto err_release; |
1982 | } | 1982 | } |
1983 | if (init_size > IWL39_MAX_INST_SIZE) { | 1983 | if (init_size > IWL39_MAX_INST_SIZE) { |
1984 | IL_DEBUG_INFO(priv, | 1984 | IL_DEBUG_INFO(il, |
1985 | "uCode init instr len %d too large to fit in\n", | 1985 | "uCode init instr len %d too large to fit in\n", |
1986 | init_size); | 1986 | init_size); |
1987 | ret = -EINVAL; | 1987 | ret = -EINVAL; |
1988 | goto err_release; | 1988 | goto err_release; |
1989 | } | 1989 | } |
1990 | if (init_data_size > IWL39_MAX_DATA_SIZE) { | 1990 | if (init_data_size > IWL39_MAX_DATA_SIZE) { |
1991 | IL_DEBUG_INFO(priv, | 1991 | IL_DEBUG_INFO(il, |
1992 | "uCode init data len %d too large to fit in\n", | 1992 | "uCode init data len %d too large to fit in\n", |
1993 | init_data_size); | 1993 | init_data_size); |
1994 | ret = -EINVAL; | 1994 | ret = -EINVAL; |
1995 | goto err_release; | 1995 | goto err_release; |
1996 | } | 1996 | } |
1997 | if (boot_size > IWL39_MAX_BSM_SIZE) { | 1997 | if (boot_size > IWL39_MAX_BSM_SIZE) { |
1998 | IL_DEBUG_INFO(priv, | 1998 | IL_DEBUG_INFO(il, |
1999 | "uCode boot instr len %d too large to fit in\n", | 1999 | "uCode boot instr len %d too large to fit in\n", |
2000 | boot_size); | 2000 | boot_size); |
2001 | ret = -EINVAL; | 2001 | ret = -EINVAL; |
@@ -2007,37 +2007,37 @@ static int il3945_read_ucode(struct il_priv *priv) | |||
2007 | /* Runtime instructions and 2 copies of data: | 2007 | /* Runtime instructions and 2 copies of data: |
2008 | * 1) unmodified from disk | 2008 | * 1) unmodified from disk |
2009 | * 2) backup cache for save/restore during power-downs */ | 2009 | * 2) backup cache for save/restore during power-downs */ |
2010 | priv->ucode_code.len = inst_size; | 2010 | il->ucode_code.len = inst_size; |
2011 | il_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); | 2011 | il_alloc_fw_desc(il->pci_dev, &il->ucode_code); |
2012 | 2012 | ||
2013 | priv->ucode_data.len = data_size; | 2013 | il->ucode_data.len = data_size; |
2014 | il_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); | 2014 | il_alloc_fw_desc(il->pci_dev, &il->ucode_data); |
2015 | 2015 | ||
2016 | priv->ucode_data_backup.len = data_size; | 2016 | il->ucode_data_backup.len = data_size; |
2017 | il_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); | 2017 | il_alloc_fw_desc(il->pci_dev, &il->ucode_data_backup); |
2018 | 2018 | ||
2019 | if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr || | 2019 | if (!il->ucode_code.v_addr || !il->ucode_data.v_addr || |
2020 | !priv->ucode_data_backup.v_addr) | 2020 | !il->ucode_data_backup.v_addr) |
2021 | goto err_pci_alloc; | 2021 | goto err_pci_alloc; |
2022 | 2022 | ||
2023 | /* Initialization instructions and data */ | 2023 | /* Initialization instructions and data */ |
2024 | if (init_size && init_data_size) { | 2024 | if (init_size && init_data_size) { |
2025 | priv->ucode_init.len = init_size; | 2025 | il->ucode_init.len = init_size; |
2026 | il_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); | 2026 | il_alloc_fw_desc(il->pci_dev, &il->ucode_init); |
2027 | 2027 | ||
2028 | priv->ucode_init_data.len = init_data_size; | 2028 | il->ucode_init_data.len = init_data_size; |
2029 | il_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); | 2029 | il_alloc_fw_desc(il->pci_dev, &il->ucode_init_data); |
2030 | 2030 | ||
2031 | if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr) | 2031 | if (!il->ucode_init.v_addr || !il->ucode_init_data.v_addr) |
2032 | goto err_pci_alloc; | 2032 | goto err_pci_alloc; |
2033 | } | 2033 | } |
2034 | 2034 | ||
2035 | /* Bootstrap (instructions only, no data) */ | 2035 | /* Bootstrap (instructions only, no data) */ |
2036 | if (boot_size) { | 2036 | if (boot_size) { |
2037 | priv->ucode_boot.len = boot_size; | 2037 | il->ucode_boot.len = boot_size; |
2038 | il_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); | 2038 | il_alloc_fw_desc(il->pci_dev, &il->ucode_boot); |
2039 | 2039 | ||
2040 | if (!priv->ucode_boot.v_addr) | 2040 | if (!il->ucode_boot.v_addr) |
2041 | goto err_pci_alloc; | 2041 | goto err_pci_alloc; |
2042 | } | 2042 | } |
2043 | 2043 | ||
@@ -2045,55 +2045,55 @@ static int il3945_read_ucode(struct il_priv *priv) | |||
2045 | 2045 | ||
2046 | /* Runtime instructions (first block of data in file) */ | 2046 | /* Runtime instructions (first block of data in file) */ |
2047 | len = inst_size; | 2047 | len = inst_size; |
2048 | IL_DEBUG_INFO(priv, | 2048 | IL_DEBUG_INFO(il, |
2049 | "Copying (but not loading) uCode instr len %zd\n", len); | 2049 | "Copying (but not loading) uCode instr len %zd\n", len); |
2050 | memcpy(priv->ucode_code.v_addr, src, len); | 2050 | memcpy(il->ucode_code.v_addr, src, len); |
2051 | src += len; | 2051 | src += len; |
2052 | 2052 | ||
2053 | IL_DEBUG_INFO(priv, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n", | 2053 | IL_DEBUG_INFO(il, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n", |
2054 | priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr); | 2054 | il->ucode_code.v_addr, (u32)il->ucode_code.p_addr); |
2055 | 2055 | ||
2056 | /* Runtime data (2nd block) | 2056 | /* Runtime data (2nd block) |
2057 | * NOTE: Copy into backup buffer will be done in il3945_up() */ | 2057 | * NOTE: Copy into backup buffer will be done in il3945_up() */ |
2058 | len = data_size; | 2058 | len = data_size; |
2059 | IL_DEBUG_INFO(priv, | 2059 | IL_DEBUG_INFO(il, |
2060 | "Copying (but not loading) uCode data len %zd\n", len); | 2060 | "Copying (but not loading) uCode data len %zd\n", len); |
2061 | memcpy(priv->ucode_data.v_addr, src, len); | 2061 | memcpy(il->ucode_data.v_addr, src, len); |
2062 | memcpy(priv->ucode_data_backup.v_addr, src, len); | 2062 | memcpy(il->ucode_data_backup.v_addr, src, len); |
2063 | src += len; | 2063 | src += len; |
2064 | 2064 | ||
2065 | /* Initialization instructions (3rd block) */ | 2065 | /* Initialization instructions (3rd block) */ |
2066 | if (init_size) { | 2066 | if (init_size) { |
2067 | len = init_size; | 2067 | len = init_size; |
2068 | IL_DEBUG_INFO(priv, | 2068 | IL_DEBUG_INFO(il, |
2069 | "Copying (but not loading) init instr len %zd\n", len); | 2069 | "Copying (but not loading) init instr len %zd\n", len); |
2070 | memcpy(priv->ucode_init.v_addr, src, len); | 2070 | memcpy(il->ucode_init.v_addr, src, len); |
2071 | src += len; | 2071 | src += len; |
2072 | } | 2072 | } |
2073 | 2073 | ||
2074 | /* Initialization data (4th block) */ | 2074 | /* Initialization data (4th block) */ |
2075 | if (init_data_size) { | 2075 | if (init_data_size) { |
2076 | len = init_data_size; | 2076 | len = init_data_size; |
2077 | IL_DEBUG_INFO(priv, | 2077 | IL_DEBUG_INFO(il, |
2078 | "Copying (but not loading) init data len %zd\n", len); | 2078 | "Copying (but not loading) init data len %zd\n", len); |
2079 | memcpy(priv->ucode_init_data.v_addr, src, len); | 2079 | memcpy(il->ucode_init_data.v_addr, src, len); |
2080 | src += len; | 2080 | src += len; |
2081 | } | 2081 | } |
2082 | 2082 | ||
2083 | /* Bootstrap instructions (5th block) */ | 2083 | /* Bootstrap instructions (5th block) */ |
2084 | len = boot_size; | 2084 | len = boot_size; |
2085 | IL_DEBUG_INFO(priv, | 2085 | IL_DEBUG_INFO(il, |
2086 | "Copying (but not loading) boot instr len %zd\n", len); | 2086 | "Copying (but not loading) boot instr len %zd\n", len); |
2087 | memcpy(priv->ucode_boot.v_addr, src, len); | 2087 | memcpy(il->ucode_boot.v_addr, src, len); |
2088 | 2088 | ||
2089 | /* We have our copies now, allow OS release its copies */ | 2089 | /* We have our copies now, allow OS release its copies */ |
2090 | release_firmware(ucode_raw); | 2090 | release_firmware(ucode_raw); |
2091 | return 0; | 2091 | return 0; |
2092 | 2092 | ||
2093 | err_pci_alloc: | 2093 | err_pci_alloc: |
2094 | IL_ERR(priv, "failed to allocate pci memory\n"); | 2094 | IL_ERR(il, "failed to allocate pci memory\n"); |
2095 | ret = -ENOMEM; | 2095 | ret = -ENOMEM; |
2096 | il3945_dealloc_ucode_pci(priv); | 2096 | il3945_dealloc_ucode_pci(il); |
2097 | 2097 | ||
2098 | err_release: | 2098 | err_release: |
2099 | release_firmware(ucode_raw); | 2099 | release_firmware(ucode_raw); |
@@ -2112,27 +2112,27 @@ static int il3945_read_ucode(struct il_priv *priv) | |||
2112 | * We need to replace them to load runtime uCode inst and data, | 2112 | * We need to replace them to load runtime uCode inst and data, |
2113 | * and to save runtime data when powering down. | 2113 | * and to save runtime data when powering down. |
2114 | */ | 2114 | */ |
2115 | static int il3945_set_ucode_ptrs(struct il_priv *priv) | 2115 | static int il3945_set_ucode_ptrs(struct il_priv *il) |
2116 | { | 2116 | { |
2117 | dma_addr_t pinst; | 2117 | dma_addr_t pinst; |
2118 | dma_addr_t pdata; | 2118 | dma_addr_t pdata; |
2119 | 2119 | ||
2120 | /* bits 31:0 for 3945 */ | 2120 | /* bits 31:0 for 3945 */ |
2121 | pinst = priv->ucode_code.p_addr; | 2121 | pinst = il->ucode_code.p_addr; |
2122 | pdata = priv->ucode_data_backup.p_addr; | 2122 | pdata = il->ucode_data_backup.p_addr; |
2123 | 2123 | ||
2124 | /* Tell bootstrap uCode where to find image to load */ | 2124 | /* Tell bootstrap uCode where to find image to load */ |
2125 | il_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); | 2125 | il_write_prph(il, BSM_DRAM_INST_PTR_REG, pinst); |
2126 | il_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); | 2126 | il_write_prph(il, BSM_DRAM_DATA_PTR_REG, pdata); |
2127 | il_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, | 2127 | il_write_prph(il, BSM_DRAM_DATA_BYTECOUNT_REG, |
2128 | priv->ucode_data.len); | 2128 | il->ucode_data.len); |
2129 | 2129 | ||
2130 | /* Inst byte count must be last to set up, bit 31 signals uCode | 2130 | /* Inst byte count must be last to set up, bit 31 signals uCode |
2131 | * that all new ptr/size info is in place */ | 2131 | * that all new ptr/size info is in place */ |
2132 | il_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, | 2132 | il_write_prph(il, BSM_DRAM_INST_BYTECOUNT_REG, |
2133 | priv->ucode_code.len | BSM_DRAM_INST_LOAD); | 2133 | il->ucode_code.len | BSM_DRAM_INST_LOAD); |
2134 | 2134 | ||
2135 | IL_DEBUG_INFO(priv, "Runtime uCode pointers are set.\n"); | 2135 | IL_DEBUG_INFO(il, "Runtime uCode pointers are set.\n"); |
2136 | 2136 | ||
2137 | return 0; | 2137 | return 0; |
2138 | } | 2138 | } |
@@ -2144,40 +2144,40 @@ static int il3945_set_ucode_ptrs(struct il_priv *priv) | |||
2144 | * | 2144 | * |
2145 | * Tell "initialize" uCode to go ahead and load the runtime uCode. | 2145 | * Tell "initialize" uCode to go ahead and load the runtime uCode. |
2146 | */ | 2146 | */ |
2147 | static void il3945_init_alive_start(struct il_priv *priv) | 2147 | static void il3945_init_alive_start(struct il_priv *il) |
2148 | { | 2148 | { |
2149 | /* Check alive response for "valid" sign from uCode */ | 2149 | /* Check alive response for "valid" sign from uCode */ |
2150 | if (priv->card_alive_init.is_valid != UCODE_VALID_OK) { | 2150 | if (il->card_alive_init.is_valid != UCODE_VALID_OK) { |
2151 | /* We had an error bringing up the hardware, so take it | 2151 | /* We had an error bringing up the hardware, so take it |
2152 | * all the way back down so we can try again */ | 2152 | * all the way back down so we can try again */ |
2153 | IL_DEBUG_INFO(priv, "Initialize Alive failed.\n"); | 2153 | IL_DEBUG_INFO(il, "Initialize Alive failed.\n"); |
2154 | goto restart; | 2154 | goto restart; |
2155 | } | 2155 | } |
2156 | 2156 | ||
2157 | /* Bootstrap uCode has loaded initialize uCode ... verify inst image. | 2157 | /* Bootstrap uCode has loaded initialize uCode ... verify inst image. |
2158 | * This is a paranoid check, because we would not have gotten the | 2158 | * This is a paranoid check, because we would not have gotten the |
2159 | * "initialize" alive if code weren't properly loaded. */ | 2159 | * "initialize" alive if code weren't properly loaded. */ |
2160 | if (il3945_verify_ucode(priv)) { | 2160 | if (il3945_verify_ucode(il)) { |
2161 | /* Runtime instruction load was bad; | 2161 | /* Runtime instruction load was bad; |
2162 | * take it all the way back down so we can try again */ | 2162 | * take it all the way back down so we can try again */ |
2163 | IL_DEBUG_INFO(priv, "Bad \"initialize\" uCode load.\n"); | 2163 | IL_DEBUG_INFO(il, "Bad \"initialize\" uCode load.\n"); |
2164 | goto restart; | 2164 | goto restart; |
2165 | } | 2165 | } |
2166 | 2166 | ||
2167 | /* Send pointers to protocol/runtime uCode image ... init code will | 2167 | /* Send pointers to protocol/runtime uCode image ... init code will |
2168 | * load and launch runtime uCode, which will send us another "Alive" | 2168 | * load and launch runtime uCode, which will send us another "Alive" |
2169 | * notification. */ | 2169 | * notification. */ |
2170 | IL_DEBUG_INFO(priv, "Initialization Alive received.\n"); | 2170 | IL_DEBUG_INFO(il, "Initialization Alive received.\n"); |
2171 | if (il3945_set_ucode_ptrs(priv)) { | 2171 | if (il3945_set_ucode_ptrs(il)) { |
2172 | /* Runtime instruction load won't happen; | 2172 | /* Runtime instruction load won't happen; |
2173 | * take it all the way back down so we can try again */ | 2173 | * take it all the way back down so we can try again */ |
2174 | IL_DEBUG_INFO(priv, "Couldn't set up uCode pointers.\n"); | 2174 | IL_DEBUG_INFO(il, "Couldn't set up uCode pointers.\n"); |
2175 | goto restart; | 2175 | goto restart; |
2176 | } | 2176 | } |
2177 | return; | 2177 | return; |
2178 | 2178 | ||
2179 | restart: | 2179 | restart: |
2180 | queue_work(priv->workqueue, &priv->restart); | 2180 | queue_work(il->workqueue, &il->restart); |
2181 | } | 2181 | } |
2182 | 2182 | ||
2183 | /** | 2183 | /** |
@@ -2185,65 +2185,65 @@ static void il3945_init_alive_start(struct il_priv *priv) | |||
2185 | * from protocol/runtime uCode (initialization uCode's | 2185 | * from protocol/runtime uCode (initialization uCode's |
2186 | * Alive gets handled by il3945_init_alive_start()). | 2186 | * Alive gets handled by il3945_init_alive_start()). |
2187 | */ | 2187 | */ |
2188 | static void il3945_alive_start(struct il_priv *priv) | 2188 | static void il3945_alive_start(struct il_priv *il) |
2189 | { | 2189 | { |
2190 | int thermal_spin = 0; | 2190 | int thermal_spin = 0; |
2191 | u32 rfkill; | 2191 | u32 rfkill; |
2192 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 2192 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
2193 | 2193 | ||
2194 | IL_DEBUG_INFO(priv, "Runtime Alive received.\n"); | 2194 | IL_DEBUG_INFO(il, "Runtime Alive received.\n"); |
2195 | 2195 | ||
2196 | if (priv->card_alive.is_valid != UCODE_VALID_OK) { | 2196 | if (il->card_alive.is_valid != UCODE_VALID_OK) { |
2197 | /* We had an error bringing up the hardware, so take it | 2197 | /* We had an error bringing up the hardware, so take it |
2198 | * all the way back down so we can try again */ | 2198 | * all the way back down so we can try again */ |
2199 | IL_DEBUG_INFO(priv, "Alive failed.\n"); | 2199 | IL_DEBUG_INFO(il, "Alive failed.\n"); |
2200 | goto restart; | 2200 | goto restart; |
2201 | } | 2201 | } |
2202 | 2202 | ||
2203 | /* Initialize uCode has loaded Runtime uCode ... verify inst image. | 2203 | /* Initialize uCode has loaded Runtime uCode ... verify inst image. |
2204 | * This is a paranoid check, because we would not have gotten the | 2204 | * This is a paranoid check, because we would not have gotten the |
2205 | * "runtime" alive if code weren't properly loaded. */ | 2205 | * "runtime" alive if code weren't properly loaded. */ |
2206 | if (il3945_verify_ucode(priv)) { | 2206 | if (il3945_verify_ucode(il)) { |
2207 | /* Runtime instruction load was bad; | 2207 | /* Runtime instruction load was bad; |
2208 | * take it all the way back down so we can try again */ | 2208 | * take it all the way back down so we can try again */ |
2209 | IL_DEBUG_INFO(priv, "Bad runtime uCode load.\n"); | 2209 | IL_DEBUG_INFO(il, "Bad runtime uCode load.\n"); |
2210 | goto restart; | 2210 | goto restart; |
2211 | } | 2211 | } |
2212 | 2212 | ||
2213 | rfkill = il_read_prph(priv, APMG_RFKILL_REG); | 2213 | rfkill = il_read_prph(il, APMG_RFKILL_REG); |
2214 | IL_DEBUG_INFO(priv, "RFKILL status: 0x%x\n", rfkill); | 2214 | IL_DEBUG_INFO(il, "RFKILL status: 0x%x\n", rfkill); |
2215 | 2215 | ||
2216 | if (rfkill & 0x1) { | 2216 | if (rfkill & 0x1) { |
2217 | clear_bit(STATUS_RF_KILL_HW, &priv->status); | 2217 | clear_bit(STATUS_RF_KILL_HW, &il->status); |
2218 | /* if RFKILL is not on, then wait for thermal | 2218 | /* if RFKILL is not on, then wait for thermal |
2219 | * sensor in adapter to kick in */ | 2219 | * sensor in adapter to kick in */ |
2220 | while (il3945_hw_get_temperature(priv) == 0) { | 2220 | while (il3945_hw_get_temperature(il) == 0) { |
2221 | thermal_spin++; | 2221 | thermal_spin++; |
2222 | udelay(10); | 2222 | udelay(10); |
2223 | } | 2223 | } |
2224 | 2224 | ||
2225 | if (thermal_spin) | 2225 | if (thermal_spin) |
2226 | IL_DEBUG_INFO(priv, "Thermal calibration took %dus\n", | 2226 | IL_DEBUG_INFO(il, "Thermal calibration took %dus\n", |
2227 | thermal_spin * 10); | 2227 | thermal_spin * 10); |
2228 | } else | 2228 | } else |
2229 | set_bit(STATUS_RF_KILL_HW, &priv->status); | 2229 | set_bit(STATUS_RF_KILL_HW, &il->status); |
2230 | 2230 | ||
2231 | /* After the ALIVE response, we can send commands to 3945 uCode */ | 2231 | /* After the ALIVE response, we can send commands to 3945 uCode */ |
2232 | set_bit(STATUS_ALIVE, &priv->status); | 2232 | set_bit(STATUS_ALIVE, &il->status); |
2233 | 2233 | ||
2234 | /* Enable watchdog to monitor the driver tx queues */ | 2234 | /* Enable watchdog to monitor the driver tx queues */ |
2235 | il_setup_watchdog(priv); | 2235 | il_setup_watchdog(il); |
2236 | 2236 | ||
2237 | if (il_is_rfkill(priv)) | 2237 | if (il_is_rfkill(il)) |
2238 | return; | 2238 | return; |
2239 | 2239 | ||
2240 | ieee80211_wake_queues(priv->hw); | 2240 | ieee80211_wake_queues(il->hw); |
2241 | 2241 | ||
2242 | priv->active_rate = IL_RATES_MASK_3945; | 2242 | il->active_rate = IL_RATES_MASK_3945; |
2243 | 2243 | ||
2244 | il_power_update_mode(priv, true); | 2244 | il_power_update_mode(il, true); |
2245 | 2245 | ||
2246 | if (il_is_associated(priv, IL_RXON_CTX_BSS)) { | 2246 | if (il_is_associated(il, IL_RXON_CTX_BSS)) { |
2247 | struct il3945_rxon_cmd *active_rxon = | 2247 | struct il3945_rxon_cmd *active_rxon = |
2248 | (struct il3945_rxon_cmd *)(&ctx->active); | 2248 | (struct il3945_rxon_cmd *)(&ctx->active); |
2249 | 2249 | ||
@@ -2251,205 +2251,205 @@ static void il3945_alive_start(struct il_priv *priv) | |||
2251 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 2251 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
2252 | } else { | 2252 | } else { |
2253 | /* Initialize our rx_config data */ | 2253 | /* Initialize our rx_config data */ |
2254 | il_connection_init_rx_config(priv, ctx); | 2254 | il_connection_init_rx_config(il, ctx); |
2255 | } | 2255 | } |
2256 | 2256 | ||
2257 | /* Configure Bluetooth device coexistence support */ | 2257 | /* Configure Bluetooth device coexistence support */ |
2258 | il_send_bt_config(priv); | 2258 | il_send_bt_config(il); |
2259 | 2259 | ||
2260 | set_bit(STATUS_READY, &priv->status); | 2260 | set_bit(STATUS_READY, &il->status); |
2261 | 2261 | ||
2262 | /* Configure the adapter for unassociated operation */ | 2262 | /* Configure the adapter for unassociated operation */ |
2263 | il3945_commit_rxon(priv, ctx); | 2263 | il3945_commit_rxon(il, ctx); |
2264 | 2264 | ||
2265 | il3945_reg_txpower_periodic(priv); | 2265 | il3945_reg_txpower_periodic(il); |
2266 | 2266 | ||
2267 | IL_DEBUG_INFO(priv, "ALIVE processing complete.\n"); | 2267 | IL_DEBUG_INFO(il, "ALIVE processing complete.\n"); |
2268 | wake_up(&priv->wait_command_queue); | 2268 | wake_up(&il->wait_command_queue); |
2269 | 2269 | ||
2270 | return; | 2270 | return; |
2271 | 2271 | ||
2272 | restart: | 2272 | restart: |
2273 | queue_work(priv->workqueue, &priv->restart); | 2273 | queue_work(il->workqueue, &il->restart); |
2274 | } | 2274 | } |
2275 | 2275 | ||
2276 | static void il3945_cancel_deferred_work(struct il_priv *priv); | 2276 | static void il3945_cancel_deferred_work(struct il_priv *il); |
2277 | 2277 | ||
2278 | static void __il3945_down(struct il_priv *priv) | 2278 | static void __il3945_down(struct il_priv *il) |
2279 | { | 2279 | { |
2280 | unsigned long flags; | 2280 | unsigned long flags; |
2281 | int exit_pending; | 2281 | int exit_pending; |
2282 | 2282 | ||
2283 | IL_DEBUG_INFO(priv, DRV_NAME " is going down\n"); | 2283 | IL_DEBUG_INFO(il, DRV_NAME " is going down\n"); |
2284 | 2284 | ||
2285 | il_scan_cancel_timeout(priv, 200); | 2285 | il_scan_cancel_timeout(il, 200); |
2286 | 2286 | ||
2287 | exit_pending = test_and_set_bit(STATUS_EXIT_PENDING, &priv->status); | 2287 | exit_pending = test_and_set_bit(STATUS_EXIT_PENDING, &il->status); |
2288 | 2288 | ||
2289 | /* Stop TX queues watchdog. We need to have STATUS_EXIT_PENDING bit set | 2289 | /* Stop TX queues watchdog. We need to have STATUS_EXIT_PENDING bit set |
2290 | * to prevent rearm timer */ | 2290 | * to prevent rearm timer */ |
2291 | del_timer_sync(&priv->watchdog); | 2291 | del_timer_sync(&il->watchdog); |
2292 | 2292 | ||
2293 | /* Station information will now be cleared in device */ | 2293 | /* Station information will now be cleared in device */ |
2294 | il_clear_ucode_stations(priv, NULL); | 2294 | il_clear_ucode_stations(il, NULL); |
2295 | il_dealloc_bcast_stations(priv); | 2295 | il_dealloc_bcast_stations(il); |
2296 | il_clear_driver_stations(priv); | 2296 | il_clear_driver_stations(il); |
2297 | 2297 | ||
2298 | /* Unblock any waiting calls */ | 2298 | /* Unblock any waiting calls */ |
2299 | wake_up_all(&priv->wait_command_queue); | 2299 | wake_up_all(&il->wait_command_queue); |
2300 | 2300 | ||
2301 | /* Wipe out the EXIT_PENDING status bit if we are not actually | 2301 | /* Wipe out the EXIT_PENDING status bit if we are not actually |
2302 | * exiting the module */ | 2302 | * exiting the module */ |
2303 | if (!exit_pending) | 2303 | if (!exit_pending) |
2304 | clear_bit(STATUS_EXIT_PENDING, &priv->status); | 2304 | clear_bit(STATUS_EXIT_PENDING, &il->status); |
2305 | 2305 | ||
2306 | /* stop and reset the on-board processor */ | 2306 | /* stop and reset the on-board processor */ |
2307 | il_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); | 2307 | il_write32(il, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); |
2308 | 2308 | ||
2309 | /* tell the device to stop sending interrupts */ | 2309 | /* tell the device to stop sending interrupts */ |
2310 | spin_lock_irqsave(&priv->lock, flags); | 2310 | spin_lock_irqsave(&il->lock, flags); |
2311 | il_disable_interrupts(priv); | 2311 | il_disable_interrupts(il); |
2312 | spin_unlock_irqrestore(&priv->lock, flags); | 2312 | spin_unlock_irqrestore(&il->lock, flags); |
2313 | il3945_synchronize_irq(priv); | 2313 | il3945_synchronize_irq(il); |
2314 | 2314 | ||
2315 | if (priv->mac80211_registered) | 2315 | if (il->mac80211_registered) |
2316 | ieee80211_stop_queues(priv->hw); | 2316 | ieee80211_stop_queues(il->hw); |
2317 | 2317 | ||
2318 | /* If we have not previously called il3945_init() then | 2318 | /* If we have not previously called il3945_init() then |
2319 | * clear all bits but the RF Kill bits and return */ | 2319 | * clear all bits but the RF Kill bits and return */ |
2320 | if (!il_is_init(priv)) { | 2320 | if (!il_is_init(il)) { |
2321 | priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << | 2321 | il->status = test_bit(STATUS_RF_KILL_HW, &il->status) << |
2322 | STATUS_RF_KILL_HW | | 2322 | STATUS_RF_KILL_HW | |
2323 | test_bit(STATUS_GEO_CONFIGURED, &priv->status) << | 2323 | test_bit(STATUS_GEO_CONFIGURED, &il->status) << |
2324 | STATUS_GEO_CONFIGURED | | 2324 | STATUS_GEO_CONFIGURED | |
2325 | test_bit(STATUS_EXIT_PENDING, &priv->status) << | 2325 | test_bit(STATUS_EXIT_PENDING, &il->status) << |
2326 | STATUS_EXIT_PENDING; | 2326 | STATUS_EXIT_PENDING; |
2327 | goto exit; | 2327 | goto exit; |
2328 | } | 2328 | } |
2329 | 2329 | ||
2330 | /* ...otherwise clear out all the status bits but the RF Kill | 2330 | /* ...otherwise clear out all the status bits but the RF Kill |
2331 | * bit and continue taking the NIC down. */ | 2331 | * bit and continue taking the NIC down. */ |
2332 | priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) << | 2332 | il->status &= test_bit(STATUS_RF_KILL_HW, &il->status) << |
2333 | STATUS_RF_KILL_HW | | 2333 | STATUS_RF_KILL_HW | |
2334 | test_bit(STATUS_GEO_CONFIGURED, &priv->status) << | 2334 | test_bit(STATUS_GEO_CONFIGURED, &il->status) << |
2335 | STATUS_GEO_CONFIGURED | | 2335 | STATUS_GEO_CONFIGURED | |
2336 | test_bit(STATUS_FW_ERROR, &priv->status) << | 2336 | test_bit(STATUS_FW_ERROR, &il->status) << |
2337 | STATUS_FW_ERROR | | 2337 | STATUS_FW_ERROR | |
2338 | test_bit(STATUS_EXIT_PENDING, &priv->status) << | 2338 | test_bit(STATUS_EXIT_PENDING, &il->status) << |
2339 | STATUS_EXIT_PENDING; | 2339 | STATUS_EXIT_PENDING; |
2340 | 2340 | ||
2341 | il3945_hw_txq_ctx_stop(priv); | 2341 | il3945_hw_txq_ctx_stop(il); |
2342 | il3945_hw_rxq_stop(priv); | 2342 | il3945_hw_rxq_stop(il); |
2343 | 2343 | ||
2344 | /* Power-down device's busmaster DMA clocks */ | 2344 | /* Power-down device's busmaster DMA clocks */ |
2345 | il_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); | 2345 | il_write_prph(il, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); |
2346 | udelay(5); | 2346 | udelay(5); |
2347 | 2347 | ||
2348 | /* Stop the device, and put it in low power state */ | 2348 | /* Stop the device, and put it in low power state */ |
2349 | il_apm_stop(priv); | 2349 | il_apm_stop(il); |
2350 | 2350 | ||
2351 | exit: | 2351 | exit: |
2352 | memset(&priv->card_alive, 0, sizeof(struct il_alive_resp)); | 2352 | memset(&il->card_alive, 0, sizeof(struct il_alive_resp)); |
2353 | 2353 | ||
2354 | if (priv->beacon_skb) | 2354 | if (il->beacon_skb) |
2355 | dev_kfree_skb(priv->beacon_skb); | 2355 | dev_kfree_skb(il->beacon_skb); |
2356 | priv->beacon_skb = NULL; | 2356 | il->beacon_skb = NULL; |
2357 | 2357 | ||
2358 | /* clear out any free frames */ | 2358 | /* clear out any free frames */ |
2359 | il3945_clear_free_frames(priv); | 2359 | il3945_clear_free_frames(il); |
2360 | } | 2360 | } |
2361 | 2361 | ||
2362 | static void il3945_down(struct il_priv *priv) | 2362 | static void il3945_down(struct il_priv *il) |
2363 | { | 2363 | { |
2364 | mutex_lock(&priv->mutex); | 2364 | mutex_lock(&il->mutex); |
2365 | __il3945_down(priv); | 2365 | __il3945_down(il); |
2366 | mutex_unlock(&priv->mutex); | 2366 | mutex_unlock(&il->mutex); |
2367 | 2367 | ||
2368 | il3945_cancel_deferred_work(priv); | 2368 | il3945_cancel_deferred_work(il); |
2369 | } | 2369 | } |
2370 | 2370 | ||
2371 | #define MAX_HW_RESTARTS 5 | 2371 | #define MAX_HW_RESTARTS 5 |
2372 | 2372 | ||
2373 | static int il3945_alloc_bcast_station(struct il_priv *priv) | 2373 | static int il3945_alloc_bcast_station(struct il_priv *il) |
2374 | { | 2374 | { |
2375 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 2375 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
2376 | unsigned long flags; | 2376 | unsigned long flags; |
2377 | u8 sta_id; | 2377 | u8 sta_id; |
2378 | 2378 | ||
2379 | spin_lock_irqsave(&priv->sta_lock, flags); | 2379 | spin_lock_irqsave(&il->sta_lock, flags); |
2380 | sta_id = il_prep_station(priv, ctx, | 2380 | sta_id = il_prep_station(il, ctx, |
2381 | iwlegacy_bcast_addr, false, NULL); | 2381 | iwlegacy_bcast_addr, false, NULL); |
2382 | if (sta_id == IL_INVALID_STATION) { | 2382 | if (sta_id == IL_INVALID_STATION) { |
2383 | IL_ERR(priv, "Unable to prepare broadcast station\n"); | 2383 | IL_ERR(il, "Unable to prepare broadcast station\n"); |
2384 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 2384 | spin_unlock_irqrestore(&il->sta_lock, flags); |
2385 | 2385 | ||
2386 | return -EINVAL; | 2386 | return -EINVAL; |
2387 | } | 2387 | } |
2388 | 2388 | ||
2389 | priv->stations[sta_id].used |= IL_STA_DRIVER_ACTIVE; | 2389 | il->stations[sta_id].used |= IL_STA_DRIVER_ACTIVE; |
2390 | priv->stations[sta_id].used |= IL_STA_BCAST; | 2390 | il->stations[sta_id].used |= IL_STA_BCAST; |
2391 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 2391 | spin_unlock_irqrestore(&il->sta_lock, flags); |
2392 | 2392 | ||
2393 | return 0; | 2393 | return 0; |
2394 | } | 2394 | } |
2395 | 2395 | ||
2396 | static int __il3945_up(struct il_priv *priv) | 2396 | static int __il3945_up(struct il_priv *il) |
2397 | { | 2397 | { |
2398 | int rc, i; | 2398 | int rc, i; |
2399 | 2399 | ||
2400 | rc = il3945_alloc_bcast_station(priv); | 2400 | rc = il3945_alloc_bcast_station(il); |
2401 | if (rc) | 2401 | if (rc) |
2402 | return rc; | 2402 | return rc; |
2403 | 2403 | ||
2404 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { | 2404 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) { |
2405 | IL_WARN(priv, "Exit pending; will not bring the NIC up\n"); | 2405 | IL_WARN(il, "Exit pending; will not bring the NIC up\n"); |
2406 | return -EIO; | 2406 | return -EIO; |
2407 | } | 2407 | } |
2408 | 2408 | ||
2409 | if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) { | 2409 | if (!il->ucode_data_backup.v_addr || !il->ucode_data.v_addr) { |
2410 | IL_ERR(priv, "ucode not available for device bring up\n"); | 2410 | IL_ERR(il, "ucode not available for device bring up\n"); |
2411 | return -EIO; | 2411 | return -EIO; |
2412 | } | 2412 | } |
2413 | 2413 | ||
2414 | /* If platform's RF_KILL switch is NOT set to KILL */ | 2414 | /* If platform's RF_KILL switch is NOT set to KILL */ |
2415 | if (il_read32(priv, CSR_GP_CNTRL) & | 2415 | if (il_read32(il, CSR_GP_CNTRL) & |
2416 | CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) | 2416 | CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) |
2417 | clear_bit(STATUS_RF_KILL_HW, &priv->status); | 2417 | clear_bit(STATUS_RF_KILL_HW, &il->status); |
2418 | else { | 2418 | else { |
2419 | set_bit(STATUS_RF_KILL_HW, &priv->status); | 2419 | set_bit(STATUS_RF_KILL_HW, &il->status); |
2420 | IL_WARN(priv, "Radio disabled by HW RF Kill switch\n"); | 2420 | IL_WARN(il, "Radio disabled by HW RF Kill switch\n"); |
2421 | return -ENODEV; | 2421 | return -ENODEV; |
2422 | } | 2422 | } |
2423 | 2423 | ||
2424 | il_write32(priv, CSR_INT, 0xFFFFFFFF); | 2424 | il_write32(il, CSR_INT, 0xFFFFFFFF); |
2425 | 2425 | ||
2426 | rc = il3945_hw_nic_init(priv); | 2426 | rc = il3945_hw_nic_init(il); |
2427 | if (rc) { | 2427 | if (rc) { |
2428 | IL_ERR(priv, "Unable to int nic\n"); | 2428 | IL_ERR(il, "Unable to int nic\n"); |
2429 | return rc; | 2429 | return rc; |
2430 | } | 2430 | } |
2431 | 2431 | ||
2432 | /* make sure rfkill handshake bits are cleared */ | 2432 | /* make sure rfkill handshake bits are cleared */ |
2433 | il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); | 2433 | il_write32(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); |
2434 | il_write32(priv, CSR_UCODE_DRV_GP1_CLR, | 2434 | il_write32(il, CSR_UCODE_DRV_GP1_CLR, |
2435 | CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); | 2435 | CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); |
2436 | 2436 | ||
2437 | /* clear (again), then enable host interrupts */ | 2437 | /* clear (again), then enable host interrupts */ |
2438 | il_write32(priv, CSR_INT, 0xFFFFFFFF); | 2438 | il_write32(il, CSR_INT, 0xFFFFFFFF); |
2439 | il_enable_interrupts(priv); | 2439 | il_enable_interrupts(il); |
2440 | 2440 | ||
2441 | /* really make sure rfkill handshake bits are cleared */ | 2441 | /* really make sure rfkill handshake bits are cleared */ |
2442 | il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); | 2442 | il_write32(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); |
2443 | il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); | 2443 | il_write32(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); |
2444 | 2444 | ||
2445 | /* Copy original ucode data image from disk into backup cache. | 2445 | /* Copy original ucode data image from disk into backup cache. |
2446 | * This will be used to initialize the on-board processor's | 2446 | * This will be used to initialize the on-board processor's |
2447 | * data SRAM for a clean start when the runtime program first loads. */ | 2447 | * data SRAM for a clean start when the runtime program first loads. */ |
2448 | memcpy(priv->ucode_data_backup.v_addr, priv->ucode_data.v_addr, | 2448 | memcpy(il->ucode_data_backup.v_addr, il->ucode_data.v_addr, |
2449 | priv->ucode_data.len); | 2449 | il->ucode_data.len); |
2450 | 2450 | ||
2451 | /* We return success when we resume from suspend and rf_kill is on. */ | 2451 | /* We return success when we resume from suspend and rf_kill is on. */ |
2452 | if (test_bit(STATUS_RF_KILL_HW, &priv->status)) | 2452 | if (test_bit(STATUS_RF_KILL_HW, &il->status)) |
2453 | return 0; | 2453 | return 0; |
2454 | 2454 | ||
2455 | for (i = 0; i < MAX_HW_RESTARTS; i++) { | 2455 | for (i = 0; i < MAX_HW_RESTARTS; i++) { |
@@ -2457,29 +2457,29 @@ static int __il3945_up(struct il_priv *priv) | |||
2457 | /* load bootstrap state machine, | 2457 | /* load bootstrap state machine, |
2458 | * load bootstrap program into processor's memory, | 2458 | * load bootstrap program into processor's memory, |
2459 | * prepare to load the "initialize" uCode */ | 2459 | * prepare to load the "initialize" uCode */ |
2460 | rc = priv->cfg->ops->lib->load_ucode(priv); | 2460 | rc = il->cfg->ops->lib->load_ucode(il); |
2461 | 2461 | ||
2462 | if (rc) { | 2462 | if (rc) { |
2463 | IL_ERR(priv, | 2463 | IL_ERR(il, |
2464 | "Unable to set up bootstrap uCode: %d\n", rc); | 2464 | "Unable to set up bootstrap uCode: %d\n", rc); |
2465 | continue; | 2465 | continue; |
2466 | } | 2466 | } |
2467 | 2467 | ||
2468 | /* start card; "initialize" will load runtime ucode */ | 2468 | /* start card; "initialize" will load runtime ucode */ |
2469 | il3945_nic_start(priv); | 2469 | il3945_nic_start(il); |
2470 | 2470 | ||
2471 | IL_DEBUG_INFO(priv, DRV_NAME " is coming up\n"); | 2471 | IL_DEBUG_INFO(il, DRV_NAME " is coming up\n"); |
2472 | 2472 | ||
2473 | return 0; | 2473 | return 0; |
2474 | } | 2474 | } |
2475 | 2475 | ||
2476 | set_bit(STATUS_EXIT_PENDING, &priv->status); | 2476 | set_bit(STATUS_EXIT_PENDING, &il->status); |
2477 | __il3945_down(priv); | 2477 | __il3945_down(il); |
2478 | clear_bit(STATUS_EXIT_PENDING, &priv->status); | 2478 | clear_bit(STATUS_EXIT_PENDING, &il->status); |
2479 | 2479 | ||
2480 | /* tried to restart and config the device for as long as our | 2480 | /* tried to restart and config the device for as long as our |
2481 | * patience could withstand */ | 2481 | * patience could withstand */ |
2482 | IL_ERR(priv, "Unable to initialize device after %d attempts.\n", i); | 2482 | IL_ERR(il, "Unable to initialize device after %d attempts.\n", i); |
2483 | return -EIO; | 2483 | return -EIO; |
2484 | } | 2484 | } |
2485 | 2485 | ||
@@ -2492,30 +2492,30 @@ static int __il3945_up(struct il_priv *priv) | |||
2492 | 2492 | ||
2493 | static void il3945_bg_init_alive_start(struct work_struct *data) | 2493 | static void il3945_bg_init_alive_start(struct work_struct *data) |
2494 | { | 2494 | { |
2495 | struct il_priv *priv = | 2495 | struct il_priv *il = |
2496 | container_of(data, struct il_priv, init_alive_start.work); | 2496 | container_of(data, struct il_priv, init_alive_start.work); |
2497 | 2497 | ||
2498 | mutex_lock(&priv->mutex); | 2498 | mutex_lock(&il->mutex); |
2499 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 2499 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) |
2500 | goto out; | 2500 | goto out; |
2501 | 2501 | ||
2502 | il3945_init_alive_start(priv); | 2502 | il3945_init_alive_start(il); |
2503 | out: | 2503 | out: |
2504 | mutex_unlock(&priv->mutex); | 2504 | mutex_unlock(&il->mutex); |
2505 | } | 2505 | } |
2506 | 2506 | ||
2507 | static void il3945_bg_alive_start(struct work_struct *data) | 2507 | static void il3945_bg_alive_start(struct work_struct *data) |
2508 | { | 2508 | { |
2509 | struct il_priv *priv = | 2509 | struct il_priv *il = |
2510 | container_of(data, struct il_priv, alive_start.work); | 2510 | container_of(data, struct il_priv, alive_start.work); |
2511 | 2511 | ||
2512 | mutex_lock(&priv->mutex); | 2512 | mutex_lock(&il->mutex); |
2513 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 2513 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) |
2514 | goto out; | 2514 | goto out; |
2515 | 2515 | ||
2516 | il3945_alive_start(priv); | 2516 | il3945_alive_start(il); |
2517 | out: | 2517 | out: |
2518 | mutex_unlock(&priv->mutex); | 2518 | mutex_unlock(&il->mutex); |
2519 | } | 2519 | } |
2520 | 2520 | ||
2521 | /* | 2521 | /* |
@@ -2526,32 +2526,32 @@ out: | |||
2526 | */ | 2526 | */ |
2527 | static void il3945_rfkill_poll(struct work_struct *data) | 2527 | static void il3945_rfkill_poll(struct work_struct *data) |
2528 | { | 2528 | { |
2529 | struct il_priv *priv = | 2529 | struct il_priv *il = |
2530 | container_of(data, struct il_priv, _3945.rfkill_poll.work); | 2530 | container_of(data, struct il_priv, _3945.rfkill_poll.work); |
2531 | bool old_rfkill = test_bit(STATUS_RF_KILL_HW, &priv->status); | 2531 | bool old_rfkill = test_bit(STATUS_RF_KILL_HW, &il->status); |
2532 | bool new_rfkill = !(il_read32(priv, CSR_GP_CNTRL) | 2532 | bool new_rfkill = !(il_read32(il, CSR_GP_CNTRL) |
2533 | & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW); | 2533 | & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW); |
2534 | 2534 | ||
2535 | if (new_rfkill != old_rfkill) { | 2535 | if (new_rfkill != old_rfkill) { |
2536 | if (new_rfkill) | 2536 | if (new_rfkill) |
2537 | set_bit(STATUS_RF_KILL_HW, &priv->status); | 2537 | set_bit(STATUS_RF_KILL_HW, &il->status); |
2538 | else | 2538 | else |
2539 | clear_bit(STATUS_RF_KILL_HW, &priv->status); | 2539 | clear_bit(STATUS_RF_KILL_HW, &il->status); |
2540 | 2540 | ||
2541 | wiphy_rfkill_set_hw_state(priv->hw->wiphy, new_rfkill); | 2541 | wiphy_rfkill_set_hw_state(il->hw->wiphy, new_rfkill); |
2542 | 2542 | ||
2543 | IL_DEBUG_RF_KILL(priv, "RF_KILL bit toggled to %s.\n", | 2543 | IL_DEBUG_RF_KILL(il, "RF_KILL bit toggled to %s.\n", |
2544 | new_rfkill ? "disable radio" : "enable radio"); | 2544 | new_rfkill ? "disable radio" : "enable radio"); |
2545 | } | 2545 | } |
2546 | 2546 | ||
2547 | /* Keep this running, even if radio now enabled. This will be | 2547 | /* Keep this running, even if radio now enabled. This will be |
2548 | * cancelled in mac_start() if system decides to start again */ | 2548 | * cancelled in mac_start() if system decides to start again */ |
2549 | queue_delayed_work(priv->workqueue, &priv->_3945.rfkill_poll, | 2549 | queue_delayed_work(il->workqueue, &il->_3945.rfkill_poll, |
2550 | round_jiffies_relative(2 * HZ)); | 2550 | round_jiffies_relative(2 * HZ)); |
2551 | 2551 | ||
2552 | } | 2552 | } |
2553 | 2553 | ||
2554 | int il3945_request_scan(struct il_priv *priv, struct ieee80211_vif *vif) | 2554 | int il3945_request_scan(struct il_priv *il, struct ieee80211_vif *vif) |
2555 | { | 2555 | { |
2556 | struct il_host_cmd cmd = { | 2556 | struct il_host_cmd cmd = { |
2557 | .id = REPLY_SCAN_CMD, | 2557 | .id = REPLY_SCAN_CMD, |
@@ -2565,29 +2565,29 @@ int il3945_request_scan(struct il_priv *priv, struct ieee80211_vif *vif) | |||
2565 | int ret; | 2565 | int ret; |
2566 | u16 len; | 2566 | u16 len; |
2567 | 2567 | ||
2568 | lockdep_assert_held(&priv->mutex); | 2568 | lockdep_assert_held(&il->mutex); |
2569 | 2569 | ||
2570 | if (!priv->scan_cmd) { | 2570 | if (!il->scan_cmd) { |
2571 | priv->scan_cmd = kmalloc(sizeof(struct il3945_scan_cmd) + | 2571 | il->scan_cmd = kmalloc(sizeof(struct il3945_scan_cmd) + |
2572 | IL_MAX_SCAN_SIZE, GFP_KERNEL); | 2572 | IL_MAX_SCAN_SIZE, GFP_KERNEL); |
2573 | if (!priv->scan_cmd) { | 2573 | if (!il->scan_cmd) { |
2574 | IL_DEBUG_SCAN(priv, "Fail to allocate scan memory\n"); | 2574 | IL_DEBUG_SCAN(il, "Fail to allocate scan memory\n"); |
2575 | return -ENOMEM; | 2575 | return -ENOMEM; |
2576 | } | 2576 | } |
2577 | } | 2577 | } |
2578 | scan = priv->scan_cmd; | 2578 | scan = il->scan_cmd; |
2579 | memset(scan, 0, sizeof(struct il3945_scan_cmd) + IL_MAX_SCAN_SIZE); | 2579 | memset(scan, 0, sizeof(struct il3945_scan_cmd) + IL_MAX_SCAN_SIZE); |
2580 | 2580 | ||
2581 | scan->quiet_plcp_th = IL_PLCP_QUIET_THRESH; | 2581 | scan->quiet_plcp_th = IL_PLCP_QUIET_THRESH; |
2582 | scan->quiet_time = IL_ACTIVE_QUIET_TIME; | 2582 | scan->quiet_time = IL_ACTIVE_QUIET_TIME; |
2583 | 2583 | ||
2584 | if (il_is_associated(priv, IL_RXON_CTX_BSS)) { | 2584 | if (il_is_associated(il, IL_RXON_CTX_BSS)) { |
2585 | u16 interval; | 2585 | u16 interval; |
2586 | u32 extra; | 2586 | u32 extra; |
2587 | u32 suspend_time = 100; | 2587 | u32 suspend_time = 100; |
2588 | u32 scan_suspend_time = 100; | 2588 | u32 scan_suspend_time = 100; |
2589 | 2589 | ||
2590 | IL_DEBUG_INFO(priv, "Scanning while associated...\n"); | 2590 | IL_DEBUG_INFO(il, "Scanning while associated...\n"); |
2591 | 2591 | ||
2592 | interval = vif->bss_conf.beacon_int; | 2592 | interval = vif->bss_conf.beacon_int; |
2593 | 2593 | ||
@@ -2607,39 +2607,39 @@ int il3945_request_scan(struct il_priv *priv, struct ieee80211_vif *vif) | |||
2607 | (extra | ((suspend_time % interval) * 1024)); | 2607 | (extra | ((suspend_time % interval) * 1024)); |
2608 | 2608 | ||
2609 | scan->suspend_time = cpu_to_le32(scan_suspend_time); | 2609 | scan->suspend_time = cpu_to_le32(scan_suspend_time); |
2610 | IL_DEBUG_SCAN(priv, "suspend_time 0x%X beacon interval %d\n", | 2610 | IL_DEBUG_SCAN(il, "suspend_time 0x%X beacon interval %d\n", |
2611 | scan_suspend_time, interval); | 2611 | scan_suspend_time, interval); |
2612 | } | 2612 | } |
2613 | 2613 | ||
2614 | if (priv->scan_request->n_ssids) { | 2614 | if (il->scan_request->n_ssids) { |
2615 | int i, p = 0; | 2615 | int i, p = 0; |
2616 | IL_DEBUG_SCAN(priv, "Kicking off active scan\n"); | 2616 | IL_DEBUG_SCAN(il, "Kicking off active scan\n"); |
2617 | for (i = 0; i < priv->scan_request->n_ssids; i++) { | 2617 | for (i = 0; i < il->scan_request->n_ssids; i++) { |
2618 | /* always does wildcard anyway */ | 2618 | /* always does wildcard anyway */ |
2619 | if (!priv->scan_request->ssids[i].ssid_len) | 2619 | if (!il->scan_request->ssids[i].ssid_len) |
2620 | continue; | 2620 | continue; |
2621 | scan->direct_scan[p].id = WLAN_EID_SSID; | 2621 | scan->direct_scan[p].id = WLAN_EID_SSID; |
2622 | scan->direct_scan[p].len = | 2622 | scan->direct_scan[p].len = |
2623 | priv->scan_request->ssids[i].ssid_len; | 2623 | il->scan_request->ssids[i].ssid_len; |
2624 | memcpy(scan->direct_scan[p].ssid, | 2624 | memcpy(scan->direct_scan[p].ssid, |
2625 | priv->scan_request->ssids[i].ssid, | 2625 | il->scan_request->ssids[i].ssid, |
2626 | priv->scan_request->ssids[i].ssid_len); | 2626 | il->scan_request->ssids[i].ssid_len); |
2627 | n_probes++; | 2627 | n_probes++; |
2628 | p++; | 2628 | p++; |
2629 | } | 2629 | } |
2630 | is_active = true; | 2630 | is_active = true; |
2631 | } else | 2631 | } else |
2632 | IL_DEBUG_SCAN(priv, "Kicking off passive scan.\n"); | 2632 | IL_DEBUG_SCAN(il, "Kicking off passive scan.\n"); |
2633 | 2633 | ||
2634 | /* We don't build a direct scan probe request; the uCode will do | 2634 | /* We don't build a direct scan probe request; the uCode will do |
2635 | * that based on the direct_mask added to each channel entry */ | 2635 | * that based on the direct_mask added to each channel entry */ |
2636 | scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; | 2636 | scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; |
2637 | scan->tx_cmd.sta_id = priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id; | 2637 | scan->tx_cmd.sta_id = il->contexts[IL_RXON_CTX_BSS].bcast_sta_id; |
2638 | scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; | 2638 | scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; |
2639 | 2639 | ||
2640 | /* flags + rate selection */ | 2640 | /* flags + rate selection */ |
2641 | 2641 | ||
2642 | switch (priv->scan_band) { | 2642 | switch (il->scan_band) { |
2643 | case IEEE80211_BAND_2GHZ: | 2643 | case IEEE80211_BAND_2GHZ: |
2644 | scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; | 2644 | scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; |
2645 | scan->tx_cmd.rate = IL_RATE_1M_PLCP; | 2645 | scan->tx_cmd.rate = IL_RATE_1M_PLCP; |
@@ -2650,7 +2650,7 @@ int il3945_request_scan(struct il_priv *priv, struct ieee80211_vif *vif) | |||
2650 | band = IEEE80211_BAND_5GHZ; | 2650 | band = IEEE80211_BAND_5GHZ; |
2651 | break; | 2651 | break; |
2652 | default: | 2652 | default: |
2653 | IL_WARN(priv, "Invalid scan band\n"); | 2653 | IL_WARN(il, "Invalid scan band\n"); |
2654 | return -EIO; | 2654 | return -EIO; |
2655 | } | 2655 | } |
2656 | 2656 | ||
@@ -2662,19 +2662,19 @@ int il3945_request_scan(struct il_priv *priv, struct ieee80211_vif *vif) | |||
2662 | scan->good_CRC_th = is_active ? IL_GOOD_CRC_TH_DEFAULT : | 2662 | scan->good_CRC_th = is_active ? IL_GOOD_CRC_TH_DEFAULT : |
2663 | IL_GOOD_CRC_TH_DISABLED; | 2663 | IL_GOOD_CRC_TH_DISABLED; |
2664 | 2664 | ||
2665 | len = il_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data, | 2665 | len = il_fill_probe_req(il, (struct ieee80211_mgmt *)scan->data, |
2666 | vif->addr, priv->scan_request->ie, | 2666 | vif->addr, il->scan_request->ie, |
2667 | priv->scan_request->ie_len, | 2667 | il->scan_request->ie_len, |
2668 | IL_MAX_SCAN_SIZE - sizeof(*scan)); | 2668 | IL_MAX_SCAN_SIZE - sizeof(*scan)); |
2669 | scan->tx_cmd.len = cpu_to_le16(len); | 2669 | scan->tx_cmd.len = cpu_to_le16(len); |
2670 | 2670 | ||
2671 | /* select Rx antennas */ | 2671 | /* select Rx antennas */ |
2672 | scan->flags |= il3945_get_antenna_flags(priv); | 2672 | scan->flags |= il3945_get_antenna_flags(il); |
2673 | 2673 | ||
2674 | scan->channel_count = il3945_get_channels_for_scan(priv, band, is_active, n_probes, | 2674 | scan->channel_count = il3945_get_channels_for_scan(il, band, is_active, n_probes, |
2675 | (void *)&scan->data[len], vif); | 2675 | (void *)&scan->data[len], vif); |
2676 | if (scan->channel_count == 0) { | 2676 | if (scan->channel_count == 0) { |
2677 | IL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); | 2677 | IL_DEBUG_SCAN(il, "channel count %d\n", scan->channel_count); |
2678 | return -EIO; | 2678 | return -EIO; |
2679 | } | 2679 | } |
2680 | 2680 | ||
@@ -2683,101 +2683,101 @@ int il3945_request_scan(struct il_priv *priv, struct ieee80211_vif *vif) | |||
2683 | cmd.data = scan; | 2683 | cmd.data = scan; |
2684 | scan->len = cpu_to_le16(cmd.len); | 2684 | scan->len = cpu_to_le16(cmd.len); |
2685 | 2685 | ||
2686 | set_bit(STATUS_SCAN_HW, &priv->status); | 2686 | set_bit(STATUS_SCAN_HW, &il->status); |
2687 | ret = il_send_cmd_sync(priv, &cmd); | 2687 | ret = il_send_cmd_sync(il, &cmd); |
2688 | if (ret) | 2688 | if (ret) |
2689 | clear_bit(STATUS_SCAN_HW, &priv->status); | 2689 | clear_bit(STATUS_SCAN_HW, &il->status); |
2690 | return ret; | 2690 | return ret; |
2691 | } | 2691 | } |
2692 | 2692 | ||
2693 | void il3945_post_scan(struct il_priv *priv) | 2693 | void il3945_post_scan(struct il_priv *il) |
2694 | { | 2694 | { |
2695 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 2695 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
2696 | 2696 | ||
2697 | /* | 2697 | /* |
2698 | * Since setting the RXON may have been deferred while | 2698 | * Since setting the RXON may have been deferred while |
2699 | * performing the scan, fire one off if needed | 2699 | * performing the scan, fire one off if needed |
2700 | */ | 2700 | */ |
2701 | if (memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging))) | 2701 | if (memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging))) |
2702 | il3945_commit_rxon(priv, ctx); | 2702 | il3945_commit_rxon(il, ctx); |
2703 | } | 2703 | } |
2704 | 2704 | ||
2705 | static void il3945_bg_restart(struct work_struct *data) | 2705 | static void il3945_bg_restart(struct work_struct *data) |
2706 | { | 2706 | { |
2707 | struct il_priv *priv = container_of(data, struct il_priv, restart); | 2707 | struct il_priv *il = container_of(data, struct il_priv, restart); |
2708 | 2708 | ||
2709 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 2709 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) |
2710 | return; | 2710 | return; |
2711 | 2711 | ||
2712 | if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) { | 2712 | if (test_and_clear_bit(STATUS_FW_ERROR, &il->status)) { |
2713 | struct il_rxon_context *ctx; | 2713 | struct il_rxon_context *ctx; |
2714 | mutex_lock(&priv->mutex); | 2714 | mutex_lock(&il->mutex); |
2715 | for_each_context(priv, ctx) | 2715 | for_each_context(il, ctx) |
2716 | ctx->vif = NULL; | 2716 | ctx->vif = NULL; |
2717 | priv->is_open = 0; | 2717 | il->is_open = 0; |
2718 | mutex_unlock(&priv->mutex); | 2718 | mutex_unlock(&il->mutex); |
2719 | il3945_down(priv); | 2719 | il3945_down(il); |
2720 | ieee80211_restart_hw(priv->hw); | 2720 | ieee80211_restart_hw(il->hw); |
2721 | } else { | 2721 | } else { |
2722 | il3945_down(priv); | 2722 | il3945_down(il); |
2723 | 2723 | ||
2724 | mutex_lock(&priv->mutex); | 2724 | mutex_lock(&il->mutex); |
2725 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { | 2725 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) { |
2726 | mutex_unlock(&priv->mutex); | 2726 | mutex_unlock(&il->mutex); |
2727 | return; | 2727 | return; |
2728 | } | 2728 | } |
2729 | 2729 | ||
2730 | __il3945_up(priv); | 2730 | __il3945_up(il); |
2731 | mutex_unlock(&priv->mutex); | 2731 | mutex_unlock(&il->mutex); |
2732 | } | 2732 | } |
2733 | } | 2733 | } |
2734 | 2734 | ||
2735 | static void il3945_bg_rx_replenish(struct work_struct *data) | 2735 | static void il3945_bg_rx_replenish(struct work_struct *data) |
2736 | { | 2736 | { |
2737 | struct il_priv *priv = | 2737 | struct il_priv *il = |
2738 | container_of(data, struct il_priv, rx_replenish); | 2738 | container_of(data, struct il_priv, rx_replenish); |
2739 | 2739 | ||
2740 | mutex_lock(&priv->mutex); | 2740 | mutex_lock(&il->mutex); |
2741 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 2741 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) |
2742 | goto out; | 2742 | goto out; |
2743 | 2743 | ||
2744 | il3945_rx_replenish(priv); | 2744 | il3945_rx_replenish(il); |
2745 | out: | 2745 | out: |
2746 | mutex_unlock(&priv->mutex); | 2746 | mutex_unlock(&il->mutex); |
2747 | } | 2747 | } |
2748 | 2748 | ||
2749 | void il3945_post_associate(struct il_priv *priv) | 2749 | void il3945_post_associate(struct il_priv *il) |
2750 | { | 2750 | { |
2751 | int rc = 0; | 2751 | int rc = 0; |
2752 | struct ieee80211_conf *conf = NULL; | 2752 | struct ieee80211_conf *conf = NULL; |
2753 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 2753 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
2754 | 2754 | ||
2755 | if (!ctx->vif || !priv->is_open) | 2755 | if (!ctx->vif || !il->is_open) |
2756 | return; | 2756 | return; |
2757 | 2757 | ||
2758 | IL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n", | 2758 | IL_DEBUG_ASSOC(il, "Associated as %d to: %pM\n", |
2759 | ctx->vif->bss_conf.aid, ctx->active.bssid_addr); | 2759 | ctx->vif->bss_conf.aid, ctx->active.bssid_addr); |
2760 | 2760 | ||
2761 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 2761 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) |
2762 | return; | 2762 | return; |
2763 | 2763 | ||
2764 | il_scan_cancel_timeout(priv, 200); | 2764 | il_scan_cancel_timeout(il, 200); |
2765 | 2765 | ||
2766 | conf = il_ieee80211_get_hw_conf(priv->hw); | 2766 | conf = il_ieee80211_get_hw_conf(il->hw); |
2767 | 2767 | ||
2768 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 2768 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
2769 | il3945_commit_rxon(priv, ctx); | 2769 | il3945_commit_rxon(il, ctx); |
2770 | 2770 | ||
2771 | rc = il_send_rxon_timing(priv, ctx); | 2771 | rc = il_send_rxon_timing(il, ctx); |
2772 | if (rc) | 2772 | if (rc) |
2773 | IL_WARN(priv, "REPLY_RXON_TIMING failed - " | 2773 | IL_WARN(il, "REPLY_RXON_TIMING failed - " |
2774 | "Attempting to continue.\n"); | 2774 | "Attempting to continue.\n"); |
2775 | 2775 | ||
2776 | ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; | 2776 | ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; |
2777 | 2777 | ||
2778 | ctx->staging.assoc_id = cpu_to_le16(ctx->vif->bss_conf.aid); | 2778 | ctx->staging.assoc_id = cpu_to_le16(ctx->vif->bss_conf.aid); |
2779 | 2779 | ||
2780 | IL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", | 2780 | IL_DEBUG_ASSOC(il, "assoc id %d beacon interval %d\n", |
2781 | ctx->vif->bss_conf.aid, ctx->vif->bss_conf.beacon_int); | 2781 | ctx->vif->bss_conf.aid, ctx->vif->bss_conf.beacon_int); |
2782 | 2782 | ||
2783 | if (ctx->vif->bss_conf.use_short_preamble) | 2783 | if (ctx->vif->bss_conf.use_short_preamble) |
@@ -2792,17 +2792,17 @@ void il3945_post_associate(struct il_priv *priv) | |||
2792 | ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; | 2792 | ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; |
2793 | } | 2793 | } |
2794 | 2794 | ||
2795 | il3945_commit_rxon(priv, ctx); | 2795 | il3945_commit_rxon(il, ctx); |
2796 | 2796 | ||
2797 | switch (ctx->vif->type) { | 2797 | switch (ctx->vif->type) { |
2798 | case NL80211_IFTYPE_STATION: | 2798 | case NL80211_IFTYPE_STATION: |
2799 | il3945_rate_scale_init(priv->hw, IL_AP_ID); | 2799 | il3945_rate_scale_init(il->hw, IL_AP_ID); |
2800 | break; | 2800 | break; |
2801 | case NL80211_IFTYPE_ADHOC: | 2801 | case NL80211_IFTYPE_ADHOC: |
2802 | il3945_send_beacon_cmd(priv); | 2802 | il3945_send_beacon_cmd(il); |
2803 | break; | 2803 | break; |
2804 | default: | 2804 | default: |
2805 | IL_ERR(priv, "%s Should not be called in %d mode\n", | 2805 | IL_ERR(il, "%s Should not be called in %d mode\n", |
2806 | __func__, ctx->vif->type); | 2806 | __func__, ctx->vif->type); |
2807 | break; | 2807 | break; |
2808 | } | 2808 | } |
@@ -2818,43 +2818,43 @@ void il3945_post_associate(struct il_priv *priv) | |||
2818 | 2818 | ||
2819 | static int il3945_mac_start(struct ieee80211_hw *hw) | 2819 | static int il3945_mac_start(struct ieee80211_hw *hw) |
2820 | { | 2820 | { |
2821 | struct il_priv *priv = hw->priv; | 2821 | struct il_priv *il = hw->priv; |
2822 | int ret; | 2822 | int ret; |
2823 | 2823 | ||
2824 | IL_DEBUG_MAC80211(priv, "enter\n"); | 2824 | IL_DEBUG_MAC80211(il, "enter\n"); |
2825 | 2825 | ||
2826 | /* we should be verifying the device is ready to be opened */ | 2826 | /* we should be verifying the device is ready to be opened */ |
2827 | mutex_lock(&priv->mutex); | 2827 | mutex_lock(&il->mutex); |
2828 | 2828 | ||
2829 | /* fetch ucode file from disk, alloc and copy to bus-master buffers ... | 2829 | /* fetch ucode file from disk, alloc and copy to bus-master buffers ... |
2830 | * ucode filename and max sizes are card-specific. */ | 2830 | * ucode filename and max sizes are card-specific. */ |
2831 | 2831 | ||
2832 | if (!priv->ucode_code.len) { | 2832 | if (!il->ucode_code.len) { |
2833 | ret = il3945_read_ucode(priv); | 2833 | ret = il3945_read_ucode(il); |
2834 | if (ret) { | 2834 | if (ret) { |
2835 | IL_ERR(priv, "Could not read microcode: %d\n", ret); | 2835 | IL_ERR(il, "Could not read microcode: %d\n", ret); |
2836 | mutex_unlock(&priv->mutex); | 2836 | mutex_unlock(&il->mutex); |
2837 | goto out_release_irq; | 2837 | goto out_release_irq; |
2838 | } | 2838 | } |
2839 | } | 2839 | } |
2840 | 2840 | ||
2841 | ret = __il3945_up(priv); | 2841 | ret = __il3945_up(il); |
2842 | 2842 | ||
2843 | mutex_unlock(&priv->mutex); | 2843 | mutex_unlock(&il->mutex); |
2844 | 2844 | ||
2845 | if (ret) | 2845 | if (ret) |
2846 | goto out_release_irq; | 2846 | goto out_release_irq; |
2847 | 2847 | ||
2848 | IL_DEBUG_INFO(priv, "Start UP work.\n"); | 2848 | IL_DEBUG_INFO(il, "Start UP work.\n"); |
2849 | 2849 | ||
2850 | /* Wait for START_ALIVE from ucode. Otherwise callbacks from | 2850 | /* Wait for START_ALIVE from ucode. Otherwise callbacks from |
2851 | * mac80211 will not be run successfully. */ | 2851 | * mac80211 will not be run successfully. */ |
2852 | ret = wait_event_timeout(priv->wait_command_queue, | 2852 | ret = wait_event_timeout(il->wait_command_queue, |
2853 | test_bit(STATUS_READY, &priv->status), | 2853 | test_bit(STATUS_READY, &il->status), |
2854 | UCODE_READY_TIMEOUT); | 2854 | UCODE_READY_TIMEOUT); |
2855 | if (!ret) { | 2855 | if (!ret) { |
2856 | if (!test_bit(STATUS_READY, &priv->status)) { | 2856 | if (!test_bit(STATUS_READY, &il->status)) { |
2857 | IL_ERR(priv, | 2857 | IL_ERR(il, |
2858 | "Wait for START_ALIVE timeout after %dms.\n", | 2858 | "Wait for START_ALIVE timeout after %dms.\n", |
2859 | jiffies_to_msecs(UCODE_READY_TIMEOUT)); | 2859 | jiffies_to_msecs(UCODE_READY_TIMEOUT)); |
2860 | ret = -ETIMEDOUT; | 2860 | ret = -ETIMEDOUT; |
@@ -2864,77 +2864,77 @@ static int il3945_mac_start(struct ieee80211_hw *hw) | |||
2864 | 2864 | ||
2865 | /* ucode is running and will send rfkill notifications, | 2865 | /* ucode is running and will send rfkill notifications, |
2866 | * no need to poll the killswitch state anymore */ | 2866 | * no need to poll the killswitch state anymore */ |
2867 | cancel_delayed_work(&priv->_3945.rfkill_poll); | 2867 | cancel_delayed_work(&il->_3945.rfkill_poll); |
2868 | 2868 | ||
2869 | priv->is_open = 1; | 2869 | il->is_open = 1; |
2870 | IL_DEBUG_MAC80211(priv, "leave\n"); | 2870 | IL_DEBUG_MAC80211(il, "leave\n"); |
2871 | return 0; | 2871 | return 0; |
2872 | 2872 | ||
2873 | out_release_irq: | 2873 | out_release_irq: |
2874 | priv->is_open = 0; | 2874 | il->is_open = 0; |
2875 | IL_DEBUG_MAC80211(priv, "leave - failed\n"); | 2875 | IL_DEBUG_MAC80211(il, "leave - failed\n"); |
2876 | return ret; | 2876 | return ret; |
2877 | } | 2877 | } |
2878 | 2878 | ||
2879 | static void il3945_mac_stop(struct ieee80211_hw *hw) | 2879 | static void il3945_mac_stop(struct ieee80211_hw *hw) |
2880 | { | 2880 | { |
2881 | struct il_priv *priv = hw->priv; | 2881 | struct il_priv *il = hw->priv; |
2882 | 2882 | ||
2883 | IL_DEBUG_MAC80211(priv, "enter\n"); | 2883 | IL_DEBUG_MAC80211(il, "enter\n"); |
2884 | 2884 | ||
2885 | if (!priv->is_open) { | 2885 | if (!il->is_open) { |
2886 | IL_DEBUG_MAC80211(priv, "leave - skip\n"); | 2886 | IL_DEBUG_MAC80211(il, "leave - skip\n"); |
2887 | return; | 2887 | return; |
2888 | } | 2888 | } |
2889 | 2889 | ||
2890 | priv->is_open = 0; | 2890 | il->is_open = 0; |
2891 | 2891 | ||
2892 | il3945_down(priv); | 2892 | il3945_down(il); |
2893 | 2893 | ||
2894 | flush_workqueue(priv->workqueue); | 2894 | flush_workqueue(il->workqueue); |
2895 | 2895 | ||
2896 | /* start polling the killswitch state again */ | 2896 | /* start polling the killswitch state again */ |
2897 | queue_delayed_work(priv->workqueue, &priv->_3945.rfkill_poll, | 2897 | queue_delayed_work(il->workqueue, &il->_3945.rfkill_poll, |
2898 | round_jiffies_relative(2 * HZ)); | 2898 | round_jiffies_relative(2 * HZ)); |
2899 | 2899 | ||
2900 | IL_DEBUG_MAC80211(priv, "leave\n"); | 2900 | IL_DEBUG_MAC80211(il, "leave\n"); |
2901 | } | 2901 | } |
2902 | 2902 | ||
2903 | static void il3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 2903 | static void il3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) |
2904 | { | 2904 | { |
2905 | struct il_priv *priv = hw->priv; | 2905 | struct il_priv *il = hw->priv; |
2906 | 2906 | ||
2907 | IL_DEBUG_MAC80211(priv, "enter\n"); | 2907 | IL_DEBUG_MAC80211(il, "enter\n"); |
2908 | 2908 | ||
2909 | IL_DEBUG_TX(priv, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, | 2909 | IL_DEBUG_TX(il, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, |
2910 | ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); | 2910 | ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); |
2911 | 2911 | ||
2912 | if (il3945_tx_skb(priv, skb)) | 2912 | if (il3945_tx_skb(il, skb)) |
2913 | dev_kfree_skb_any(skb); | 2913 | dev_kfree_skb_any(skb); |
2914 | 2914 | ||
2915 | IL_DEBUG_MAC80211(priv, "leave\n"); | 2915 | IL_DEBUG_MAC80211(il, "leave\n"); |
2916 | } | 2916 | } |
2917 | 2917 | ||
2918 | void il3945_config_ap(struct il_priv *priv) | 2918 | void il3945_config_ap(struct il_priv *il) |
2919 | { | 2919 | { |
2920 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 2920 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
2921 | struct ieee80211_vif *vif = ctx->vif; | 2921 | struct ieee80211_vif *vif = ctx->vif; |
2922 | int rc = 0; | 2922 | int rc = 0; |
2923 | 2923 | ||
2924 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 2924 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) |
2925 | return; | 2925 | return; |
2926 | 2926 | ||
2927 | /* The following should be done only at AP bring up */ | 2927 | /* The following should be done only at AP bring up */ |
2928 | if (!(il_is_associated(priv, IL_RXON_CTX_BSS))) { | 2928 | if (!(il_is_associated(il, IL_RXON_CTX_BSS))) { |
2929 | 2929 | ||
2930 | /* RXON - unassoc (to set timing command) */ | 2930 | /* RXON - unassoc (to set timing command) */ |
2931 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 2931 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
2932 | il3945_commit_rxon(priv, ctx); | 2932 | il3945_commit_rxon(il, ctx); |
2933 | 2933 | ||
2934 | /* RXON Timing */ | 2934 | /* RXON Timing */ |
2935 | rc = il_send_rxon_timing(priv, ctx); | 2935 | rc = il_send_rxon_timing(il, ctx); |
2936 | if (rc) | 2936 | if (rc) |
2937 | IL_WARN(priv, "REPLY_RXON_TIMING failed - " | 2937 | IL_WARN(il, "REPLY_RXON_TIMING failed - " |
2938 | "Attempting to continue.\n"); | 2938 | "Attempting to continue.\n"); |
2939 | 2939 | ||
2940 | ctx->staging.assoc_id = 0; | 2940 | ctx->staging.assoc_id = 0; |
@@ -2956,9 +2956,9 @@ void il3945_config_ap(struct il_priv *priv) | |||
2956 | } | 2956 | } |
2957 | /* restore RXON assoc */ | 2957 | /* restore RXON assoc */ |
2958 | ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; | 2958 | ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; |
2959 | il3945_commit_rxon(priv, ctx); | 2959 | il3945_commit_rxon(il, ctx); |
2960 | } | 2960 | } |
2961 | il3945_send_beacon_cmd(priv); | 2961 | il3945_send_beacon_cmd(il); |
2962 | } | 2962 | } |
2963 | 2963 | ||
2964 | static int il3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | 2964 | 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, | |||
2966 | struct ieee80211_sta *sta, | 2966 | struct ieee80211_sta *sta, |
2967 | struct ieee80211_key_conf *key) | 2967 | struct ieee80211_key_conf *key) |
2968 | { | 2968 | { |
2969 | struct il_priv *priv = hw->priv; | 2969 | struct il_priv *il = hw->priv; |
2970 | int ret = 0; | 2970 | int ret = 0; |
2971 | u8 sta_id = IL_INVALID_STATION; | 2971 | u8 sta_id = IL_INVALID_STATION; |
2972 | u8 static_key; | 2972 | u8 static_key; |
2973 | 2973 | ||
2974 | IL_DEBUG_MAC80211(priv, "enter\n"); | 2974 | IL_DEBUG_MAC80211(il, "enter\n"); |
2975 | 2975 | ||
2976 | if (il3945_mod_params.sw_crypto) { | 2976 | if (il3945_mod_params.sw_crypto) { |
2977 | IL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n"); | 2977 | IL_DEBUG_MAC80211(il, "leave - hwcrypto disabled\n"); |
2978 | return -EOPNOTSUPP; | 2978 | return -EOPNOTSUPP; |
2979 | } | 2979 | } |
2980 | 2980 | ||
@@ -2986,39 +2986,39 @@ static int il3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
2986 | !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) | 2986 | !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) |
2987 | return -EOPNOTSUPP; | 2987 | return -EOPNOTSUPP; |
2988 | 2988 | ||
2989 | static_key = !il_is_associated(priv, IL_RXON_CTX_BSS); | 2989 | static_key = !il_is_associated(il, IL_RXON_CTX_BSS); |
2990 | 2990 | ||
2991 | if (!static_key) { | 2991 | if (!static_key) { |
2992 | sta_id = il_sta_id_or_broadcast( | 2992 | sta_id = il_sta_id_or_broadcast( |
2993 | priv, &priv->contexts[IL_RXON_CTX_BSS], sta); | 2993 | il, &il->contexts[IL_RXON_CTX_BSS], sta); |
2994 | if (sta_id == IL_INVALID_STATION) | 2994 | if (sta_id == IL_INVALID_STATION) |
2995 | return -EINVAL; | 2995 | return -EINVAL; |
2996 | } | 2996 | } |
2997 | 2997 | ||
2998 | mutex_lock(&priv->mutex); | 2998 | mutex_lock(&il->mutex); |
2999 | il_scan_cancel_timeout(priv, 100); | 2999 | il_scan_cancel_timeout(il, 100); |
3000 | 3000 | ||
3001 | switch (cmd) { | 3001 | switch (cmd) { |
3002 | case SET_KEY: | 3002 | case SET_KEY: |
3003 | if (static_key) | 3003 | if (static_key) |
3004 | ret = il3945_set_static_key(priv, key); | 3004 | ret = il3945_set_static_key(il, key); |
3005 | else | 3005 | else |
3006 | ret = il3945_set_dynamic_key(priv, key, sta_id); | 3006 | ret = il3945_set_dynamic_key(il, key, sta_id); |
3007 | IL_DEBUG_MAC80211(priv, "enable hwcrypto key\n"); | 3007 | IL_DEBUG_MAC80211(il, "enable hwcrypto key\n"); |
3008 | break; | 3008 | break; |
3009 | case DISABLE_KEY: | 3009 | case DISABLE_KEY: |
3010 | if (static_key) | 3010 | if (static_key) |
3011 | ret = il3945_remove_static_key(priv); | 3011 | ret = il3945_remove_static_key(il); |
3012 | else | 3012 | else |
3013 | ret = il3945_clear_sta_key_info(priv, sta_id); | 3013 | ret = il3945_clear_sta_key_info(il, sta_id); |
3014 | IL_DEBUG_MAC80211(priv, "disable hwcrypto key\n"); | 3014 | IL_DEBUG_MAC80211(il, "disable hwcrypto key\n"); |
3015 | break; | 3015 | break; |
3016 | default: | 3016 | default: |
3017 | ret = -EINVAL; | 3017 | ret = -EINVAL; |
3018 | } | 3018 | } |
3019 | 3019 | ||
3020 | mutex_unlock(&priv->mutex); | 3020 | mutex_unlock(&il->mutex); |
3021 | IL_DEBUG_MAC80211(priv, "leave\n"); | 3021 | IL_DEBUG_MAC80211(il, "leave\n"); |
3022 | 3022 | ||
3023 | return ret; | 3023 | return ret; |
3024 | } | 3024 | } |
@@ -3027,38 +3027,38 @@ static int il3945_mac_sta_add(struct ieee80211_hw *hw, | |||
3027 | struct ieee80211_vif *vif, | 3027 | struct ieee80211_vif *vif, |
3028 | struct ieee80211_sta *sta) | 3028 | struct ieee80211_sta *sta) |
3029 | { | 3029 | { |
3030 | struct il_priv *priv = hw->priv; | 3030 | struct il_priv *il = hw->priv; |
3031 | struct il3945_sta_priv *sta_priv = (void *)sta->drv_priv; | 3031 | struct il3945_sta_priv *sta_priv = (void *)sta->drv_priv; |
3032 | int ret; | 3032 | int ret; |
3033 | bool is_ap = vif->type == NL80211_IFTYPE_STATION; | 3033 | bool is_ap = vif->type == NL80211_IFTYPE_STATION; |
3034 | u8 sta_id; | 3034 | u8 sta_id; |
3035 | 3035 | ||
3036 | IL_DEBUG_INFO(priv, "received request to add station %pM\n", | 3036 | IL_DEBUG_INFO(il, "received request to add station %pM\n", |
3037 | sta->addr); | 3037 | sta->addr); |
3038 | mutex_lock(&priv->mutex); | 3038 | mutex_lock(&il->mutex); |
3039 | IL_DEBUG_INFO(priv, "proceeding to add station %pM\n", | 3039 | IL_DEBUG_INFO(il, "proceeding to add station %pM\n", |
3040 | sta->addr); | 3040 | sta->addr); |
3041 | sta_priv->common.sta_id = IL_INVALID_STATION; | 3041 | sta_priv->common.sta_id = IL_INVALID_STATION; |
3042 | 3042 | ||
3043 | 3043 | ||
3044 | ret = il_add_station_common(priv, | 3044 | ret = il_add_station_common(il, |
3045 | &priv->contexts[IL_RXON_CTX_BSS], | 3045 | &il->contexts[IL_RXON_CTX_BSS], |
3046 | sta->addr, is_ap, sta, &sta_id); | 3046 | sta->addr, is_ap, sta, &sta_id); |
3047 | if (ret) { | 3047 | if (ret) { |
3048 | IL_ERR(priv, "Unable to add station %pM (%d)\n", | 3048 | IL_ERR(il, "Unable to add station %pM (%d)\n", |
3049 | sta->addr, ret); | 3049 | sta->addr, ret); |
3050 | /* Should we return success if return code is EEXIST ? */ | 3050 | /* Should we return success if return code is EEXIST ? */ |
3051 | mutex_unlock(&priv->mutex); | 3051 | mutex_unlock(&il->mutex); |
3052 | return ret; | 3052 | return ret; |
3053 | } | 3053 | } |
3054 | 3054 | ||
3055 | sta_priv->common.sta_id = sta_id; | 3055 | sta_priv->common.sta_id = sta_id; |
3056 | 3056 | ||
3057 | /* Initialize rate scaling */ | 3057 | /* Initialize rate scaling */ |
3058 | IL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", | 3058 | IL_DEBUG_INFO(il, "Initializing rate scaling for station %pM\n", |
3059 | sta->addr); | 3059 | sta->addr); |
3060 | il3945_rs_rate_init(priv, sta, sta_id); | 3060 | il3945_rs_rate_init(il, sta, sta_id); |
3061 | mutex_unlock(&priv->mutex); | 3061 | mutex_unlock(&il->mutex); |
3062 | 3062 | ||
3063 | return 0; | 3063 | return 0; |
3064 | } | 3064 | } |
@@ -3068,9 +3068,9 @@ static void il3945_configure_filter(struct ieee80211_hw *hw, | |||
3068 | unsigned int *total_flags, | 3068 | unsigned int *total_flags, |
3069 | u64 multicast) | 3069 | u64 multicast) |
3070 | { | 3070 | { |
3071 | struct il_priv *priv = hw->priv; | 3071 | struct il_priv *il = hw->priv; |
3072 | __le32 filter_or = 0, filter_nand = 0; | 3072 | __le32 filter_or = 0, filter_nand = 0; |
3073 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 3073 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
3074 | 3074 | ||
3075 | #define CHK(test, flag) do { \ | 3075 | #define CHK(test, flag) do { \ |
3076 | if (*total_flags & (test)) \ | 3076 | if (*total_flags & (test)) \ |
@@ -3079,7 +3079,7 @@ static void il3945_configure_filter(struct ieee80211_hw *hw, | |||
3079 | filter_nand |= (flag); \ | 3079 | filter_nand |= (flag); \ |
3080 | } while (0) | 3080 | } while (0) |
3081 | 3081 | ||
3082 | IL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", | 3082 | IL_DEBUG_MAC80211(il, "Enter: changed: 0x%x, total: 0x%x\n", |
3083 | changed_flags, *total_flags); | 3083 | changed_flags, *total_flags); |
3084 | 3084 | ||
3085 | CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); | 3085 | CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); |
@@ -3088,7 +3088,7 @@ static void il3945_configure_filter(struct ieee80211_hw *hw, | |||
3088 | 3088 | ||
3089 | #undef CHK | 3089 | #undef CHK |
3090 | 3090 | ||
3091 | mutex_lock(&priv->mutex); | 3091 | mutex_lock(&il->mutex); |
3092 | 3092 | ||
3093 | ctx->staging.filter_flags &= ~filter_nand; | 3093 | ctx->staging.filter_flags &= ~filter_nand; |
3094 | ctx->staging.filter_flags |= filter_or; | 3094 | ctx->staging.filter_flags |= filter_or; |
@@ -3099,7 +3099,7 @@ static void il3945_configure_filter(struct ieee80211_hw *hw, | |||
3099 | * we'll eventually commit the filter flags change anyway. | 3099 | * we'll eventually commit the filter flags change anyway. |
3100 | */ | 3100 | */ |
3101 | 3101 | ||
3102 | mutex_unlock(&priv->mutex); | 3102 | mutex_unlock(&il->mutex); |
3103 | 3103 | ||
3104 | /* | 3104 | /* |
3105 | * Receiving all multicast frames is always enabled by the | 3105 | * Receiving all multicast frames is always enabled by the |
@@ -3134,24 +3134,24 @@ static void il3945_configure_filter(struct ieee80211_hw *hw, | |||
3134 | static ssize_t il3945_show_debug_level(struct device *d, | 3134 | static ssize_t il3945_show_debug_level(struct device *d, |
3135 | struct device_attribute *attr, char *buf) | 3135 | struct device_attribute *attr, char *buf) |
3136 | { | 3136 | { |
3137 | struct il_priv *priv = dev_get_drvdata(d); | 3137 | struct il_priv *il = dev_get_drvdata(d); |
3138 | return sprintf(buf, "0x%08X\n", il_get_debug_level(priv)); | 3138 | return sprintf(buf, "0x%08X\n", il_get_debug_level(il)); |
3139 | } | 3139 | } |
3140 | static ssize_t il3945_store_debug_level(struct device *d, | 3140 | static ssize_t il3945_store_debug_level(struct device *d, |
3141 | struct device_attribute *attr, | 3141 | struct device_attribute *attr, |
3142 | const char *buf, size_t count) | 3142 | const char *buf, size_t count) |
3143 | { | 3143 | { |
3144 | struct il_priv *priv = dev_get_drvdata(d); | 3144 | struct il_priv *il = dev_get_drvdata(d); |
3145 | unsigned long val; | 3145 | unsigned long val; |
3146 | int ret; | 3146 | int ret; |
3147 | 3147 | ||
3148 | ret = strict_strtoul(buf, 0, &val); | 3148 | ret = strict_strtoul(buf, 0, &val); |
3149 | if (ret) | 3149 | if (ret) |
3150 | IL_INFO(priv, "%s is not in hex or decimal form.\n", buf); | 3150 | IL_INFO(il, "%s is not in hex or decimal form.\n", buf); |
3151 | else { | 3151 | else { |
3152 | priv->debug_level = val; | 3152 | il->debug_level = val; |
3153 | if (il_alloc_traffic_mem(priv)) | 3153 | if (il_alloc_traffic_mem(il)) |
3154 | IL_ERR(priv, | 3154 | IL_ERR(il, |
3155 | "Not enough memory to generate traffic log\n"); | 3155 | "Not enough memory to generate traffic log\n"); |
3156 | } | 3156 | } |
3157 | return strnlen(buf, count); | 3157 | return strnlen(buf, count); |
@@ -3165,12 +3165,12 @@ static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO, | |||
3165 | static ssize_t il3945_show_temperature(struct device *d, | 3165 | static ssize_t il3945_show_temperature(struct device *d, |
3166 | struct device_attribute *attr, char *buf) | 3166 | struct device_attribute *attr, char *buf) |
3167 | { | 3167 | { |
3168 | struct il_priv *priv = dev_get_drvdata(d); | 3168 | struct il_priv *il = dev_get_drvdata(d); |
3169 | 3169 | ||
3170 | if (!il_is_alive(priv)) | 3170 | if (!il_is_alive(il)) |
3171 | return -EAGAIN; | 3171 | return -EAGAIN; |
3172 | 3172 | ||
3173 | return sprintf(buf, "%d\n", il3945_hw_get_temperature(priv)); | 3173 | return sprintf(buf, "%d\n", il3945_hw_get_temperature(il)); |
3174 | } | 3174 | } |
3175 | 3175 | ||
3176 | static DEVICE_ATTR(temperature, S_IRUGO, il3945_show_temperature, NULL); | 3176 | static DEVICE_ATTR(temperature, S_IRUGO, il3945_show_temperature, NULL); |
@@ -3178,23 +3178,23 @@ static DEVICE_ATTR(temperature, S_IRUGO, il3945_show_temperature, NULL); | |||
3178 | static ssize_t il3945_show_tx_power(struct device *d, | 3178 | static ssize_t il3945_show_tx_power(struct device *d, |
3179 | struct device_attribute *attr, char *buf) | 3179 | struct device_attribute *attr, char *buf) |
3180 | { | 3180 | { |
3181 | struct il_priv *priv = dev_get_drvdata(d); | 3181 | struct il_priv *il = dev_get_drvdata(d); |
3182 | return sprintf(buf, "%d\n", priv->tx_power_user_lmt); | 3182 | return sprintf(buf, "%d\n", il->tx_power_user_lmt); |
3183 | } | 3183 | } |
3184 | 3184 | ||
3185 | static ssize_t il3945_store_tx_power(struct device *d, | 3185 | static ssize_t il3945_store_tx_power(struct device *d, |
3186 | struct device_attribute *attr, | 3186 | struct device_attribute *attr, |
3187 | const char *buf, size_t count) | 3187 | const char *buf, size_t count) |
3188 | { | 3188 | { |
3189 | struct il_priv *priv = dev_get_drvdata(d); | 3189 | struct il_priv *il = dev_get_drvdata(d); |
3190 | char *p = (char *)buf; | 3190 | char *p = (char *)buf; |
3191 | u32 val; | 3191 | u32 val; |
3192 | 3192 | ||
3193 | val = simple_strtoul(p, &p, 10); | 3193 | val = simple_strtoul(p, &p, 10); |
3194 | if (p == buf) | 3194 | if (p == buf) |
3195 | IL_INFO(priv, ": %s is not in decimal form.\n", buf); | 3195 | IL_INFO(il, ": %s is not in decimal form.\n", buf); |
3196 | else | 3196 | else |
3197 | il3945_hw_reg_set_txpower(priv, val); | 3197 | il3945_hw_reg_set_txpower(il, val); |
3198 | 3198 | ||
3199 | return count; | 3199 | return count; |
3200 | } | 3200 | } |
@@ -3204,8 +3204,8 @@ static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, il3945_show_tx_power, il3945_sto | |||
3204 | static ssize_t il3945_show_flags(struct device *d, | 3204 | static ssize_t il3945_show_flags(struct device *d, |
3205 | struct device_attribute *attr, char *buf) | 3205 | struct device_attribute *attr, char *buf) |
3206 | { | 3206 | { |
3207 | struct il_priv *priv = dev_get_drvdata(d); | 3207 | struct il_priv *il = dev_get_drvdata(d); |
3208 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 3208 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
3209 | 3209 | ||
3210 | return sprintf(buf, "0x%04X\n", ctx->active.flags); | 3210 | return sprintf(buf, "0x%04X\n", ctx->active.flags); |
3211 | } | 3211 | } |
@@ -3214,23 +3214,23 @@ static ssize_t il3945_store_flags(struct device *d, | |||
3214 | struct device_attribute *attr, | 3214 | struct device_attribute *attr, |
3215 | const char *buf, size_t count) | 3215 | const char *buf, size_t count) |
3216 | { | 3216 | { |
3217 | struct il_priv *priv = dev_get_drvdata(d); | 3217 | struct il_priv *il = dev_get_drvdata(d); |
3218 | u32 flags = simple_strtoul(buf, NULL, 0); | 3218 | u32 flags = simple_strtoul(buf, NULL, 0); |
3219 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 3219 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
3220 | 3220 | ||
3221 | mutex_lock(&priv->mutex); | 3221 | mutex_lock(&il->mutex); |
3222 | if (le32_to_cpu(ctx->staging.flags) != flags) { | 3222 | if (le32_to_cpu(ctx->staging.flags) != flags) { |
3223 | /* Cancel any currently running scans... */ | 3223 | /* Cancel any currently running scans... */ |
3224 | if (il_scan_cancel_timeout(priv, 100)) | 3224 | if (il_scan_cancel_timeout(il, 100)) |
3225 | IL_WARN(priv, "Could not cancel scan.\n"); | 3225 | IL_WARN(il, "Could not cancel scan.\n"); |
3226 | else { | 3226 | else { |
3227 | IL_DEBUG_INFO(priv, "Committing rxon.flags = 0x%04X\n", | 3227 | IL_DEBUG_INFO(il, "Committing rxon.flags = 0x%04X\n", |
3228 | flags); | 3228 | flags); |
3229 | ctx->staging.flags = cpu_to_le32(flags); | 3229 | ctx->staging.flags = cpu_to_le32(flags); |
3230 | il3945_commit_rxon(priv, ctx); | 3230 | il3945_commit_rxon(il, ctx); |
3231 | } | 3231 | } |
3232 | } | 3232 | } |
3233 | mutex_unlock(&priv->mutex); | 3233 | mutex_unlock(&il->mutex); |
3234 | 3234 | ||
3235 | return count; | 3235 | return count; |
3236 | } | 3236 | } |
@@ -3240,8 +3240,8 @@ static DEVICE_ATTR(flags, S_IWUSR | S_IRUGO, il3945_show_flags, il3945_store_fla | |||
3240 | static ssize_t il3945_show_filter_flags(struct device *d, | 3240 | static ssize_t il3945_show_filter_flags(struct device *d, |
3241 | struct device_attribute *attr, char *buf) | 3241 | struct device_attribute *attr, char *buf) |
3242 | { | 3242 | { |
3243 | struct il_priv *priv = dev_get_drvdata(d); | 3243 | struct il_priv *il = dev_get_drvdata(d); |
3244 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 3244 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
3245 | 3245 | ||
3246 | return sprintf(buf, "0x%04X\n", | 3246 | return sprintf(buf, "0x%04X\n", |
3247 | le32_to_cpu(ctx->active.filter_flags)); | 3247 | le32_to_cpu(ctx->active.filter_flags)); |
@@ -3251,24 +3251,24 @@ static ssize_t il3945_store_filter_flags(struct device *d, | |||
3251 | struct device_attribute *attr, | 3251 | struct device_attribute *attr, |
3252 | const char *buf, size_t count) | 3252 | const char *buf, size_t count) |
3253 | { | 3253 | { |
3254 | struct il_priv *priv = dev_get_drvdata(d); | 3254 | struct il_priv *il = dev_get_drvdata(d); |
3255 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 3255 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
3256 | u32 filter_flags = simple_strtoul(buf, NULL, 0); | 3256 | u32 filter_flags = simple_strtoul(buf, NULL, 0); |
3257 | 3257 | ||
3258 | mutex_lock(&priv->mutex); | 3258 | mutex_lock(&il->mutex); |
3259 | if (le32_to_cpu(ctx->staging.filter_flags) != filter_flags) { | 3259 | if (le32_to_cpu(ctx->staging.filter_flags) != filter_flags) { |
3260 | /* Cancel any currently running scans... */ | 3260 | /* Cancel any currently running scans... */ |
3261 | if (il_scan_cancel_timeout(priv, 100)) | 3261 | if (il_scan_cancel_timeout(il, 100)) |
3262 | IL_WARN(priv, "Could not cancel scan.\n"); | 3262 | IL_WARN(il, "Could not cancel scan.\n"); |
3263 | else { | 3263 | else { |
3264 | IL_DEBUG_INFO(priv, "Committing rxon.filter_flags = " | 3264 | IL_DEBUG_INFO(il, "Committing rxon.filter_flags = " |
3265 | "0x%04X\n", filter_flags); | 3265 | "0x%04X\n", filter_flags); |
3266 | ctx->staging.filter_flags = | 3266 | ctx->staging.filter_flags = |
3267 | cpu_to_le32(filter_flags); | 3267 | cpu_to_le32(filter_flags); |
3268 | il3945_commit_rxon(priv, ctx); | 3268 | il3945_commit_rxon(il, ctx); |
3269 | } | 3269 | } |
3270 | } | 3270 | } |
3271 | mutex_unlock(&priv->mutex); | 3271 | mutex_unlock(&il->mutex); |
3272 | 3272 | ||
3273 | return count; | 3273 | return count; |
3274 | } | 3274 | } |
@@ -3279,20 +3279,20 @@ static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, il3945_show_filter_flags, | |||
3279 | static ssize_t il3945_show_measurement(struct device *d, | 3279 | static ssize_t il3945_show_measurement(struct device *d, |
3280 | struct device_attribute *attr, char *buf) | 3280 | struct device_attribute *attr, char *buf) |
3281 | { | 3281 | { |
3282 | struct il_priv *priv = dev_get_drvdata(d); | 3282 | struct il_priv *il = dev_get_drvdata(d); |
3283 | struct il_spectrum_notification measure_report; | 3283 | struct il_spectrum_notification measure_report; |
3284 | u32 size = sizeof(measure_report), len = 0, ofs = 0; | 3284 | u32 size = sizeof(measure_report), len = 0, ofs = 0; |
3285 | u8 *data = (u8 *)&measure_report; | 3285 | u8 *data = (u8 *)&measure_report; |
3286 | unsigned long flags; | 3286 | unsigned long flags; |
3287 | 3287 | ||
3288 | spin_lock_irqsave(&priv->lock, flags); | 3288 | spin_lock_irqsave(&il->lock, flags); |
3289 | if (!(priv->measurement_status & MEASUREMENT_READY)) { | 3289 | if (!(il->measurement_status & MEASUREMENT_READY)) { |
3290 | spin_unlock_irqrestore(&priv->lock, flags); | 3290 | spin_unlock_irqrestore(&il->lock, flags); |
3291 | return 0; | 3291 | return 0; |
3292 | } | 3292 | } |
3293 | memcpy(&measure_report, &priv->measure_report, size); | 3293 | memcpy(&measure_report, &il->measure_report, size); |
3294 | priv->measurement_status = 0; | 3294 | il->measurement_status = 0; |
3295 | spin_unlock_irqrestore(&priv->lock, flags); | 3295 | spin_unlock_irqrestore(&il->lock, flags); |
3296 | 3296 | ||
3297 | while (size && (PAGE_SIZE - len)) { | 3297 | while (size && (PAGE_SIZE - len)) { |
3298 | hex_dump_to_buffer(data + ofs, size, 16, 1, buf + len, | 3298 | hex_dump_to_buffer(data + ofs, size, 16, 1, buf + len, |
@@ -3312,11 +3312,11 @@ static ssize_t il3945_store_measurement(struct device *d, | |||
3312 | struct device_attribute *attr, | 3312 | struct device_attribute *attr, |
3313 | const char *buf, size_t count) | 3313 | const char *buf, size_t count) |
3314 | { | 3314 | { |
3315 | struct il_priv *priv = dev_get_drvdata(d); | 3315 | struct il_priv *il = dev_get_drvdata(d); |
3316 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 3316 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
3317 | struct ieee80211_measurement_params params = { | 3317 | struct ieee80211_measurement_params params = { |
3318 | .channel = le16_to_cpu(ctx->active.channel), | 3318 | .channel = le16_to_cpu(ctx->active.channel), |
3319 | .start_time = cpu_to_le64(priv->_3945.last_tsf), | 3319 | .start_time = cpu_to_le64(il->_3945.last_tsf), |
3320 | .duration = cpu_to_le16(1), | 3320 | .duration = cpu_to_le16(1), |
3321 | }; | 3321 | }; |
3322 | u8 type = IL_MEASURE_BASIC; | 3322 | u8 type = IL_MEASURE_BASIC; |
@@ -3337,9 +3337,9 @@ static ssize_t il3945_store_measurement(struct device *d, | |||
3337 | type = simple_strtoul(p + 1, NULL, 0); | 3337 | type = simple_strtoul(p + 1, NULL, 0); |
3338 | } | 3338 | } |
3339 | 3339 | ||
3340 | IL_DEBUG_INFO(priv, "Invoking measurement of type %d on " | 3340 | IL_DEBUG_INFO(il, "Invoking measurement of type %d on " |
3341 | "channel %d (for '%s')\n", type, params.channel, buf); | 3341 | "channel %d (for '%s')\n", type, params.channel, buf); |
3342 | il3945_get_measurement(priv, ¶ms, type); | 3342 | il3945_get_measurement(il, ¶ms, type); |
3343 | 3343 | ||
3344 | return count; | 3344 | return count; |
3345 | } | 3345 | } |
@@ -3351,11 +3351,11 @@ static ssize_t il3945_store_retry_rate(struct device *d, | |||
3351 | struct device_attribute *attr, | 3351 | struct device_attribute *attr, |
3352 | const char *buf, size_t count) | 3352 | const char *buf, size_t count) |
3353 | { | 3353 | { |
3354 | struct il_priv *priv = dev_get_drvdata(d); | 3354 | struct il_priv *il = dev_get_drvdata(d); |
3355 | 3355 | ||
3356 | priv->retry_rate = simple_strtoul(buf, NULL, 0); | 3356 | il->retry_rate = simple_strtoul(buf, NULL, 0); |
3357 | if (priv->retry_rate <= 0) | 3357 | if (il->retry_rate <= 0) |
3358 | priv->retry_rate = 1; | 3358 | il->retry_rate = 1; |
3359 | 3359 | ||
3360 | return count; | 3360 | return count; |
3361 | } | 3361 | } |
@@ -3363,8 +3363,8 @@ static ssize_t il3945_store_retry_rate(struct device *d, | |||
3363 | static ssize_t il3945_show_retry_rate(struct device *d, | 3363 | static ssize_t il3945_show_retry_rate(struct device *d, |
3364 | struct device_attribute *attr, char *buf) | 3364 | struct device_attribute *attr, char *buf) |
3365 | { | 3365 | { |
3366 | struct il_priv *priv = dev_get_drvdata(d); | 3366 | struct il_priv *il = dev_get_drvdata(d); |
3367 | return sprintf(buf, "%d", priv->retry_rate); | 3367 | return sprintf(buf, "%d", il->retry_rate); |
3368 | } | 3368 | } |
3369 | 3369 | ||
3370 | static DEVICE_ATTR(retry_rate, S_IWUSR | S_IRUSR, il3945_show_retry_rate, | 3370 | 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); | |||
3383 | static ssize_t il3945_show_antenna(struct device *d, | 3383 | static ssize_t il3945_show_antenna(struct device *d, |
3384 | struct device_attribute *attr, char *buf) | 3384 | struct device_attribute *attr, char *buf) |
3385 | { | 3385 | { |
3386 | struct il_priv *priv = dev_get_drvdata(d); | 3386 | struct il_priv *il = dev_get_drvdata(d); |
3387 | 3387 | ||
3388 | if (!il_is_alive(priv)) | 3388 | if (!il_is_alive(il)) |
3389 | return -EAGAIN; | 3389 | return -EAGAIN; |
3390 | 3390 | ||
3391 | return sprintf(buf, "%d\n", il3945_mod_params.antenna); | 3391 | return sprintf(buf, "%d\n", il3945_mod_params.antenna); |
@@ -3395,22 +3395,22 @@ static ssize_t il3945_store_antenna(struct device *d, | |||
3395 | struct device_attribute *attr, | 3395 | struct device_attribute *attr, |
3396 | const char *buf, size_t count) | 3396 | const char *buf, size_t count) |
3397 | { | 3397 | { |
3398 | struct il_priv *priv __maybe_unused = dev_get_drvdata(d); | 3398 | struct il_priv *il __maybe_unused = dev_get_drvdata(d); |
3399 | int ant; | 3399 | int ant; |
3400 | 3400 | ||
3401 | if (count == 0) | 3401 | if (count == 0) |
3402 | return 0; | 3402 | return 0; |
3403 | 3403 | ||
3404 | if (sscanf(buf, "%1i", &ant) != 1) { | 3404 | if (sscanf(buf, "%1i", &ant) != 1) { |
3405 | IL_DEBUG_INFO(priv, "not in hex or decimal form.\n"); | 3405 | IL_DEBUG_INFO(il, "not in hex or decimal form.\n"); |
3406 | return count; | 3406 | return count; |
3407 | } | 3407 | } |
3408 | 3408 | ||
3409 | if ((ant >= 0) && (ant <= 2)) { | 3409 | if ((ant >= 0) && (ant <= 2)) { |
3410 | IL_DEBUG_INFO(priv, "Setting antenna select to %d.\n", ant); | 3410 | IL_DEBUG_INFO(il, "Setting antenna select to %d.\n", ant); |
3411 | il3945_mod_params.antenna = (enum il3945_antenna)ant; | 3411 | il3945_mod_params.antenna = (enum il3945_antenna)ant; |
3412 | } else | 3412 | } else |
3413 | IL_DEBUG_INFO(priv, "Bad antenna select value %d.\n", ant); | 3413 | IL_DEBUG_INFO(il, "Bad antenna select value %d.\n", ant); |
3414 | 3414 | ||
3415 | 3415 | ||
3416 | return count; | 3416 | return count; |
@@ -3421,10 +3421,10 @@ static DEVICE_ATTR(antenna, S_IWUSR | S_IRUGO, il3945_show_antenna, il3945_store | |||
3421 | static ssize_t il3945_show_status(struct device *d, | 3421 | static ssize_t il3945_show_status(struct device *d, |
3422 | struct device_attribute *attr, char *buf) | 3422 | struct device_attribute *attr, char *buf) |
3423 | { | 3423 | { |
3424 | struct il_priv *priv = dev_get_drvdata(d); | 3424 | struct il_priv *il = dev_get_drvdata(d); |
3425 | if (!il_is_alive(priv)) | 3425 | if (!il_is_alive(il)) |
3426 | return -EAGAIN; | 3426 | return -EAGAIN; |
3427 | return sprintf(buf, "0x%08x\n", (int)priv->status); | 3427 | return sprintf(buf, "0x%08x\n", (int)il->status); |
3428 | } | 3428 | } |
3429 | 3429 | ||
3430 | static DEVICE_ATTR(status, S_IRUGO, il3945_show_status, NULL); | 3430 | static DEVICE_ATTR(status, S_IRUGO, il3945_show_status, NULL); |
@@ -3433,11 +3433,11 @@ static ssize_t il3945_dump_error_log(struct device *d, | |||
3433 | struct device_attribute *attr, | 3433 | struct device_attribute *attr, |
3434 | const char *buf, size_t count) | 3434 | const char *buf, size_t count) |
3435 | { | 3435 | { |
3436 | struct il_priv *priv = dev_get_drvdata(d); | 3436 | struct il_priv *il = dev_get_drvdata(d); |
3437 | char *p = (char *)buf; | 3437 | char *p = (char *)buf; |
3438 | 3438 | ||
3439 | if (p[0] == '1') | 3439 | if (p[0] == '1') |
3440 | il3945_dump_nic_error_log(priv); | 3440 | il3945_dump_nic_error_log(il); |
3441 | 3441 | ||
3442 | return strnlen(buf, count); | 3442 | return strnlen(buf, count); |
3443 | } | 3443 | } |
@@ -3450,38 +3450,38 @@ static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, il3945_dump_error_log); | |||
3450 | * | 3450 | * |
3451 | *****************************************************************************/ | 3451 | *****************************************************************************/ |
3452 | 3452 | ||
3453 | static void il3945_setup_deferred_work(struct il_priv *priv) | 3453 | static void il3945_setup_deferred_work(struct il_priv *il) |
3454 | { | 3454 | { |
3455 | priv->workqueue = create_singlethread_workqueue(DRV_NAME); | 3455 | il->workqueue = create_singlethread_workqueue(DRV_NAME); |
3456 | 3456 | ||
3457 | init_waitqueue_head(&priv->wait_command_queue); | 3457 | init_waitqueue_head(&il->wait_command_queue); |
3458 | 3458 | ||
3459 | INIT_WORK(&priv->restart, il3945_bg_restart); | 3459 | INIT_WORK(&il->restart, il3945_bg_restart); |
3460 | INIT_WORK(&priv->rx_replenish, il3945_bg_rx_replenish); | 3460 | INIT_WORK(&il->rx_replenish, il3945_bg_rx_replenish); |
3461 | INIT_DELAYED_WORK(&priv->init_alive_start, il3945_bg_init_alive_start); | 3461 | INIT_DELAYED_WORK(&il->init_alive_start, il3945_bg_init_alive_start); |
3462 | INIT_DELAYED_WORK(&priv->alive_start, il3945_bg_alive_start); | 3462 | INIT_DELAYED_WORK(&il->alive_start, il3945_bg_alive_start); |
3463 | INIT_DELAYED_WORK(&priv->_3945.rfkill_poll, il3945_rfkill_poll); | 3463 | INIT_DELAYED_WORK(&il->_3945.rfkill_poll, il3945_rfkill_poll); |
3464 | 3464 | ||
3465 | il_setup_scan_deferred_work(priv); | 3465 | il_setup_scan_deferred_work(il); |
3466 | 3466 | ||
3467 | il3945_hw_setup_deferred_work(priv); | 3467 | il3945_hw_setup_deferred_work(il); |
3468 | 3468 | ||
3469 | init_timer(&priv->watchdog); | 3469 | init_timer(&il->watchdog); |
3470 | priv->watchdog.data = (unsigned long)priv; | 3470 | il->watchdog.data = (unsigned long)il; |
3471 | priv->watchdog.function = il_bg_watchdog; | 3471 | il->watchdog.function = il_bg_watchdog; |
3472 | 3472 | ||
3473 | tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) | 3473 | tasklet_init(&il->irq_tasklet, (void (*)(unsigned long)) |
3474 | il3945_irq_tasklet, (unsigned long)priv); | 3474 | il3945_irq_tasklet, (unsigned long)il); |
3475 | } | 3475 | } |
3476 | 3476 | ||
3477 | static void il3945_cancel_deferred_work(struct il_priv *priv) | 3477 | static void il3945_cancel_deferred_work(struct il_priv *il) |
3478 | { | 3478 | { |
3479 | il3945_hw_cancel_deferred_work(priv); | 3479 | il3945_hw_cancel_deferred_work(il); |
3480 | 3480 | ||
3481 | cancel_delayed_work_sync(&priv->init_alive_start); | 3481 | cancel_delayed_work_sync(&il->init_alive_start); |
3482 | cancel_delayed_work(&priv->alive_start); | 3482 | cancel_delayed_work(&il->alive_start); |
3483 | 3483 | ||
3484 | il_cancel_scan_deferred_work(priv); | 3484 | il_cancel_scan_deferred_work(il); |
3485 | } | 3485 | } |
3486 | 3486 | ||
3487 | static struct attribute *il3945_sysfs_entries[] = { | 3487 | static struct attribute *il3945_sysfs_entries[] = { |
@@ -3525,70 +3525,70 @@ struct ieee80211_ops il3945_hw_ops = { | |||
3525 | .tx_last_beacon = il_mac_tx_last_beacon, | 3525 | .tx_last_beacon = il_mac_tx_last_beacon, |
3526 | }; | 3526 | }; |
3527 | 3527 | ||
3528 | static int il3945_init_drv(struct il_priv *priv) | 3528 | static int il3945_init_drv(struct il_priv *il) |
3529 | { | 3529 | { |
3530 | int ret; | 3530 | int ret; |
3531 | struct il3945_eeprom *eeprom = (struct il3945_eeprom *)priv->eeprom; | 3531 | struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; |
3532 | 3532 | ||
3533 | priv->retry_rate = 1; | 3533 | il->retry_rate = 1; |
3534 | priv->beacon_skb = NULL; | 3534 | il->beacon_skb = NULL; |
3535 | 3535 | ||
3536 | spin_lock_init(&priv->sta_lock); | 3536 | spin_lock_init(&il->sta_lock); |
3537 | spin_lock_init(&priv->hcmd_lock); | 3537 | spin_lock_init(&il->hcmd_lock); |
3538 | 3538 | ||
3539 | INIT_LIST_HEAD(&priv->free_frames); | 3539 | INIT_LIST_HEAD(&il->free_frames); |
3540 | 3540 | ||
3541 | mutex_init(&priv->mutex); | 3541 | mutex_init(&il->mutex); |
3542 | 3542 | ||
3543 | priv->ieee_channels = NULL; | 3543 | il->ieee_channels = NULL; |
3544 | priv->ieee_rates = NULL; | 3544 | il->ieee_rates = NULL; |
3545 | priv->band = IEEE80211_BAND_2GHZ; | 3545 | il->band = IEEE80211_BAND_2GHZ; |
3546 | 3546 | ||
3547 | priv->iw_mode = NL80211_IFTYPE_STATION; | 3547 | il->iw_mode = NL80211_IFTYPE_STATION; |
3548 | priv->missed_beacon_threshold = IL_MISSED_BEACON_THRESHOLD_DEF; | 3548 | il->missed_beacon_threshold = IL_MISSED_BEACON_THRESHOLD_DEF; |
3549 | 3549 | ||
3550 | /* initialize force reset */ | 3550 | /* initialize force reset */ |
3551 | priv->force_reset.reset_duration = IL_DELAY_NEXT_FORCE_FW_RELOAD; | 3551 | il->force_reset.reset_duration = IL_DELAY_NEXT_FORCE_FW_RELOAD; |
3552 | 3552 | ||
3553 | if (eeprom->version < EEPROM_3945_EEPROM_VERSION) { | 3553 | if (eeprom->version < EEPROM_3945_EEPROM_VERSION) { |
3554 | IL_WARN(priv, "Unsupported EEPROM version: 0x%04X\n", | 3554 | IL_WARN(il, "Unsupported EEPROM version: 0x%04X\n", |
3555 | eeprom->version); | 3555 | eeprom->version); |
3556 | ret = -EINVAL; | 3556 | ret = -EINVAL; |
3557 | goto err; | 3557 | goto err; |
3558 | } | 3558 | } |
3559 | ret = il_init_channel_map(priv); | 3559 | ret = il_init_channel_map(il); |
3560 | if (ret) { | 3560 | if (ret) { |
3561 | IL_ERR(priv, "initializing regulatory failed: %d\n", ret); | 3561 | IL_ERR(il, "initializing regulatory failed: %d\n", ret); |
3562 | goto err; | 3562 | goto err; |
3563 | } | 3563 | } |
3564 | 3564 | ||
3565 | /* Set up txpower settings in driver for all channels */ | 3565 | /* Set up txpower settings in driver for all channels */ |
3566 | if (il3945_txpower_set_from_eeprom(priv)) { | 3566 | if (il3945_txpower_set_from_eeprom(il)) { |
3567 | ret = -EIO; | 3567 | ret = -EIO; |
3568 | goto err_free_channel_map; | 3568 | goto err_free_channel_map; |
3569 | } | 3569 | } |
3570 | 3570 | ||
3571 | ret = il_init_geos(priv); | 3571 | ret = il_init_geos(il); |
3572 | if (ret) { | 3572 | if (ret) { |
3573 | IL_ERR(priv, "initializing geos failed: %d\n", ret); | 3573 | IL_ERR(il, "initializing geos failed: %d\n", ret); |
3574 | goto err_free_channel_map; | 3574 | goto err_free_channel_map; |
3575 | } | 3575 | } |
3576 | il3945_init_hw_rates(priv, priv->ieee_rates); | 3576 | il3945_init_hw_rates(il, il->ieee_rates); |
3577 | 3577 | ||
3578 | return 0; | 3578 | return 0; |
3579 | 3579 | ||
3580 | err_free_channel_map: | 3580 | err_free_channel_map: |
3581 | il_free_channel_map(priv); | 3581 | il_free_channel_map(il); |
3582 | err: | 3582 | err: |
3583 | return ret; | 3583 | return ret; |
3584 | } | 3584 | } |
3585 | 3585 | ||
3586 | #define IWL3945_MAX_PROBE_REQUEST 200 | 3586 | #define IWL3945_MAX_PROBE_REQUEST 200 |
3587 | 3587 | ||
3588 | static int il3945_setup_mac(struct il_priv *priv) | 3588 | static int il3945_setup_mac(struct il_priv *il) |
3589 | { | 3589 | { |
3590 | int ret; | 3590 | int ret; |
3591 | struct ieee80211_hw *hw = priv->hw; | 3591 | struct ieee80211_hw *hw = il->hw; |
3592 | 3592 | ||
3593 | hw->rate_control_algorithm = "iwl-3945-rs"; | 3593 | hw->rate_control_algorithm = "iwl-3945-rs"; |
3594 | hw->sta_data_size = sizeof(struct il3945_sta_priv); | 3594 | hw->sta_data_size = sizeof(struct il3945_sta_priv); |
@@ -3599,7 +3599,7 @@ static int il3945_setup_mac(struct il_priv *priv) | |||
3599 | IEEE80211_HW_SPECTRUM_MGMT; | 3599 | IEEE80211_HW_SPECTRUM_MGMT; |
3600 | 3600 | ||
3601 | hw->wiphy->interface_modes = | 3601 | hw->wiphy->interface_modes = |
3602 | priv->contexts[IL_RXON_CTX_BSS].interface_modes; | 3602 | il->contexts[IL_RXON_CTX_BSS].interface_modes; |
3603 | 3603 | ||
3604 | hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | | 3604 | hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | |
3605 | WIPHY_FLAG_DISABLE_BEACON_HINTS | | 3605 | WIPHY_FLAG_DISABLE_BEACON_HINTS | |
@@ -3612,22 +3612,22 @@ static int il3945_setup_mac(struct il_priv *priv) | |||
3612 | /* Default value; 4 EDCA QOS priorities */ | 3612 | /* Default value; 4 EDCA QOS priorities */ |
3613 | hw->queues = 4; | 3613 | hw->queues = 4; |
3614 | 3614 | ||
3615 | if (priv->bands[IEEE80211_BAND_2GHZ].n_channels) | 3615 | if (il->bands[IEEE80211_BAND_2GHZ].n_channels) |
3616 | priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = | 3616 | il->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = |
3617 | &priv->bands[IEEE80211_BAND_2GHZ]; | 3617 | &il->bands[IEEE80211_BAND_2GHZ]; |
3618 | 3618 | ||
3619 | if (priv->bands[IEEE80211_BAND_5GHZ].n_channels) | 3619 | if (il->bands[IEEE80211_BAND_5GHZ].n_channels) |
3620 | priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = | 3620 | il->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = |
3621 | &priv->bands[IEEE80211_BAND_5GHZ]; | 3621 | &il->bands[IEEE80211_BAND_5GHZ]; |
3622 | 3622 | ||
3623 | il_leds_init(priv); | 3623 | il_leds_init(il); |
3624 | 3624 | ||
3625 | ret = ieee80211_register_hw(priv->hw); | 3625 | ret = ieee80211_register_hw(il->hw); |
3626 | if (ret) { | 3626 | if (ret) { |
3627 | IL_ERR(priv, "Failed to register hw (error %d)\n", ret); | 3627 | IL_ERR(il, "Failed to register hw (error %d)\n", ret); |
3628 | return ret; | 3628 | return ret; |
3629 | } | 3629 | } |
3630 | priv->mac80211_registered = 1; | 3630 | il->mac80211_registered = 1; |
3631 | 3631 | ||
3632 | return 0; | 3632 | return 0; |
3633 | } | 3633 | } |
@@ -3635,7 +3635,7 @@ static int il3945_setup_mac(struct il_priv *priv) | |||
3635 | static int il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 3635 | static int il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
3636 | { | 3636 | { |
3637 | int err = 0, i; | 3637 | int err = 0, i; |
3638 | struct il_priv *priv; | 3638 | struct il_priv *il; |
3639 | struct ieee80211_hw *hw; | 3639 | struct ieee80211_hw *hw; |
3640 | struct il_cfg *cfg = (struct il_cfg *)(ent->driver_data); | 3640 | struct il_cfg *cfg = (struct il_cfg *)(ent->driver_data); |
3641 | struct il3945_eeprom *eeprom; | 3641 | struct il3945_eeprom *eeprom; |
@@ -3646,53 +3646,53 @@ static int il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *en | |||
3646 | * ********************/ | 3646 | * ********************/ |
3647 | 3647 | ||
3648 | /* mac80211 allocates memory for this device instance, including | 3648 | /* mac80211 allocates memory for this device instance, including |
3649 | * space for this driver's private structure */ | 3649 | * space for this driver's ilate structure */ |
3650 | hw = il_alloc_all(cfg); | 3650 | hw = il_alloc_all(cfg); |
3651 | if (hw == NULL) { | 3651 | if (hw == NULL) { |
3652 | pr_err("Can not allocate network device\n"); | 3652 | pr_err("Can not allocate network device\n"); |
3653 | err = -ENOMEM; | 3653 | err = -ENOMEM; |
3654 | goto out; | 3654 | goto out; |
3655 | } | 3655 | } |
3656 | priv = hw->priv; | 3656 | il = hw->priv; |
3657 | SET_IEEE80211_DEV(hw, &pdev->dev); | 3657 | SET_IEEE80211_DEV(hw, &pdev->dev); |
3658 | 3658 | ||
3659 | priv->cmd_queue = IWL39_CMD_QUEUE_NUM; | 3659 | il->cmd_queue = IWL39_CMD_QUEUE_NUM; |
3660 | 3660 | ||
3661 | /* 3945 has only one valid context */ | 3661 | /* 3945 has only one valid context */ |
3662 | priv->valid_contexts = BIT(IL_RXON_CTX_BSS); | 3662 | il->valid_contexts = BIT(IL_RXON_CTX_BSS); |
3663 | 3663 | ||
3664 | for (i = 0; i < NUM_IL_RXON_CTX; i++) | 3664 | for (i = 0; i < NUM_IL_RXON_CTX; i++) |
3665 | priv->contexts[i].ctxid = i; | 3665 | il->contexts[i].ctxid = i; |
3666 | 3666 | ||
3667 | priv->contexts[IL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON; | 3667 | il->contexts[IL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON; |
3668 | priv->contexts[IL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING; | 3668 | il->contexts[IL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING; |
3669 | priv->contexts[IL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC; | 3669 | il->contexts[IL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC; |
3670 | priv->contexts[IL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM; | 3670 | il->contexts[IL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM; |
3671 | priv->contexts[IL_RXON_CTX_BSS].ap_sta_id = IL_AP_ID; | 3671 | il->contexts[IL_RXON_CTX_BSS].ap_sta_id = IL_AP_ID; |
3672 | priv->contexts[IL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY; | 3672 | il->contexts[IL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY; |
3673 | priv->contexts[IL_RXON_CTX_BSS].interface_modes = | 3673 | il->contexts[IL_RXON_CTX_BSS].interface_modes = |
3674 | BIT(NL80211_IFTYPE_STATION) | | 3674 | BIT(NL80211_IFTYPE_STATION) | |
3675 | BIT(NL80211_IFTYPE_ADHOC); | 3675 | BIT(NL80211_IFTYPE_ADHOC); |
3676 | priv->contexts[IL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS; | 3676 | il->contexts[IL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS; |
3677 | priv->contexts[IL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS; | 3677 | il->contexts[IL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS; |
3678 | priv->contexts[IL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS; | 3678 | il->contexts[IL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS; |
3679 | 3679 | ||
3680 | /* | 3680 | /* |
3681 | * Disabling hardware scan means that mac80211 will perform scans | 3681 | * Disabling hardware scan means that mac80211 will perform scans |
3682 | * "the hard way", rather than using device's scan. | 3682 | * "the hard way", rather than using device's scan. |
3683 | */ | 3683 | */ |
3684 | if (il3945_mod_params.disable_hw_scan) { | 3684 | if (il3945_mod_params.disable_hw_scan) { |
3685 | IL_DEBUG_INFO(priv, "Disabling hw_scan\n"); | 3685 | IL_DEBUG_INFO(il, "Disabling hw_scan\n"); |
3686 | il3945_hw_ops.hw_scan = NULL; | 3686 | il3945_hw_ops.hw_scan = NULL; |
3687 | } | 3687 | } |
3688 | 3688 | ||
3689 | IL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n"); | 3689 | IL_DEBUG_INFO(il, "*** LOAD DRIVER ***\n"); |
3690 | priv->cfg = cfg; | 3690 | il->cfg = cfg; |
3691 | priv->pci_dev = pdev; | 3691 | il->pci_dev = pdev; |
3692 | priv->inta_mask = CSR_INI_SET_MASK; | 3692 | il->inta_mask = CSR_INI_SET_MASK; |
3693 | 3693 | ||
3694 | if (il_alloc_traffic_mem(priv)) | 3694 | if (il_alloc_traffic_mem(il)) |
3695 | IL_ERR(priv, "Not enough memory to generate traffic log\n"); | 3695 | IL_ERR(il, "Not enough memory to generate traffic log\n"); |
3696 | 3696 | ||
3697 | /*************************** | 3697 | /*************************** |
3698 | * 2. Initializing PCI bus | 3698 | * 2. Initializing PCI bus |
@@ -3711,11 +3711,11 @@ static int il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *en | |||
3711 | if (!err) | 3711 | if (!err) |
3712 | err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); | 3712 | err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); |
3713 | if (err) { | 3713 | if (err) { |
3714 | IL_WARN(priv, "No suitable DMA available.\n"); | 3714 | IL_WARN(il, "No suitable DMA available.\n"); |
3715 | goto out_pci_disable_device; | 3715 | goto out_pci_disable_device; |
3716 | } | 3716 | } |
3717 | 3717 | ||
3718 | pci_set_drvdata(pdev, priv); | 3718 | pci_set_drvdata(pdev, il); |
3719 | err = pci_request_regions(pdev, DRV_NAME); | 3719 | err = pci_request_regions(pdev, DRV_NAME); |
3720 | if (err) | 3720 | if (err) |
3721 | goto out_pci_disable_device; | 3721 | goto out_pci_disable_device; |
@@ -3723,15 +3723,15 @@ static int il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *en | |||
3723 | /*********************** | 3723 | /*********************** |
3724 | * 3. Read REV Register | 3724 | * 3. Read REV Register |
3725 | * ********************/ | 3725 | * ********************/ |
3726 | priv->hw_base = pci_iomap(pdev, 0, 0); | 3726 | il->hw_base = pci_iomap(pdev, 0, 0); |
3727 | if (!priv->hw_base) { | 3727 | if (!il->hw_base) { |
3728 | err = -ENODEV; | 3728 | err = -ENODEV; |
3729 | goto out_pci_release_regions; | 3729 | goto out_pci_release_regions; |
3730 | } | 3730 | } |
3731 | 3731 | ||
3732 | IL_DEBUG_INFO(priv, "pci_resource_len = 0x%08llx\n", | 3732 | IL_DEBUG_INFO(il, "pci_resource_len = 0x%08llx\n", |
3733 | (unsigned long long) pci_resource_len(pdev, 0)); | 3733 | (unsigned long long) pci_resource_len(pdev, 0)); |
3734 | IL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base); | 3734 | IL_DEBUG_INFO(il, "pci_resource_base = %p\n", il->hw_base); |
3735 | 3735 | ||
3736 | /* We disable the RETRY_TIMEOUT register (0x41) to keep | 3736 | /* We disable the RETRY_TIMEOUT register (0x41) to keep |
3737 | * PCI Tx retries from interfering with C3 CPU state */ | 3737 | * PCI Tx retries from interfering with C3 CPU state */ |
@@ -3740,152 +3740,152 @@ static int il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *en | |||
3740 | /* these spin locks will be used in apm_ops.init and EEPROM access | 3740 | /* these spin locks will be used in apm_ops.init and EEPROM access |
3741 | * we should init now | 3741 | * we should init now |
3742 | */ | 3742 | */ |
3743 | spin_lock_init(&priv->reg_lock); | 3743 | spin_lock_init(&il->reg_lock); |
3744 | spin_lock_init(&priv->lock); | 3744 | spin_lock_init(&il->lock); |
3745 | 3745 | ||
3746 | /* | 3746 | /* |
3747 | * stop and reset the on-board processor just in case it is in a | 3747 | * stop and reset the on-board processor just in case it is in a |
3748 | * strange state ... like being left stranded by a primary kernel | 3748 | * strange state ... like being left stranded by a primary kernel |
3749 | * and this is now the kdump kernel trying to start up | 3749 | * and this is now the kdump kernel trying to start up |
3750 | */ | 3750 | */ |
3751 | il_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); | 3751 | il_write32(il, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); |
3752 | 3752 | ||
3753 | /*********************** | 3753 | /*********************** |
3754 | * 4. Read EEPROM | 3754 | * 4. Read EEPROM |
3755 | * ********************/ | 3755 | * ********************/ |
3756 | 3756 | ||
3757 | /* Read the EEPROM */ | 3757 | /* Read the EEPROM */ |
3758 | err = il_eeprom_init(priv); | 3758 | err = il_eeprom_init(il); |
3759 | if (err) { | 3759 | if (err) { |
3760 | IL_ERR(priv, "Unable to init EEPROM\n"); | 3760 | IL_ERR(il, "Unable to init EEPROM\n"); |
3761 | goto out_iounmap; | 3761 | goto out_iounmap; |
3762 | } | 3762 | } |
3763 | /* MAC Address location in EEPROM same for 3945/4965 */ | 3763 | /* MAC Address location in EEPROM same for 3945/4965 */ |
3764 | eeprom = (struct il3945_eeprom *)priv->eeprom; | 3764 | eeprom = (struct il3945_eeprom *)il->eeprom; |
3765 | IL_DEBUG_INFO(priv, "MAC address: %pM\n", eeprom->mac_address); | 3765 | IL_DEBUG_INFO(il, "MAC address: %pM\n", eeprom->mac_address); |
3766 | SET_IEEE80211_PERM_ADDR(priv->hw, eeprom->mac_address); | 3766 | SET_IEEE80211_PERM_ADDR(il->hw, eeprom->mac_address); |
3767 | 3767 | ||
3768 | /*********************** | 3768 | /*********************** |
3769 | * 5. Setup HW Constants | 3769 | * 5. Setup HW Constants |
3770 | * ********************/ | 3770 | * ********************/ |
3771 | /* Device-specific setup */ | 3771 | /* Device-specific setup */ |
3772 | if (il3945_hw_set_hw_params(priv)) { | 3772 | if (il3945_hw_set_hw_params(il)) { |
3773 | IL_ERR(priv, "failed to set hw settings\n"); | 3773 | IL_ERR(il, "failed to set hw settings\n"); |
3774 | goto out_eeprom_free; | 3774 | goto out_eeprom_free; |
3775 | } | 3775 | } |
3776 | 3776 | ||
3777 | /*********************** | 3777 | /*********************** |
3778 | * 6. Setup priv | 3778 | * 6. Setup il |
3779 | * ********************/ | 3779 | * ********************/ |
3780 | 3780 | ||
3781 | err = il3945_init_drv(priv); | 3781 | err = il3945_init_drv(il); |
3782 | if (err) { | 3782 | if (err) { |
3783 | IL_ERR(priv, "initializing driver failed\n"); | 3783 | IL_ERR(il, "initializing driver failed\n"); |
3784 | goto out_unset_hw_params; | 3784 | goto out_unset_hw_params; |
3785 | } | 3785 | } |
3786 | 3786 | ||
3787 | IL_INFO(priv, "Detected Intel Wireless WiFi Link %s\n", | 3787 | IL_INFO(il, "Detected Intel Wireless WiFi Link %s\n", |
3788 | priv->cfg->name); | 3788 | il->cfg->name); |
3789 | 3789 | ||
3790 | /*********************** | 3790 | /*********************** |
3791 | * 7. Setup Services | 3791 | * 7. Setup Services |
3792 | * ********************/ | 3792 | * ********************/ |
3793 | 3793 | ||
3794 | spin_lock_irqsave(&priv->lock, flags); | 3794 | spin_lock_irqsave(&il->lock, flags); |
3795 | il_disable_interrupts(priv); | 3795 | il_disable_interrupts(il); |
3796 | spin_unlock_irqrestore(&priv->lock, flags); | 3796 | spin_unlock_irqrestore(&il->lock, flags); |
3797 | 3797 | ||
3798 | pci_enable_msi(priv->pci_dev); | 3798 | pci_enable_msi(il->pci_dev); |
3799 | 3799 | ||
3800 | err = request_irq(priv->pci_dev->irq, il_isr, | 3800 | err = request_irq(il->pci_dev->irq, il_isr, |
3801 | IRQF_SHARED, DRV_NAME, priv); | 3801 | IRQF_SHARED, DRV_NAME, il); |
3802 | if (err) { | 3802 | if (err) { |
3803 | IL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq); | 3803 | IL_ERR(il, "Error allocating IRQ %d\n", il->pci_dev->irq); |
3804 | goto out_disable_msi; | 3804 | goto out_disable_msi; |
3805 | } | 3805 | } |
3806 | 3806 | ||
3807 | err = sysfs_create_group(&pdev->dev.kobj, &il3945_attribute_group); | 3807 | err = sysfs_create_group(&pdev->dev.kobj, &il3945_attribute_group); |
3808 | if (err) { | 3808 | if (err) { |
3809 | IL_ERR(priv, "failed to create sysfs device attributes\n"); | 3809 | IL_ERR(il, "failed to create sysfs device attributes\n"); |
3810 | goto out_release_irq; | 3810 | goto out_release_irq; |
3811 | } | 3811 | } |
3812 | 3812 | ||
3813 | il_set_rxon_channel(priv, | 3813 | il_set_rxon_channel(il, |
3814 | &priv->bands[IEEE80211_BAND_2GHZ].channels[5], | 3814 | &il->bands[IEEE80211_BAND_2GHZ].channels[5], |
3815 | &priv->contexts[IL_RXON_CTX_BSS]); | 3815 | &il->contexts[IL_RXON_CTX_BSS]); |
3816 | il3945_setup_deferred_work(priv); | 3816 | il3945_setup_deferred_work(il); |
3817 | il3945_setup_rx_handlers(priv); | 3817 | il3945_setup_rx_handlers(il); |
3818 | il_power_initialize(priv); | 3818 | il_power_initialize(il); |
3819 | 3819 | ||
3820 | /********************************* | 3820 | /********************************* |
3821 | * 8. Setup and Register mac80211 | 3821 | * 8. Setup and Register mac80211 |
3822 | * *******************************/ | 3822 | * *******************************/ |
3823 | 3823 | ||
3824 | il_enable_interrupts(priv); | 3824 | il_enable_interrupts(il); |
3825 | 3825 | ||
3826 | err = il3945_setup_mac(priv); | 3826 | err = il3945_setup_mac(il); |
3827 | if (err) | 3827 | if (err) |
3828 | goto out_remove_sysfs; | 3828 | goto out_remove_sysfs; |
3829 | 3829 | ||
3830 | err = il_dbgfs_register(priv, DRV_NAME); | 3830 | err = il_dbgfs_register(il, DRV_NAME); |
3831 | if (err) | 3831 | if (err) |
3832 | IL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); | 3832 | IL_ERR(il, "failed to create debugfs files. Ignoring error: %d\n", err); |
3833 | 3833 | ||
3834 | /* Start monitoring the killswitch */ | 3834 | /* Start monitoring the killswitch */ |
3835 | queue_delayed_work(priv->workqueue, &priv->_3945.rfkill_poll, | 3835 | queue_delayed_work(il->workqueue, &il->_3945.rfkill_poll, |
3836 | 2 * HZ); | 3836 | 2 * HZ); |
3837 | 3837 | ||
3838 | return 0; | 3838 | return 0; |
3839 | 3839 | ||
3840 | out_remove_sysfs: | 3840 | out_remove_sysfs: |
3841 | destroy_workqueue(priv->workqueue); | 3841 | destroy_workqueue(il->workqueue); |
3842 | priv->workqueue = NULL; | 3842 | il->workqueue = NULL; |
3843 | sysfs_remove_group(&pdev->dev.kobj, &il3945_attribute_group); | 3843 | sysfs_remove_group(&pdev->dev.kobj, &il3945_attribute_group); |
3844 | out_release_irq: | 3844 | out_release_irq: |
3845 | free_irq(priv->pci_dev->irq, priv); | 3845 | free_irq(il->pci_dev->irq, il); |
3846 | out_disable_msi: | 3846 | out_disable_msi: |
3847 | pci_disable_msi(priv->pci_dev); | 3847 | pci_disable_msi(il->pci_dev); |
3848 | il_free_geos(priv); | 3848 | il_free_geos(il); |
3849 | il_free_channel_map(priv); | 3849 | il_free_channel_map(il); |
3850 | out_unset_hw_params: | 3850 | out_unset_hw_params: |
3851 | il3945_unset_hw_params(priv); | 3851 | il3945_unset_hw_params(il); |
3852 | out_eeprom_free: | 3852 | out_eeprom_free: |
3853 | il_eeprom_free(priv); | 3853 | il_eeprom_free(il); |
3854 | out_iounmap: | 3854 | out_iounmap: |
3855 | pci_iounmap(pdev, priv->hw_base); | 3855 | pci_iounmap(pdev, il->hw_base); |
3856 | out_pci_release_regions: | 3856 | out_pci_release_regions: |
3857 | pci_release_regions(pdev); | 3857 | pci_release_regions(pdev); |
3858 | out_pci_disable_device: | 3858 | out_pci_disable_device: |
3859 | pci_set_drvdata(pdev, NULL); | 3859 | pci_set_drvdata(pdev, NULL); |
3860 | pci_disable_device(pdev); | 3860 | pci_disable_device(pdev); |
3861 | out_ieee80211_free_hw: | 3861 | out_ieee80211_free_hw: |
3862 | il_free_traffic_mem(priv); | 3862 | il_free_traffic_mem(il); |
3863 | ieee80211_free_hw(priv->hw); | 3863 | ieee80211_free_hw(il->hw); |
3864 | out: | 3864 | out: |
3865 | return err; | 3865 | return err; |
3866 | } | 3866 | } |
3867 | 3867 | ||
3868 | static void __devexit il3945_pci_remove(struct pci_dev *pdev) | 3868 | static void __devexit il3945_pci_remove(struct pci_dev *pdev) |
3869 | { | 3869 | { |
3870 | struct il_priv *priv = pci_get_drvdata(pdev); | 3870 | struct il_priv *il = pci_get_drvdata(pdev); |
3871 | unsigned long flags; | 3871 | unsigned long flags; |
3872 | 3872 | ||
3873 | if (!priv) | 3873 | if (!il) |
3874 | return; | 3874 | return; |
3875 | 3875 | ||
3876 | IL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); | 3876 | IL_DEBUG_INFO(il, "*** UNLOAD DRIVER ***\n"); |
3877 | 3877 | ||
3878 | il_dbgfs_unregister(priv); | 3878 | il_dbgfs_unregister(il); |
3879 | 3879 | ||
3880 | set_bit(STATUS_EXIT_PENDING, &priv->status); | 3880 | set_bit(STATUS_EXIT_PENDING, &il->status); |
3881 | 3881 | ||
3882 | il_leds_exit(priv); | 3882 | il_leds_exit(il); |
3883 | 3883 | ||
3884 | if (priv->mac80211_registered) { | 3884 | if (il->mac80211_registered) { |
3885 | ieee80211_unregister_hw(priv->hw); | 3885 | ieee80211_unregister_hw(il->hw); |
3886 | priv->mac80211_registered = 0; | 3886 | il->mac80211_registered = 0; |
3887 | } else { | 3887 | } else { |
3888 | il3945_down(priv); | 3888 | il3945_down(il); |
3889 | } | 3889 | } |
3890 | 3890 | ||
3891 | /* | 3891 | /* |
@@ -3895,54 +3895,54 @@ static void __devexit il3945_pci_remove(struct pci_dev *pdev) | |||
3895 | * paths to avoid running il_down() at all before leaving driver. | 3895 | * paths to avoid running il_down() at all before leaving driver. |
3896 | * This (inexpensive) call *makes sure* device is reset. | 3896 | * This (inexpensive) call *makes sure* device is reset. |
3897 | */ | 3897 | */ |
3898 | il_apm_stop(priv); | 3898 | il_apm_stop(il); |
3899 | 3899 | ||
3900 | /* make sure we flush any pending irq or | 3900 | /* make sure we flush any pending irq or |
3901 | * tasklet for the driver | 3901 | * tasklet for the driver |
3902 | */ | 3902 | */ |
3903 | spin_lock_irqsave(&priv->lock, flags); | 3903 | spin_lock_irqsave(&il->lock, flags); |
3904 | il_disable_interrupts(priv); | 3904 | il_disable_interrupts(il); |
3905 | spin_unlock_irqrestore(&priv->lock, flags); | 3905 | spin_unlock_irqrestore(&il->lock, flags); |
3906 | 3906 | ||
3907 | il3945_synchronize_irq(priv); | 3907 | il3945_synchronize_irq(il); |
3908 | 3908 | ||
3909 | sysfs_remove_group(&pdev->dev.kobj, &il3945_attribute_group); | 3909 | sysfs_remove_group(&pdev->dev.kobj, &il3945_attribute_group); |
3910 | 3910 | ||
3911 | cancel_delayed_work_sync(&priv->_3945.rfkill_poll); | 3911 | cancel_delayed_work_sync(&il->_3945.rfkill_poll); |
3912 | 3912 | ||
3913 | il3945_dealloc_ucode_pci(priv); | 3913 | il3945_dealloc_ucode_pci(il); |
3914 | 3914 | ||
3915 | if (priv->rxq.bd) | 3915 | if (il->rxq.bd) |
3916 | il3945_rx_queue_free(priv, &priv->rxq); | 3916 | il3945_rx_queue_free(il, &il->rxq); |
3917 | il3945_hw_txq_ctx_free(priv); | 3917 | il3945_hw_txq_ctx_free(il); |
3918 | 3918 | ||
3919 | il3945_unset_hw_params(priv); | 3919 | il3945_unset_hw_params(il); |
3920 | 3920 | ||
3921 | /*netif_stop_queue(dev); */ | 3921 | /*netif_stop_queue(dev); */ |
3922 | flush_workqueue(priv->workqueue); | 3922 | flush_workqueue(il->workqueue); |
3923 | 3923 | ||
3924 | /* ieee80211_unregister_hw calls il3945_mac_stop, which flushes | 3924 | /* ieee80211_unregister_hw calls il3945_mac_stop, which flushes |
3925 | * priv->workqueue... so we can't take down the workqueue | 3925 | * il->workqueue... so we can't take down the workqueue |
3926 | * until now... */ | 3926 | * until now... */ |
3927 | destroy_workqueue(priv->workqueue); | 3927 | destroy_workqueue(il->workqueue); |
3928 | priv->workqueue = NULL; | 3928 | il->workqueue = NULL; |
3929 | il_free_traffic_mem(priv); | 3929 | il_free_traffic_mem(il); |
3930 | 3930 | ||
3931 | free_irq(pdev->irq, priv); | 3931 | free_irq(pdev->irq, il); |
3932 | pci_disable_msi(pdev); | 3932 | pci_disable_msi(pdev); |
3933 | 3933 | ||
3934 | pci_iounmap(pdev, priv->hw_base); | 3934 | pci_iounmap(pdev, il->hw_base); |
3935 | pci_release_regions(pdev); | 3935 | pci_release_regions(pdev); |
3936 | pci_disable_device(pdev); | 3936 | pci_disable_device(pdev); |
3937 | pci_set_drvdata(pdev, NULL); | 3937 | pci_set_drvdata(pdev, NULL); |
3938 | 3938 | ||
3939 | il_free_channel_map(priv); | 3939 | il_free_channel_map(il); |
3940 | il_free_geos(priv); | 3940 | il_free_geos(il); |
3941 | kfree(priv->scan_cmd); | 3941 | kfree(il->scan_cmd); |
3942 | if (priv->beacon_skb) | 3942 | if (il->beacon_skb) |
3943 | dev_kfree_skb(priv->beacon_skb); | 3943 | dev_kfree_skb(il->beacon_skb); |
3944 | 3944 | ||
3945 | ieee80211_free_hw(priv->hw); | 3945 | ieee80211_free_hw(il->hw); |
3946 | } | 3946 | } |
3947 | 3947 | ||
3948 | 3948 | ||
diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c index bd37c9226e6..ae8a9375156 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); | |||
87 | MODULE_LICENSE("GPL"); | 87 | MODULE_LICENSE("GPL"); |
88 | MODULE_ALIAS("iwl4965"); | 88 | MODULE_ALIAS("iwl4965"); |
89 | 89 | ||
90 | void il4965_update_chain_flags(struct il_priv *priv) | 90 | void il4965_update_chain_flags(struct il_priv *il) |
91 | { | 91 | { |
92 | struct il_rxon_context *ctx; | 92 | struct il_rxon_context *ctx; |
93 | 93 | ||
94 | if (priv->cfg->ops->hcmd->set_rxon_chain) { | 94 | if (il->cfg->ops->hcmd->set_rxon_chain) { |
95 | for_each_context(priv, ctx) { | 95 | for_each_context(il, ctx) { |
96 | priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); | 96 | il->cfg->ops->hcmd->set_rxon_chain(il, ctx); |
97 | if (ctx->active.rx_chain != ctx->staging.rx_chain) | 97 | if (ctx->active.rx_chain != ctx->staging.rx_chain) |
98 | il_commit_rxon(priv, ctx); | 98 | il_commit_rxon(il, ctx); |
99 | } | 99 | } |
100 | } | 100 | } |
101 | } | 101 | } |
102 | 102 | ||
103 | static void il4965_clear_free_frames(struct il_priv *priv) | 103 | static void il4965_clear_free_frames(struct il_priv *il) |
104 | { | 104 | { |
105 | struct list_head *element; | 105 | struct list_head *element; |
106 | 106 | ||
107 | IL_DEBUG_INFO(priv, "%d frames on pre-allocated heap on clear.\n", | 107 | IL_DEBUG_INFO(il, "%d frames on pre-allocated heap on clear.\n", |
108 | priv->frames_count); | 108 | il->frames_count); |
109 | 109 | ||
110 | while (!list_empty(&priv->free_frames)) { | 110 | while (!list_empty(&il->free_frames)) { |
111 | element = priv->free_frames.next; | 111 | element = il->free_frames.next; |
112 | list_del(element); | 112 | list_del(element); |
113 | kfree(list_entry(element, struct il_frame, list)); | 113 | kfree(list_entry(element, struct il_frame, list)); |
114 | priv->frames_count--; | 114 | il->frames_count--; |
115 | } | 115 | } |
116 | 116 | ||
117 | if (priv->frames_count) { | 117 | if (il->frames_count) { |
118 | IL_WARN(priv, "%d frames still in use. Did we lose one?\n", | 118 | IL_WARN(il, "%d frames still in use. Did we lose one?\n", |
119 | priv->frames_count); | 119 | il->frames_count); |
120 | priv->frames_count = 0; | 120 | il->frames_count = 0; |
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | static struct il_frame *il4965_get_free_frame(struct il_priv *priv) | 124 | static struct il_frame *il4965_get_free_frame(struct il_priv *il) |
125 | { | 125 | { |
126 | struct il_frame *frame; | 126 | struct il_frame *frame; |
127 | struct list_head *element; | 127 | struct list_head *element; |
128 | if (list_empty(&priv->free_frames)) { | 128 | if (list_empty(&il->free_frames)) { |
129 | frame = kzalloc(sizeof(*frame), GFP_KERNEL); | 129 | frame = kzalloc(sizeof(*frame), GFP_KERNEL); |
130 | if (!frame) { | 130 | if (!frame) { |
131 | IL_ERR(priv, "Could not allocate frame!\n"); | 131 | IL_ERR(il, "Could not allocate frame!\n"); |
132 | return NULL; | 132 | return NULL; |
133 | } | 133 | } |
134 | 134 | ||
135 | priv->frames_count++; | 135 | il->frames_count++; |
136 | return frame; | 136 | return frame; |
137 | } | 137 | } |
138 | 138 | ||
139 | element = priv->free_frames.next; | 139 | element = il->free_frames.next; |
140 | list_del(element); | 140 | list_del(element); |
141 | return list_entry(element, struct il_frame, list); | 141 | return list_entry(element, struct il_frame, list); |
142 | } | 142 | } |
143 | 143 | ||
144 | static void il4965_free_frame(struct il_priv *priv, struct il_frame *frame) | 144 | static void il4965_free_frame(struct il_priv *il, struct il_frame *frame) |
145 | { | 145 | { |
146 | memset(frame, 0, sizeof(*frame)); | 146 | memset(frame, 0, sizeof(*frame)); |
147 | list_add(&frame->list, &priv->free_frames); | 147 | list_add(&frame->list, &il->free_frames); |
148 | } | 148 | } |
149 | 149 | ||
150 | static u32 il4965_fill_beacon_frame(struct il_priv *priv, | 150 | static u32 il4965_fill_beacon_frame(struct il_priv *il, |
151 | struct ieee80211_hdr *hdr, | 151 | struct ieee80211_hdr *hdr, |
152 | int left) | 152 | int left) |
153 | { | 153 | { |
154 | lockdep_assert_held(&priv->mutex); | 154 | lockdep_assert_held(&il->mutex); |
155 | 155 | ||
156 | if (!priv->beacon_skb) | 156 | if (!il->beacon_skb) |
157 | return 0; | 157 | return 0; |
158 | 158 | ||
159 | if (priv->beacon_skb->len > left) | 159 | if (il->beacon_skb->len > left) |
160 | return 0; | 160 | return 0; |
161 | 161 | ||
162 | memcpy(hdr, priv->beacon_skb->data, priv->beacon_skb->len); | 162 | memcpy(hdr, il->beacon_skb->data, il->beacon_skb->len); |
163 | 163 | ||
164 | return priv->beacon_skb->len; | 164 | return il->beacon_skb->len; |
165 | } | 165 | } |
166 | 166 | ||
167 | /* Parse the beacon frame to find the TIM element and set tim_idx & tim_size */ | 167 | /* Parse the beacon frame to find the TIM element and set tim_idx & tim_size */ |
168 | static void il4965_set_beacon_tim(struct il_priv *priv, | 168 | static void il4965_set_beacon_tim(struct il_priv *il, |
169 | struct il_tx_beacon_cmd *tx_beacon_cmd, | 169 | struct il_tx_beacon_cmd *tx_beacon_cmd, |
170 | u8 *beacon, u32 frame_size) | 170 | u8 *beacon, u32 frame_size) |
171 | { | 171 | { |
@@ -188,10 +188,10 @@ static void il4965_set_beacon_tim(struct il_priv *priv, | |||
188 | tx_beacon_cmd->tim_idx = cpu_to_le16(tim_idx); | 188 | tx_beacon_cmd->tim_idx = cpu_to_le16(tim_idx); |
189 | tx_beacon_cmd->tim_size = beacon[tim_idx+1]; | 189 | tx_beacon_cmd->tim_size = beacon[tim_idx+1]; |
190 | } else | 190 | } else |
191 | IL_WARN(priv, "Unable to find TIM Element in beacon\n"); | 191 | IL_WARN(il, "Unable to find TIM Element in beacon\n"); |
192 | } | 192 | } |
193 | 193 | ||
194 | static unsigned int il4965_hw_get_beacon_cmd(struct il_priv *priv, | 194 | static unsigned int il4965_hw_get_beacon_cmd(struct il_priv *il, |
195 | struct il_frame *frame) | 195 | struct il_frame *frame) |
196 | { | 196 | { |
197 | struct il_tx_beacon_cmd *tx_beacon_cmd; | 197 | struct il_tx_beacon_cmd *tx_beacon_cmd; |
@@ -203,10 +203,10 @@ static unsigned int il4965_hw_get_beacon_cmd(struct il_priv *priv, | |||
203 | * beacon contents. | 203 | * beacon contents. |
204 | */ | 204 | */ |
205 | 205 | ||
206 | lockdep_assert_held(&priv->mutex); | 206 | lockdep_assert_held(&il->mutex); |
207 | 207 | ||
208 | if (!priv->beacon_ctx) { | 208 | if (!il->beacon_ctx) { |
209 | IL_ERR(priv, "trying to build beacon w/o beacon context!\n"); | 209 | IL_ERR(il, "trying to build beacon w/o beacon context!\n"); |
210 | return 0; | 210 | return 0; |
211 | } | 211 | } |
212 | 212 | ||
@@ -215,7 +215,7 @@ static unsigned int il4965_hw_get_beacon_cmd(struct il_priv *priv, | |||
215 | memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); | 215 | memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); |
216 | 216 | ||
217 | /* Set up TX beacon contents */ | 217 | /* Set up TX beacon contents */ |
218 | frame_size = il4965_fill_beacon_frame(priv, tx_beacon_cmd->frame, | 218 | frame_size = il4965_fill_beacon_frame(il, tx_beacon_cmd->frame, |
219 | sizeof(frame->u) - sizeof(*tx_beacon_cmd)); | 219 | sizeof(frame->u) - sizeof(*tx_beacon_cmd)); |
220 | if (WARN_ON_ONCE(frame_size > MAX_MPDU_SIZE)) | 220 | if (WARN_ON_ONCE(frame_size > MAX_MPDU_SIZE)) |
221 | return 0; | 221 | return 0; |
@@ -224,20 +224,20 @@ static unsigned int il4965_hw_get_beacon_cmd(struct il_priv *priv, | |||
224 | 224 | ||
225 | /* Set up TX command fields */ | 225 | /* Set up TX command fields */ |
226 | tx_beacon_cmd->tx.len = cpu_to_le16((u16)frame_size); | 226 | tx_beacon_cmd->tx.len = cpu_to_le16((u16)frame_size); |
227 | tx_beacon_cmd->tx.sta_id = priv->beacon_ctx->bcast_sta_id; | 227 | tx_beacon_cmd->tx.sta_id = il->beacon_ctx->bcast_sta_id; |
228 | tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; | 228 | tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; |
229 | tx_beacon_cmd->tx.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK | | 229 | tx_beacon_cmd->tx.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK | |
230 | TX_CMD_FLG_TSF_MSK | TX_CMD_FLG_STA_RATE_MSK; | 230 | TX_CMD_FLG_TSF_MSK | TX_CMD_FLG_STA_RATE_MSK; |
231 | 231 | ||
232 | /* Set up TX beacon command fields */ | 232 | /* Set up TX beacon command fields */ |
233 | il4965_set_beacon_tim(priv, tx_beacon_cmd, (u8 *)tx_beacon_cmd->frame, | 233 | il4965_set_beacon_tim(il, tx_beacon_cmd, (u8 *)tx_beacon_cmd->frame, |
234 | frame_size); | 234 | frame_size); |
235 | 235 | ||
236 | /* Set up packet rate and flags */ | 236 | /* Set up packet rate and flags */ |
237 | rate = il_get_lowest_plcp(priv, priv->beacon_ctx); | 237 | rate = il_get_lowest_plcp(il, il->beacon_ctx); |
238 | priv->mgmt_tx_ant = il4965_toggle_tx_ant(priv, priv->mgmt_tx_ant, | 238 | il->mgmt_tx_ant = il4965_toggle_tx_ant(il, il->mgmt_tx_ant, |
239 | priv->hw_params.valid_tx_ant); | 239 | il->hw_params.valid_tx_ant); |
240 | rate_flags = il4965_ant_idx_to_flags(priv->mgmt_tx_ant); | 240 | rate_flags = il4965_ant_idx_to_flags(il->mgmt_tx_ant); |
241 | if ((rate >= IL_FIRST_CCK_RATE) && (rate <= IL_LAST_CCK_RATE)) | 241 | if ((rate >= IL_FIRST_CCK_RATE) && (rate <= IL_LAST_CCK_RATE)) |
242 | rate_flags |= RATE_MCS_CCK_MSK; | 242 | rate_flags |= RATE_MCS_CCK_MSK; |
243 | tx_beacon_cmd->tx.rate_n_flags = il4965_hw_set_rate_n_flags(rate, | 243 | 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, | |||
246 | return sizeof(*tx_beacon_cmd) + frame_size; | 246 | return sizeof(*tx_beacon_cmd) + frame_size; |
247 | } | 247 | } |
248 | 248 | ||
249 | int il4965_send_beacon_cmd(struct il_priv *priv) | 249 | int il4965_send_beacon_cmd(struct il_priv *il) |
250 | { | 250 | { |
251 | struct il_frame *frame; | 251 | struct il_frame *frame; |
252 | unsigned int frame_size; | 252 | unsigned int frame_size; |
253 | int rc; | 253 | int rc; |
254 | 254 | ||
255 | frame = il4965_get_free_frame(priv); | 255 | frame = il4965_get_free_frame(il); |
256 | if (!frame) { | 256 | if (!frame) { |
257 | IL_ERR(priv, "Could not obtain free frame buffer for beacon " | 257 | IL_ERR(il, "Could not obtain free frame buffer for beacon " |
258 | "command.\n"); | 258 | "command.\n"); |
259 | return -ENOMEM; | 259 | return -ENOMEM; |
260 | } | 260 | } |
261 | 261 | ||
262 | frame_size = il4965_hw_get_beacon_cmd(priv, frame); | 262 | frame_size = il4965_hw_get_beacon_cmd(il, frame); |
263 | if (!frame_size) { | 263 | if (!frame_size) { |
264 | IL_ERR(priv, "Error configuring the beacon command\n"); | 264 | IL_ERR(il, "Error configuring the beacon command\n"); |
265 | il4965_free_frame(priv, frame); | 265 | il4965_free_frame(il, frame); |
266 | return -EINVAL; | 266 | return -EINVAL; |
267 | } | 267 | } |
268 | 268 | ||
269 | rc = il_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size, | 269 | rc = il_send_cmd_pdu(il, REPLY_TX_BEACON, frame_size, |
270 | &frame->u.cmd[0]); | 270 | &frame->u.cmd[0]); |
271 | 271 | ||
272 | il4965_free_frame(priv, frame); | 272 | il4965_free_frame(il, frame); |
273 | 273 | ||
274 | return rc; | 274 | return rc; |
275 | } | 275 | } |
@@ -315,17 +315,17 @@ static inline u8 il4965_tfd_get_num_tbs(struct il_tfd *tfd) | |||
315 | 315 | ||
316 | /** | 316 | /** |
317 | * il4965_hw_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr] | 317 | * il4965_hw_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr] |
318 | * @priv - driver private data | 318 | * @il - driver ilate data |
319 | * @txq - tx queue | 319 | * @txq - tx queue |
320 | * | 320 | * |
321 | * Does NOT advance any TFD circular buffer read/write indexes | 321 | * Does NOT advance any TFD circular buffer read/write indexes |
322 | * Does NOT free the TFD itself (which is within circular buffer) | 322 | * Does NOT free the TFD itself (which is within circular buffer) |
323 | */ | 323 | */ |
324 | void il4965_hw_txq_free_tfd(struct il_priv *priv, struct il_tx_queue *txq) | 324 | void il4965_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq) |
325 | { | 325 | { |
326 | struct il_tfd *tfd_tmp = (struct il_tfd *)txq->tfds; | 326 | struct il_tfd *tfd_tmp = (struct il_tfd *)txq->tfds; |
327 | struct il_tfd *tfd; | 327 | struct il_tfd *tfd; |
328 | struct pci_dev *dev = priv->pci_dev; | 328 | struct pci_dev *dev = il->pci_dev; |
329 | int index = txq->q.read_ptr; | 329 | int index = txq->q.read_ptr; |
330 | int i; | 330 | int i; |
331 | int num_tbs; | 331 | int num_tbs; |
@@ -336,7 +336,7 @@ void il4965_hw_txq_free_tfd(struct il_priv *priv, struct il_tx_queue *txq) | |||
336 | num_tbs = il4965_tfd_get_num_tbs(tfd); | 336 | num_tbs = il4965_tfd_get_num_tbs(tfd); |
337 | 337 | ||
338 | if (num_tbs >= IL_NUM_OF_TBS) { | 338 | if (num_tbs >= IL_NUM_OF_TBS) { |
339 | IL_ERR(priv, "Too many chunks: %i\n", num_tbs); | 339 | IL_ERR(il, "Too many chunks: %i\n", num_tbs); |
340 | /* @todo issue fatal error, it is quite serious situation */ | 340 | /* @todo issue fatal error, it is quite serious situation */ |
341 | return; | 341 | return; |
342 | } | 342 | } |
@@ -368,7 +368,7 @@ void il4965_hw_txq_free_tfd(struct il_priv *priv, struct il_tx_queue *txq) | |||
368 | } | 368 | } |
369 | } | 369 | } |
370 | 370 | ||
371 | int il4965_hw_txq_attach_buf_to_tfd(struct il_priv *priv, | 371 | int il4965_hw_txq_attach_buf_to_tfd(struct il_priv *il, |
372 | struct il_tx_queue *txq, | 372 | struct il_tx_queue *txq, |
373 | dma_addr_t addr, u16 len, | 373 | dma_addr_t addr, u16 len, |
374 | u8 reset, u8 pad) | 374 | u8 reset, u8 pad) |
@@ -388,14 +388,14 @@ int il4965_hw_txq_attach_buf_to_tfd(struct il_priv *priv, | |||
388 | 388 | ||
389 | /* Each TFD can point to a maximum 20 Tx buffers */ | 389 | /* Each TFD can point to a maximum 20 Tx buffers */ |
390 | if (num_tbs >= IL_NUM_OF_TBS) { | 390 | if (num_tbs >= IL_NUM_OF_TBS) { |
391 | IL_ERR(priv, "Error can not send more than %d chunks\n", | 391 | IL_ERR(il, "Error can not send more than %d chunks\n", |
392 | IL_NUM_OF_TBS); | 392 | IL_NUM_OF_TBS); |
393 | return -EINVAL; | 393 | return -EINVAL; |
394 | } | 394 | } |
395 | 395 | ||
396 | BUG_ON(addr & ~DMA_BIT_MASK(36)); | 396 | BUG_ON(addr & ~DMA_BIT_MASK(36)); |
397 | if (unlikely(addr & ~IL_TX_DMA_MASK)) | 397 | if (unlikely(addr & ~IL_TX_DMA_MASK)) |
398 | IL_ERR(priv, "Unaligned address = %llx\n", | 398 | IL_ERR(il, "Unaligned address = %llx\n", |
399 | (unsigned long long)addr); | 399 | (unsigned long long)addr); |
400 | 400 | ||
401 | il4965_tfd_set_tb(tfd, num_tbs, addr, len); | 401 | 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, | |||
410 | * 4965 supports up to 16 Tx queues in DRAM, mapped to up to 8 Tx DMA | 410 | * 4965 supports up to 16 Tx queues in DRAM, mapped to up to 8 Tx DMA |
411 | * channels supported in hardware. | 411 | * channels supported in hardware. |
412 | */ | 412 | */ |
413 | int il4965_hw_tx_queue_init(struct il_priv *priv, | 413 | int il4965_hw_tx_queue_init(struct il_priv *il, |
414 | struct il_tx_queue *txq) | 414 | struct il_tx_queue *txq) |
415 | { | 415 | { |
416 | int txq_id = txq->q.id; | 416 | int txq_id = txq->q.id; |
417 | 417 | ||
418 | /* Circular buffer (TFD queue in DRAM) physical base address */ | 418 | /* Circular buffer (TFD queue in DRAM) physical base address */ |
419 | il_write_direct32(priv, FH_MEM_CBBC_QUEUE(txq_id), | 419 | il_write_direct32(il, FH_MEM_CBBC_QUEUE(txq_id), |
420 | txq->q.dma_addr >> 8); | 420 | txq->q.dma_addr >> 8); |
421 | 421 | ||
422 | return 0; | 422 | return 0; |
@@ -427,7 +427,7 @@ int il4965_hw_tx_queue_init(struct il_priv *priv, | |||
427 | * Generic RX handler implementations | 427 | * Generic RX handler implementations |
428 | * | 428 | * |
429 | ******************************************************************************/ | 429 | ******************************************************************************/ |
430 | static void il4965_rx_reply_alive(struct il_priv *priv, | 430 | static void il4965_rx_reply_alive(struct il_priv *il, |
431 | struct il_rx_mem_buffer *rxb) | 431 | struct il_rx_mem_buffer *rxb) |
432 | { | 432 | { |
433 | struct il_rx_packet *pkt = rxb_addr(rxb); | 433 | struct il_rx_packet *pkt = rxb_addr(rxb); |
@@ -436,31 +436,31 @@ static void il4965_rx_reply_alive(struct il_priv *priv, | |||
436 | 436 | ||
437 | palive = &pkt->u.alive_frame; | 437 | palive = &pkt->u.alive_frame; |
438 | 438 | ||
439 | IL_DEBUG_INFO(priv, "Alive ucode status 0x%08X revision " | 439 | IL_DEBUG_INFO(il, "Alive ucode status 0x%08X revision " |
440 | "0x%01X 0x%01X\n", | 440 | "0x%01X 0x%01X\n", |
441 | palive->is_valid, palive->ver_type, | 441 | palive->is_valid, palive->ver_type, |
442 | palive->ver_subtype); | 442 | palive->ver_subtype); |
443 | 443 | ||
444 | if (palive->ver_subtype == INITIALIZE_SUBTYPE) { | 444 | if (palive->ver_subtype == INITIALIZE_SUBTYPE) { |
445 | IL_DEBUG_INFO(priv, "Initialization Alive received.\n"); | 445 | IL_DEBUG_INFO(il, "Initialization Alive received.\n"); |
446 | memcpy(&priv->card_alive_init, | 446 | memcpy(&il->card_alive_init, |
447 | &pkt->u.alive_frame, | 447 | &pkt->u.alive_frame, |
448 | sizeof(struct il_init_alive_resp)); | 448 | sizeof(struct il_init_alive_resp)); |
449 | pwork = &priv->init_alive_start; | 449 | pwork = &il->init_alive_start; |
450 | } else { | 450 | } else { |
451 | IL_DEBUG_INFO(priv, "Runtime Alive received.\n"); | 451 | IL_DEBUG_INFO(il, "Runtime Alive received.\n"); |
452 | memcpy(&priv->card_alive, &pkt->u.alive_frame, | 452 | memcpy(&il->card_alive, &pkt->u.alive_frame, |
453 | sizeof(struct il_alive_resp)); | 453 | sizeof(struct il_alive_resp)); |
454 | pwork = &priv->alive_start; | 454 | pwork = &il->alive_start; |
455 | } | 455 | } |
456 | 456 | ||
457 | /* We delay the ALIVE response by 5ms to | 457 | /* We delay the ALIVE response by 5ms to |
458 | * give the HW RF Kill time to activate... */ | 458 | * give the HW RF Kill time to activate... */ |
459 | if (palive->is_valid == UCODE_VALID_OK) | 459 | if (palive->is_valid == UCODE_VALID_OK) |
460 | queue_delayed_work(priv->workqueue, pwork, | 460 | queue_delayed_work(il->workqueue, pwork, |
461 | msecs_to_jiffies(5)); | 461 | msecs_to_jiffies(5)); |
462 | else | 462 | else |
463 | IL_WARN(priv, "uCode did not respond OK.\n"); | 463 | IL_WARN(il, "uCode did not respond OK.\n"); |
464 | } | 464 | } |
465 | 465 | ||
466 | /** | 466 | /** |
@@ -475,19 +475,19 @@ static void il4965_rx_reply_alive(struct il_priv *priv, | |||
475 | */ | 475 | */ |
476 | static void il4965_bg_statistics_periodic(unsigned long data) | 476 | static void il4965_bg_statistics_periodic(unsigned long data) |
477 | { | 477 | { |
478 | struct il_priv *priv = (struct il_priv *)data; | 478 | struct il_priv *il = (struct il_priv *)data; |
479 | 479 | ||
480 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 480 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) |
481 | return; | 481 | return; |
482 | 482 | ||
483 | /* dont send host command if rf-kill is on */ | 483 | /* dont send host command if rf-kill is on */ |
484 | if (!il_is_ready_rf(priv)) | 484 | if (!il_is_ready_rf(il)) |
485 | return; | 485 | return; |
486 | 486 | ||
487 | il_send_statistics_request(priv, CMD_ASYNC, false); | 487 | il_send_statistics_request(il, CMD_ASYNC, false); |
488 | } | 488 | } |
489 | 489 | ||
490 | static void il4965_rx_beacon_notif(struct il_priv *priv, | 490 | static void il4965_rx_beacon_notif(struct il_priv *il, |
491 | struct il_rx_mem_buffer *rxb) | 491 | struct il_rx_mem_buffer *rxb) |
492 | { | 492 | { |
493 | struct il_rx_packet *pkt = rxb_addr(rxb); | 493 | struct il_rx_packet *pkt = rxb_addr(rxb); |
@@ -496,7 +496,7 @@ static void il4965_rx_beacon_notif(struct il_priv *priv, | |||
496 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 496 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
497 | u8 rate = il4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); | 497 | u8 rate = il4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); |
498 | 498 | ||
499 | IL_DEBUG_RX(priv, "beacon status %x retries %d iss %d " | 499 | IL_DEBUG_RX(il, "beacon status %x retries %d iss %d " |
500 | "tsf %d %d rate %d\n", | 500 | "tsf %d %d rate %d\n", |
501 | le32_to_cpu(beacon->beacon_notify_hdr.u.status) & TX_STATUS_MSK, | 501 | le32_to_cpu(beacon->beacon_notify_hdr.u.status) & TX_STATUS_MSK, |
502 | beacon->beacon_notify_hdr.failure_frame, | 502 | beacon->beacon_notify_hdr.failure_frame, |
@@ -505,38 +505,38 @@ static void il4965_rx_beacon_notif(struct il_priv *priv, | |||
505 | le32_to_cpu(beacon->low_tsf), rate); | 505 | le32_to_cpu(beacon->low_tsf), rate); |
506 | #endif | 506 | #endif |
507 | 507 | ||
508 | priv->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status); | 508 | il->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status); |
509 | } | 509 | } |
510 | 510 | ||
511 | static void il4965_perform_ct_kill_task(struct il_priv *priv) | 511 | static void il4965_perform_ct_kill_task(struct il_priv *il) |
512 | { | 512 | { |
513 | unsigned long flags; | 513 | unsigned long flags; |
514 | 514 | ||
515 | IL_DEBUG_POWER(priv, "Stop all queues\n"); | 515 | IL_DEBUG_POWER(il, "Stop all queues\n"); |
516 | 516 | ||
517 | if (priv->mac80211_registered) | 517 | if (il->mac80211_registered) |
518 | ieee80211_stop_queues(priv->hw); | 518 | ieee80211_stop_queues(il->hw); |
519 | 519 | ||
520 | il_write32(priv, CSR_UCODE_DRV_GP1_SET, | 520 | il_write32(il, CSR_UCODE_DRV_GP1_SET, |
521 | CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); | 521 | CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); |
522 | il_read32(priv, CSR_UCODE_DRV_GP1); | 522 | il_read32(il, CSR_UCODE_DRV_GP1); |
523 | 523 | ||
524 | spin_lock_irqsave(&priv->reg_lock, flags); | 524 | spin_lock_irqsave(&il->reg_lock, flags); |
525 | if (!il_grab_nic_access(priv)) | 525 | if (!il_grab_nic_access(il)) |
526 | il_release_nic_access(priv); | 526 | il_release_nic_access(il); |
527 | spin_unlock_irqrestore(&priv->reg_lock, flags); | 527 | spin_unlock_irqrestore(&il->reg_lock, flags); |
528 | } | 528 | } |
529 | 529 | ||
530 | /* Handle notification from uCode that card's power state is changing | 530 | /* Handle notification from uCode that card's power state is changing |
531 | * due to software, hardware, or critical temperature RFKILL */ | 531 | * due to software, hardware, or critical temperature RFKILL */ |
532 | static void il4965_rx_card_state_notif(struct il_priv *priv, | 532 | static void il4965_rx_card_state_notif(struct il_priv *il, |
533 | struct il_rx_mem_buffer *rxb) | 533 | struct il_rx_mem_buffer *rxb) |
534 | { | 534 | { |
535 | struct il_rx_packet *pkt = rxb_addr(rxb); | 535 | struct il_rx_packet *pkt = rxb_addr(rxb); |
536 | u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags); | 536 | u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags); |
537 | unsigned long status = priv->status; | 537 | unsigned long status = il->status; |
538 | 538 | ||
539 | IL_DEBUG_RF_KILL(priv, "Card state received: HW:%s SW:%s CT:%s\n", | 539 | IL_DEBUG_RF_KILL(il, "Card state received: HW:%s SW:%s CT:%s\n", |
540 | (flags & HW_CARD_DISABLED) ? "Kill" : "On", | 540 | (flags & HW_CARD_DISABLED) ? "Kill" : "On", |
541 | (flags & SW_CARD_DISABLED) ? "Kill" : "On", | 541 | (flags & SW_CARD_DISABLED) ? "Kill" : "On", |
542 | (flags & CT_CARD_DISABLED) ? | 542 | (flags & CT_CARD_DISABLED) ? |
@@ -545,37 +545,37 @@ static void il4965_rx_card_state_notif(struct il_priv *priv, | |||
545 | if (flags & (SW_CARD_DISABLED | HW_CARD_DISABLED | | 545 | if (flags & (SW_CARD_DISABLED | HW_CARD_DISABLED | |
546 | CT_CARD_DISABLED)) { | 546 | CT_CARD_DISABLED)) { |
547 | 547 | ||
548 | il_write32(priv, CSR_UCODE_DRV_GP1_SET, | 548 | il_write32(il, CSR_UCODE_DRV_GP1_SET, |
549 | CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); | 549 | CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); |
550 | 550 | ||
551 | il_write_direct32(priv, HBUS_TARG_MBX_C, | 551 | il_write_direct32(il, HBUS_TARG_MBX_C, |
552 | HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); | 552 | HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); |
553 | 553 | ||
554 | if (!(flags & RXON_CARD_DISABLED)) { | 554 | if (!(flags & RXON_CARD_DISABLED)) { |
555 | il_write32(priv, CSR_UCODE_DRV_GP1_CLR, | 555 | il_write32(il, CSR_UCODE_DRV_GP1_CLR, |
556 | CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); | 556 | CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); |
557 | il_write_direct32(priv, HBUS_TARG_MBX_C, | 557 | il_write_direct32(il, HBUS_TARG_MBX_C, |
558 | HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); | 558 | HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); |
559 | } | 559 | } |
560 | } | 560 | } |
561 | 561 | ||
562 | if (flags & CT_CARD_DISABLED) | 562 | if (flags & CT_CARD_DISABLED) |
563 | il4965_perform_ct_kill_task(priv); | 563 | il4965_perform_ct_kill_task(il); |
564 | 564 | ||
565 | if (flags & HW_CARD_DISABLED) | 565 | if (flags & HW_CARD_DISABLED) |
566 | set_bit(STATUS_RF_KILL_HW, &priv->status); | 566 | set_bit(STATUS_RF_KILL_HW, &il->status); |
567 | else | 567 | else |
568 | clear_bit(STATUS_RF_KILL_HW, &priv->status); | 568 | clear_bit(STATUS_RF_KILL_HW, &il->status); |
569 | 569 | ||
570 | if (!(flags & RXON_CARD_DISABLED)) | 570 | if (!(flags & RXON_CARD_DISABLED)) |
571 | il_scan_cancel(priv); | 571 | il_scan_cancel(il); |
572 | 572 | ||
573 | if ((test_bit(STATUS_RF_KILL_HW, &status) != | 573 | if ((test_bit(STATUS_RF_KILL_HW, &status) != |
574 | test_bit(STATUS_RF_KILL_HW, &priv->status))) | 574 | test_bit(STATUS_RF_KILL_HW, &il->status))) |
575 | wiphy_rfkill_set_hw_state(priv->hw->wiphy, | 575 | wiphy_rfkill_set_hw_state(il->hw->wiphy, |
576 | test_bit(STATUS_RF_KILL_HW, &priv->status)); | 576 | test_bit(STATUS_RF_KILL_HW, &il->status)); |
577 | else | 577 | else |
578 | wake_up(&priv->wait_command_queue); | 578 | wake_up(&il->wait_command_queue); |
579 | } | 579 | } |
580 | 580 | ||
581 | /** | 581 | /** |
@@ -587,55 +587,55 @@ static void il4965_rx_card_state_notif(struct il_priv *priv, | |||
587 | * This function chains into the hardware specific files for them to setup | 587 | * This function chains into the hardware specific files for them to setup |
588 | * any hardware specific handlers as well. | 588 | * any hardware specific handlers as well. |
589 | */ | 589 | */ |
590 | static void il4965_setup_rx_handlers(struct il_priv *priv) | 590 | static void il4965_setup_rx_handlers(struct il_priv *il) |
591 | { | 591 | { |
592 | priv->rx_handlers[REPLY_ALIVE] = il4965_rx_reply_alive; | 592 | il->rx_handlers[REPLY_ALIVE] = il4965_rx_reply_alive; |
593 | priv->rx_handlers[REPLY_ERROR] = il_rx_reply_error; | 593 | il->rx_handlers[REPLY_ERROR] = il_rx_reply_error; |
594 | priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = il_rx_csa; | 594 | il->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = il_rx_csa; |
595 | priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] = | 595 | il->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] = |
596 | il_rx_spectrum_measure_notif; | 596 | il_rx_spectrum_measure_notif; |
597 | priv->rx_handlers[PM_SLEEP_NOTIFICATION] = il_rx_pm_sleep_notif; | 597 | il->rx_handlers[PM_SLEEP_NOTIFICATION] = il_rx_pm_sleep_notif; |
598 | priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] = | 598 | il->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] = |
599 | il_rx_pm_debug_statistics_notif; | 599 | il_rx_pm_debug_statistics_notif; |
600 | priv->rx_handlers[BEACON_NOTIFICATION] = il4965_rx_beacon_notif; | 600 | il->rx_handlers[BEACON_NOTIFICATION] = il4965_rx_beacon_notif; |
601 | 601 | ||
602 | /* | 602 | /* |
603 | * The same handler is used for both the REPLY to a discrete | 603 | * The same handler is used for both the REPLY to a discrete |
604 | * statistics request from the host as well as for the periodic | 604 | * statistics request from the host as well as for the periodic |
605 | * statistics notifications (after received beacons) from the uCode. | 605 | * statistics notifications (after received beacons) from the uCode. |
606 | */ | 606 | */ |
607 | priv->rx_handlers[REPLY_STATISTICS_CMD] = il4965_reply_statistics; | 607 | il->rx_handlers[REPLY_STATISTICS_CMD] = il4965_reply_statistics; |
608 | priv->rx_handlers[STATISTICS_NOTIFICATION] = il4965_rx_statistics; | 608 | il->rx_handlers[STATISTICS_NOTIFICATION] = il4965_rx_statistics; |
609 | 609 | ||
610 | il_setup_rx_scan_handlers(priv); | 610 | il_setup_rx_scan_handlers(il); |
611 | 611 | ||
612 | /* status change handler */ | 612 | /* status change handler */ |
613 | priv->rx_handlers[CARD_STATE_NOTIFICATION] = | 613 | il->rx_handlers[CARD_STATE_NOTIFICATION] = |
614 | il4965_rx_card_state_notif; | 614 | il4965_rx_card_state_notif; |
615 | 615 | ||
616 | priv->rx_handlers[MISSED_BEACONS_NOTIFICATION] = | 616 | il->rx_handlers[MISSED_BEACONS_NOTIFICATION] = |
617 | il4965_rx_missed_beacon_notif; | 617 | il4965_rx_missed_beacon_notif; |
618 | /* Rx handlers */ | 618 | /* Rx handlers */ |
619 | priv->rx_handlers[REPLY_RX_PHY_CMD] = il4965_rx_reply_rx_phy; | 619 | il->rx_handlers[REPLY_RX_PHY_CMD] = il4965_rx_reply_rx_phy; |
620 | priv->rx_handlers[REPLY_RX_MPDU_CMD] = il4965_rx_reply_rx; | 620 | il->rx_handlers[REPLY_RX_MPDU_CMD] = il4965_rx_reply_rx; |
621 | /* block ack */ | 621 | /* block ack */ |
622 | priv->rx_handlers[REPLY_COMPRESSED_BA] = il4965_rx_reply_compressed_ba; | 622 | il->rx_handlers[REPLY_COMPRESSED_BA] = il4965_rx_reply_compressed_ba; |
623 | /* Set up hardware specific Rx handlers */ | 623 | /* Set up hardware specific Rx handlers */ |
624 | priv->cfg->ops->lib->rx_handler_setup(priv); | 624 | il->cfg->ops->lib->rx_handler_setup(il); |
625 | } | 625 | } |
626 | 626 | ||
627 | /** | 627 | /** |
628 | * il4965_rx_handle - Main entry function for receiving responses from uCode | 628 | * il4965_rx_handle - Main entry function for receiving responses from uCode |
629 | * | 629 | * |
630 | * Uses the priv->rx_handlers callback function array to invoke | 630 | * Uses the il->rx_handlers callback function array to invoke |
631 | * the appropriate handlers, including command responses, | 631 | * the appropriate handlers, including command responses, |
632 | * frame-received notifications, and other notifications. | 632 | * frame-received notifications, and other notifications. |
633 | */ | 633 | */ |
634 | void il4965_rx_handle(struct il_priv *priv) | 634 | void il4965_rx_handle(struct il_priv *il) |
635 | { | 635 | { |
636 | struct il_rx_mem_buffer *rxb; | 636 | struct il_rx_mem_buffer *rxb; |
637 | struct il_rx_packet *pkt; | 637 | struct il_rx_packet *pkt; |
638 | struct il_rx_queue *rxq = &priv->rxq; | 638 | struct il_rx_queue *rxq = &il->rxq; |
639 | u32 r, i; | 639 | u32 r, i; |
640 | int reclaim; | 640 | int reclaim; |
641 | unsigned long flags; | 641 | unsigned long flags; |
@@ -650,7 +650,7 @@ void il4965_rx_handle(struct il_priv *priv) | |||
650 | 650 | ||
651 | /* Rx interrupt, but nothing sent from uCode */ | 651 | /* Rx interrupt, but nothing sent from uCode */ |
652 | if (i == r) | 652 | if (i == r) |
653 | IL_DEBUG_RX(priv, "r = %d, i = %d\n", r, i); | 653 | IL_DEBUG_RX(il, "r = %d, i = %d\n", r, i); |
654 | 654 | ||
655 | /* calculate total frames need to be restock after handling RX */ | 655 | /* calculate total frames need to be restock after handling RX */ |
656 | total_empty = r - rxq->write_actual; | 656 | total_empty = r - rxq->write_actual; |
@@ -672,8 +672,8 @@ void il4965_rx_handle(struct il_priv *priv) | |||
672 | 672 | ||
673 | rxq->queue[i] = NULL; | 673 | rxq->queue[i] = NULL; |
674 | 674 | ||
675 | pci_unmap_page(priv->pci_dev, rxb->page_dma, | 675 | pci_unmap_page(il->pci_dev, rxb->page_dma, |
676 | PAGE_SIZE << priv->hw_params.rx_page_order, | 676 | PAGE_SIZE << il->hw_params.rx_page_order, |
677 | PCI_DMA_FROMDEVICE); | 677 | PCI_DMA_FROMDEVICE); |
678 | pkt = rxb_addr(rxb); | 678 | pkt = rxb_addr(rxb); |
679 | 679 | ||
@@ -697,15 +697,15 @@ void il4965_rx_handle(struct il_priv *priv) | |||
697 | /* Based on type of command response or notification, | 697 | /* Based on type of command response or notification, |
698 | * handle those that need handling via function in | 698 | * handle those that need handling via function in |
699 | * rx_handlers table. See il4965_setup_rx_handlers() */ | 699 | * rx_handlers table. See il4965_setup_rx_handlers() */ |
700 | if (priv->rx_handlers[pkt->hdr.cmd]) { | 700 | if (il->rx_handlers[pkt->hdr.cmd]) { |
701 | IL_DEBUG_RX(priv, "r = %d, i = %d, %s, 0x%02x\n", r, | 701 | IL_DEBUG_RX(il, "r = %d, i = %d, %s, 0x%02x\n", r, |
702 | i, il_get_cmd_string(pkt->hdr.cmd), | 702 | i, il_get_cmd_string(pkt->hdr.cmd), |
703 | pkt->hdr.cmd); | 703 | pkt->hdr.cmd); |
704 | priv->isr_stats.rx_handlers[pkt->hdr.cmd]++; | 704 | il->isr_stats.rx_handlers[pkt->hdr.cmd]++; |
705 | priv->rx_handlers[pkt->hdr.cmd] (priv, rxb); | 705 | il->rx_handlers[pkt->hdr.cmd] (il, rxb); |
706 | } else { | 706 | } else { |
707 | /* No handling needed */ | 707 | /* No handling needed */ |
708 | IL_DEBUG_RX(priv, | 708 | IL_DEBUG_RX(il, |
709 | "r %d i %d No handler needed for %s, 0x%02x\n", | 709 | "r %d i %d No handler needed for %s, 0x%02x\n", |
710 | r, i, il_get_cmd_string(pkt->hdr.cmd), | 710 | r, i, il_get_cmd_string(pkt->hdr.cmd), |
711 | pkt->hdr.cmd); | 711 | pkt->hdr.cmd); |
@@ -723,9 +723,9 @@ void il4965_rx_handle(struct il_priv *priv) | |||
723 | * and fire off the (possibly) blocking il_send_cmd() | 723 | * and fire off the (possibly) blocking il_send_cmd() |
724 | * as we reclaim the driver command queue */ | 724 | * as we reclaim the driver command queue */ |
725 | if (rxb->page) | 725 | if (rxb->page) |
726 | il_tx_cmd_complete(priv, rxb); | 726 | il_tx_cmd_complete(il, rxb); |
727 | else | 727 | else |
728 | IL_WARN(priv, "Claim null rxb?\n"); | 728 | IL_WARN(il, "Claim null rxb?\n"); |
729 | } | 729 | } |
730 | 730 | ||
731 | /* Reuse the page if possible. For notification packets and | 731 | /* Reuse the page if possible. For notification packets and |
@@ -733,8 +733,8 @@ void il4965_rx_handle(struct il_priv *priv) | |||
733 | * rx_free list for reuse later. */ | 733 | * rx_free list for reuse later. */ |
734 | spin_lock_irqsave(&rxq->lock, flags); | 734 | spin_lock_irqsave(&rxq->lock, flags); |
735 | if (rxb->page != NULL) { | 735 | if (rxb->page != NULL) { |
736 | rxb->page_dma = pci_map_page(priv->pci_dev, rxb->page, | 736 | rxb->page_dma = pci_map_page(il->pci_dev, rxb->page, |
737 | 0, PAGE_SIZE << priv->hw_params.rx_page_order, | 737 | 0, PAGE_SIZE << il->hw_params.rx_page_order, |
738 | PCI_DMA_FROMDEVICE); | 738 | PCI_DMA_FROMDEVICE); |
739 | list_add_tail(&rxb->list, &rxq->rx_free); | 739 | list_add_tail(&rxb->list, &rxq->rx_free); |
740 | rxq->free_count++; | 740 | rxq->free_count++; |
@@ -750,7 +750,7 @@ void il4965_rx_handle(struct il_priv *priv) | |||
750 | count++; | 750 | count++; |
751 | if (count >= 8) { | 751 | if (count >= 8) { |
752 | rxq->read = i; | 752 | rxq->read = i; |
753 | il4965_rx_replenish_now(priv); | 753 | il4965_rx_replenish_now(il); |
754 | count = 0; | 754 | count = 0; |
755 | } | 755 | } |
756 | } | 756 | } |
@@ -759,20 +759,20 @@ void il4965_rx_handle(struct il_priv *priv) | |||
759 | /* Backtrack one entry */ | 759 | /* Backtrack one entry */ |
760 | rxq->read = i; | 760 | rxq->read = i; |
761 | if (fill_rx) | 761 | if (fill_rx) |
762 | il4965_rx_replenish_now(priv); | 762 | il4965_rx_replenish_now(il); |
763 | else | 763 | else |
764 | il4965_rx_queue_restock(priv); | 764 | il4965_rx_queue_restock(il); |
765 | } | 765 | } |
766 | 766 | ||
767 | /* call this function to flush any scheduled tasklet */ | 767 | /* call this function to flush any scheduled tasklet */ |
768 | static inline void il4965_synchronize_irq(struct il_priv *priv) | 768 | static inline void il4965_synchronize_irq(struct il_priv *il) |
769 | { | 769 | { |
770 | /* wait to make sure we flush pending tasklet*/ | 770 | /* wait to make sure we flush pending tasklet*/ |
771 | synchronize_irq(priv->pci_dev->irq); | 771 | synchronize_irq(il->pci_dev->irq); |
772 | tasklet_kill(&priv->irq_tasklet); | 772 | tasklet_kill(&il->irq_tasklet); |
773 | } | 773 | } |
774 | 774 | ||
775 | static void il4965_irq_tasklet(struct il_priv *priv) | 775 | static void il4965_irq_tasklet(struct il_priv *il) |
776 | { | 776 | { |
777 | u32 inta, handled = 0; | 777 | u32 inta, handled = 0; |
778 | u32 inta_fh; | 778 | u32 inta_fh; |
@@ -782,30 +782,30 @@ static void il4965_irq_tasklet(struct il_priv *priv) | |||
782 | u32 inta_mask; | 782 | u32 inta_mask; |
783 | #endif | 783 | #endif |
784 | 784 | ||
785 | spin_lock_irqsave(&priv->lock, flags); | 785 | spin_lock_irqsave(&il->lock, flags); |
786 | 786 | ||
787 | /* Ack/clear/reset pending uCode interrupts. | 787 | /* Ack/clear/reset pending uCode interrupts. |
788 | * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS, | 788 | * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS, |
789 | * and will clear only when CSR_FH_INT_STATUS gets cleared. */ | 789 | * and will clear only when CSR_FH_INT_STATUS gets cleared. */ |
790 | inta = il_read32(priv, CSR_INT); | 790 | inta = il_read32(il, CSR_INT); |
791 | il_write32(priv, CSR_INT, inta); | 791 | il_write32(il, CSR_INT, inta); |
792 | 792 | ||
793 | /* Ack/clear/reset pending flow-handler (DMA) interrupts. | 793 | /* Ack/clear/reset pending flow-handler (DMA) interrupts. |
794 | * Any new interrupts that happen after this, either while we're | 794 | * Any new interrupts that happen after this, either while we're |
795 | * in this tasklet, or later, will show up in next ISR/tasklet. */ | 795 | * in this tasklet, or later, will show up in next ISR/tasklet. */ |
796 | inta_fh = il_read32(priv, CSR_FH_INT_STATUS); | 796 | inta_fh = il_read32(il, CSR_FH_INT_STATUS); |
797 | il_write32(priv, CSR_FH_INT_STATUS, inta_fh); | 797 | il_write32(il, CSR_FH_INT_STATUS, inta_fh); |
798 | 798 | ||
799 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 799 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
800 | if (il_get_debug_level(priv) & IL_DL_ISR) { | 800 | if (il_get_debug_level(il) & IL_DL_ISR) { |
801 | /* just for debug */ | 801 | /* just for debug */ |
802 | inta_mask = il_read32(priv, CSR_INT_MASK); | 802 | inta_mask = il_read32(il, CSR_INT_MASK); |
803 | IL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", | 803 | IL_DEBUG_ISR(il, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", |
804 | inta, inta_mask, inta_fh); | 804 | inta, inta_mask, inta_fh); |
805 | } | 805 | } |
806 | #endif | 806 | #endif |
807 | 807 | ||
808 | spin_unlock_irqrestore(&priv->lock, flags); | 808 | spin_unlock_irqrestore(&il->lock, flags); |
809 | 809 | ||
810 | /* Since CSR_INT and CSR_FH_INT_STATUS reads and clears are not | 810 | /* Since CSR_INT and CSR_FH_INT_STATUS reads and clears are not |
811 | * atomic, make sure that inta covers all the interrupts that | 811 | * atomic, make sure that inta covers all the interrupts that |
@@ -818,13 +818,13 @@ static void il4965_irq_tasklet(struct il_priv *priv) | |||
818 | 818 | ||
819 | /* Now service all interrupt bits discovered above. */ | 819 | /* Now service all interrupt bits discovered above. */ |
820 | if (inta & CSR_INT_BIT_HW_ERR) { | 820 | if (inta & CSR_INT_BIT_HW_ERR) { |
821 | IL_ERR(priv, "Hardware error detected. Restarting.\n"); | 821 | IL_ERR(il, "Hardware error detected. Restarting.\n"); |
822 | 822 | ||
823 | /* Tell the device to stop sending interrupts */ | 823 | /* Tell the device to stop sending interrupts */ |
824 | il_disable_interrupts(priv); | 824 | il_disable_interrupts(il); |
825 | 825 | ||
826 | priv->isr_stats.hw++; | 826 | il->isr_stats.hw++; |
827 | il_irq_handle_error(priv); | 827 | il_irq_handle_error(il); |
828 | 828 | ||
829 | handled |= CSR_INT_BIT_HW_ERR; | 829 | handled |= CSR_INT_BIT_HW_ERR; |
830 | 830 | ||
@@ -832,18 +832,18 @@ static void il4965_irq_tasklet(struct il_priv *priv) | |||
832 | } | 832 | } |
833 | 833 | ||
834 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 834 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
835 | if (il_get_debug_level(priv) & (IL_DL_ISR)) { | 835 | if (il_get_debug_level(il) & (IL_DL_ISR)) { |
836 | /* NIC fires this, but we don't use it, redundant with WAKEUP */ | 836 | /* NIC fires this, but we don't use it, redundant with WAKEUP */ |
837 | if (inta & CSR_INT_BIT_SCD) { | 837 | if (inta & CSR_INT_BIT_SCD) { |
838 | IL_DEBUG_ISR(priv, "Scheduler finished to transmit " | 838 | IL_DEBUG_ISR(il, "Scheduler finished to transmit " |
839 | "the frame/frames.\n"); | 839 | "the frame/frames.\n"); |
840 | priv->isr_stats.sch++; | 840 | il->isr_stats.sch++; |
841 | } | 841 | } |
842 | 842 | ||
843 | /* Alive notification via Rx interrupt will do the real work */ | 843 | /* Alive notification via Rx interrupt will do the real work */ |
844 | if (inta & CSR_INT_BIT_ALIVE) { | 844 | if (inta & CSR_INT_BIT_ALIVE) { |
845 | IL_DEBUG_ISR(priv, "Alive interrupt\n"); | 845 | IL_DEBUG_ISR(il, "Alive interrupt\n"); |
846 | priv->isr_stats.alive++; | 846 | il->isr_stats.alive++; |
847 | } | 847 | } |
848 | } | 848 | } |
849 | #endif | 849 | #endif |
@@ -853,26 +853,26 @@ static void il4965_irq_tasklet(struct il_priv *priv) | |||
853 | /* HW RF KILL switch toggled */ | 853 | /* HW RF KILL switch toggled */ |
854 | if (inta & CSR_INT_BIT_RF_KILL) { | 854 | if (inta & CSR_INT_BIT_RF_KILL) { |
855 | int hw_rf_kill = 0; | 855 | int hw_rf_kill = 0; |
856 | if (!(il_read32(priv, CSR_GP_CNTRL) & | 856 | if (!(il_read32(il, CSR_GP_CNTRL) & |
857 | CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) | 857 | CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) |
858 | hw_rf_kill = 1; | 858 | hw_rf_kill = 1; |
859 | 859 | ||
860 | IL_WARN(priv, "RF_KILL bit toggled to %s.\n", | 860 | IL_WARN(il, "RF_KILL bit toggled to %s.\n", |
861 | hw_rf_kill ? "disable radio" : "enable radio"); | 861 | hw_rf_kill ? "disable radio" : "enable radio"); |
862 | 862 | ||
863 | priv->isr_stats.rfkill++; | 863 | il->isr_stats.rfkill++; |
864 | 864 | ||
865 | /* driver only loads ucode once setting the interface up. | 865 | /* driver only loads ucode once setting the interface up. |
866 | * the driver allows loading the ucode even if the radio | 866 | * the driver allows loading the ucode even if the radio |
867 | * is killed. Hence update the killswitch state here. The | 867 | * is killed. Hence update the killswitch state here. The |
868 | * rfkill handler will care about restarting if needed. | 868 | * rfkill handler will care about restarting if needed. |
869 | */ | 869 | */ |
870 | if (!test_bit(STATUS_ALIVE, &priv->status)) { | 870 | if (!test_bit(STATUS_ALIVE, &il->status)) { |
871 | if (hw_rf_kill) | 871 | if (hw_rf_kill) |
872 | set_bit(STATUS_RF_KILL_HW, &priv->status); | 872 | set_bit(STATUS_RF_KILL_HW, &il->status); |
873 | else | 873 | else |
874 | clear_bit(STATUS_RF_KILL_HW, &priv->status); | 874 | clear_bit(STATUS_RF_KILL_HW, &il->status); |
875 | wiphy_rfkill_set_hw_state(priv->hw->wiphy, hw_rf_kill); | 875 | wiphy_rfkill_set_hw_state(il->hw->wiphy, hw_rf_kill); |
876 | } | 876 | } |
877 | 877 | ||
878 | handled |= CSR_INT_BIT_RF_KILL; | 878 | handled |= CSR_INT_BIT_RF_KILL; |
@@ -880,17 +880,17 @@ static void il4965_irq_tasklet(struct il_priv *priv) | |||
880 | 880 | ||
881 | /* Chip got too hot and stopped itself */ | 881 | /* Chip got too hot and stopped itself */ |
882 | if (inta & CSR_INT_BIT_CT_KILL) { | 882 | if (inta & CSR_INT_BIT_CT_KILL) { |
883 | IL_ERR(priv, "Microcode CT kill error detected.\n"); | 883 | IL_ERR(il, "Microcode CT kill error detected.\n"); |
884 | priv->isr_stats.ctkill++; | 884 | il->isr_stats.ctkill++; |
885 | handled |= CSR_INT_BIT_CT_KILL; | 885 | handled |= CSR_INT_BIT_CT_KILL; |
886 | } | 886 | } |
887 | 887 | ||
888 | /* Error detected by uCode */ | 888 | /* Error detected by uCode */ |
889 | if (inta & CSR_INT_BIT_SW_ERR) { | 889 | if (inta & CSR_INT_BIT_SW_ERR) { |
890 | IL_ERR(priv, "Microcode SW error detected. " | 890 | IL_ERR(il, "Microcode SW error detected. " |
891 | " Restarting 0x%X.\n", inta); | 891 | " Restarting 0x%X.\n", inta); |
892 | priv->isr_stats.sw++; | 892 | il->isr_stats.sw++; |
893 | il_irq_handle_error(priv); | 893 | il_irq_handle_error(il); |
894 | handled |= CSR_INT_BIT_SW_ERR; | 894 | handled |= CSR_INT_BIT_SW_ERR; |
895 | } | 895 | } |
896 | 896 | ||
@@ -900,11 +900,11 @@ static void il4965_irq_tasklet(struct il_priv *priv) | |||
900 | * and about any Rx buffers made available while asleep. | 900 | * and about any Rx buffers made available while asleep. |
901 | */ | 901 | */ |
902 | if (inta & CSR_INT_BIT_WAKEUP) { | 902 | if (inta & CSR_INT_BIT_WAKEUP) { |
903 | IL_DEBUG_ISR(priv, "Wakeup interrupt\n"); | 903 | IL_DEBUG_ISR(il, "Wakeup interrupt\n"); |
904 | il_rx_queue_update_write_ptr(priv, &priv->rxq); | 904 | il_rx_queue_update_write_ptr(il, &il->rxq); |
905 | for (i = 0; i < priv->hw_params.max_txq_num; i++) | 905 | for (i = 0; i < il->hw_params.max_txq_num; i++) |
906 | il_txq_update_write_ptr(priv, &priv->txq[i]); | 906 | il_txq_update_write_ptr(il, &il->txq[i]); |
907 | priv->isr_stats.wakeup++; | 907 | il->isr_stats.wakeup++; |
908 | handled |= CSR_INT_BIT_WAKEUP; | 908 | handled |= CSR_INT_BIT_WAKEUP; |
909 | } | 909 | } |
910 | 910 | ||
@@ -912,46 +912,46 @@ static void il4965_irq_tasklet(struct il_priv *priv) | |||
912 | * Rx "responses" (frame-received notification), and other | 912 | * Rx "responses" (frame-received notification), and other |
913 | * notifications from uCode come through here*/ | 913 | * notifications from uCode come through here*/ |
914 | if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) { | 914 | if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) { |
915 | il4965_rx_handle(priv); | 915 | il4965_rx_handle(il); |
916 | priv->isr_stats.rx++; | 916 | il->isr_stats.rx++; |
917 | handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX); | 917 | handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX); |
918 | } | 918 | } |
919 | 919 | ||
920 | /* This "Tx" DMA channel is used only for loading uCode */ | 920 | /* This "Tx" DMA channel is used only for loading uCode */ |
921 | if (inta & CSR_INT_BIT_FH_TX) { | 921 | if (inta & CSR_INT_BIT_FH_TX) { |
922 | IL_DEBUG_ISR(priv, "uCode load interrupt\n"); | 922 | IL_DEBUG_ISR(il, "uCode load interrupt\n"); |
923 | priv->isr_stats.tx++; | 923 | il->isr_stats.tx++; |
924 | handled |= CSR_INT_BIT_FH_TX; | 924 | handled |= CSR_INT_BIT_FH_TX; |
925 | /* Wake up uCode load routine, now that load is complete */ | 925 | /* Wake up uCode load routine, now that load is complete */ |
926 | priv->ucode_write_complete = 1; | 926 | il->ucode_write_complete = 1; |
927 | wake_up(&priv->wait_command_queue); | 927 | wake_up(&il->wait_command_queue); |
928 | } | 928 | } |
929 | 929 | ||
930 | if (inta & ~handled) { | 930 | if (inta & ~handled) { |
931 | IL_ERR(priv, "Unhandled INTA bits 0x%08x\n", inta & ~handled); | 931 | IL_ERR(il, "Unhandled INTA bits 0x%08x\n", inta & ~handled); |
932 | priv->isr_stats.unhandled++; | 932 | il->isr_stats.unhandled++; |
933 | } | 933 | } |
934 | 934 | ||
935 | if (inta & ~(priv->inta_mask)) { | 935 | if (inta & ~(il->inta_mask)) { |
936 | IL_WARN(priv, "Disabled INTA bits 0x%08x were pending\n", | 936 | IL_WARN(il, "Disabled INTA bits 0x%08x were pending\n", |
937 | inta & ~priv->inta_mask); | 937 | inta & ~il->inta_mask); |
938 | IL_WARN(priv, " with FH_INT = 0x%08x\n", inta_fh); | 938 | IL_WARN(il, " with FH_INT = 0x%08x\n", inta_fh); |
939 | } | 939 | } |
940 | 940 | ||
941 | /* Re-enable all interrupts */ | 941 | /* Re-enable all interrupts */ |
942 | /* only Re-enable if disabled by irq */ | 942 | /* only Re-enable if disabled by irq */ |
943 | if (test_bit(STATUS_INT_ENABLED, &priv->status)) | 943 | if (test_bit(STATUS_INT_ENABLED, &il->status)) |
944 | il_enable_interrupts(priv); | 944 | il_enable_interrupts(il); |
945 | /* Re-enable RF_KILL if it occurred */ | 945 | /* Re-enable RF_KILL if it occurred */ |
946 | else if (handled & CSR_INT_BIT_RF_KILL) | 946 | else if (handled & CSR_INT_BIT_RF_KILL) |
947 | il_enable_rfkill_int(priv); | 947 | il_enable_rfkill_int(il); |
948 | 948 | ||
949 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG | 949 | #ifdef CONFIG_IWLWIFI_LEGACY_DEBUG |
950 | if (il_get_debug_level(priv) & (IL_DL_ISR)) { | 950 | if (il_get_debug_level(il) & (IL_DL_ISR)) { |
951 | inta = il_read32(priv, CSR_INT); | 951 | inta = il_read32(il, CSR_INT); |
952 | inta_mask = il_read32(priv, CSR_INT_MASK); | 952 | inta_mask = il_read32(il, CSR_INT_MASK); |
953 | inta_fh = il_read32(priv, CSR_FH_INT_STATUS); | 953 | inta_fh = il_read32(il, CSR_FH_INT_STATUS); |
954 | IL_DEBUG_ISR(priv, | 954 | IL_DEBUG_ISR(il, |
955 | "End inta 0x%08x, enabled 0x%08x, fh 0x%08x, " | 955 | "End inta 0x%08x, enabled 0x%08x, fh 0x%08x, " |
956 | "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags); | 956 | "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags); |
957 | } | 957 | } |
@@ -980,24 +980,24 @@ static void il4965_irq_tasklet(struct il_priv *priv) | |||
980 | static ssize_t il4965_show_debug_level(struct device *d, | 980 | static ssize_t il4965_show_debug_level(struct device *d, |
981 | struct device_attribute *attr, char *buf) | 981 | struct device_attribute *attr, char *buf) |
982 | { | 982 | { |
983 | struct il_priv *priv = dev_get_drvdata(d); | 983 | struct il_priv *il = dev_get_drvdata(d); |
984 | return sprintf(buf, "0x%08X\n", il_get_debug_level(priv)); | 984 | return sprintf(buf, "0x%08X\n", il_get_debug_level(il)); |
985 | } | 985 | } |
986 | static ssize_t il4965_store_debug_level(struct device *d, | 986 | static ssize_t il4965_store_debug_level(struct device *d, |
987 | struct device_attribute *attr, | 987 | struct device_attribute *attr, |
988 | const char *buf, size_t count) | 988 | const char *buf, size_t count) |
989 | { | 989 | { |
990 | struct il_priv *priv = dev_get_drvdata(d); | 990 | struct il_priv *il = dev_get_drvdata(d); |
991 | unsigned long val; | 991 | unsigned long val; |
992 | int ret; | 992 | int ret; |
993 | 993 | ||
994 | ret = strict_strtoul(buf, 0, &val); | 994 | ret = strict_strtoul(buf, 0, &val); |
995 | if (ret) | 995 | if (ret) |
996 | IL_ERR(priv, "%s is not in hex or decimal form.\n", buf); | 996 | IL_ERR(il, "%s is not in hex or decimal form.\n", buf); |
997 | else { | 997 | else { |
998 | priv->debug_level = val; | 998 | il->debug_level = val; |
999 | if (il_alloc_traffic_mem(priv)) | 999 | if (il_alloc_traffic_mem(il)) |
1000 | IL_ERR(priv, | 1000 | IL_ERR(il, |
1001 | "Not enough memory to generate traffic log\n"); | 1001 | "Not enough memory to generate traffic log\n"); |
1002 | } | 1002 | } |
1003 | return strnlen(buf, count); | 1003 | return strnlen(buf, count); |
@@ -1013,12 +1013,12 @@ static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO, | |||
1013 | static ssize_t il4965_show_temperature(struct device *d, | 1013 | static ssize_t il4965_show_temperature(struct device *d, |
1014 | struct device_attribute *attr, char *buf) | 1014 | struct device_attribute *attr, char *buf) |
1015 | { | 1015 | { |
1016 | struct il_priv *priv = dev_get_drvdata(d); | 1016 | struct il_priv *il = dev_get_drvdata(d); |
1017 | 1017 | ||
1018 | if (!il_is_alive(priv)) | 1018 | if (!il_is_alive(il)) |
1019 | return -EAGAIN; | 1019 | return -EAGAIN; |
1020 | 1020 | ||
1021 | return sprintf(buf, "%d\n", priv->temperature); | 1021 | return sprintf(buf, "%d\n", il->temperature); |
1022 | } | 1022 | } |
1023 | 1023 | ||
1024 | static DEVICE_ATTR(temperature, S_IRUGO, il4965_show_temperature, NULL); | 1024 | static DEVICE_ATTR(temperature, S_IRUGO, il4965_show_temperature, NULL); |
@@ -1026,29 +1026,29 @@ static DEVICE_ATTR(temperature, S_IRUGO, il4965_show_temperature, NULL); | |||
1026 | static ssize_t il4965_show_tx_power(struct device *d, | 1026 | static ssize_t il4965_show_tx_power(struct device *d, |
1027 | struct device_attribute *attr, char *buf) | 1027 | struct device_attribute *attr, char *buf) |
1028 | { | 1028 | { |
1029 | struct il_priv *priv = dev_get_drvdata(d); | 1029 | struct il_priv *il = dev_get_drvdata(d); |
1030 | 1030 | ||
1031 | if (!il_is_ready_rf(priv)) | 1031 | if (!il_is_ready_rf(il)) |
1032 | return sprintf(buf, "off\n"); | 1032 | return sprintf(buf, "off\n"); |
1033 | else | 1033 | else |
1034 | return sprintf(buf, "%d\n", priv->tx_power_user_lmt); | 1034 | return sprintf(buf, "%d\n", il->tx_power_user_lmt); |
1035 | } | 1035 | } |
1036 | 1036 | ||
1037 | static ssize_t il4965_store_tx_power(struct device *d, | 1037 | static ssize_t il4965_store_tx_power(struct device *d, |
1038 | struct device_attribute *attr, | 1038 | struct device_attribute *attr, |
1039 | const char *buf, size_t count) | 1039 | const char *buf, size_t count) |
1040 | { | 1040 | { |
1041 | struct il_priv *priv = dev_get_drvdata(d); | 1041 | struct il_priv *il = dev_get_drvdata(d); |
1042 | unsigned long val; | 1042 | unsigned long val; |
1043 | int ret; | 1043 | int ret; |
1044 | 1044 | ||
1045 | ret = strict_strtoul(buf, 10, &val); | 1045 | ret = strict_strtoul(buf, 10, &val); |
1046 | if (ret) | 1046 | if (ret) |
1047 | IL_INFO(priv, "%s is not in decimal form.\n", buf); | 1047 | IL_INFO(il, "%s is not in decimal form.\n", buf); |
1048 | else { | 1048 | else { |
1049 | ret = il_set_tx_power(priv, val, false); | 1049 | ret = il_set_tx_power(il, val, false); |
1050 | if (ret) | 1050 | if (ret) |
1051 | IL_ERR(priv, "failed setting tx power (0x%d).\n", | 1051 | IL_ERR(il, "failed setting tx power (0x%d).\n", |
1052 | ret); | 1052 | ret); |
1053 | else | 1053 | else |
1054 | ret = count; | 1054 | ret = count; |
@@ -1079,52 +1079,52 @@ static struct attribute_group il_attribute_group = { | |||
1079 | * | 1079 | * |
1080 | ******************************************************************************/ | 1080 | ******************************************************************************/ |
1081 | 1081 | ||
1082 | static void il4965_dealloc_ucode_pci(struct il_priv *priv) | 1082 | static void il4965_dealloc_ucode_pci(struct il_priv *il) |
1083 | { | 1083 | { |
1084 | il_free_fw_desc(priv->pci_dev, &priv->ucode_code); | 1084 | il_free_fw_desc(il->pci_dev, &il->ucode_code); |
1085 | il_free_fw_desc(priv->pci_dev, &priv->ucode_data); | 1085 | il_free_fw_desc(il->pci_dev, &il->ucode_data); |
1086 | il_free_fw_desc(priv->pci_dev, &priv->ucode_data_backup); | 1086 | il_free_fw_desc(il->pci_dev, &il->ucode_data_backup); |
1087 | il_free_fw_desc(priv->pci_dev, &priv->ucode_init); | 1087 | il_free_fw_desc(il->pci_dev, &il->ucode_init); |
1088 | il_free_fw_desc(priv->pci_dev, &priv->ucode_init_data); | 1088 | il_free_fw_desc(il->pci_dev, &il->ucode_init_data); |
1089 | il_free_fw_desc(priv->pci_dev, &priv->ucode_boot); | 1089 | il_free_fw_desc(il->pci_dev, &il->ucode_boot); |
1090 | } | 1090 | } |
1091 | 1091 | ||
1092 | static void il4965_nic_start(struct il_priv *priv) | 1092 | static void il4965_nic_start(struct il_priv *il) |
1093 | { | 1093 | { |
1094 | /* Remove all resets to allow NIC to operate */ | 1094 | /* Remove all resets to allow NIC to operate */ |
1095 | il_write32(priv, CSR_RESET, 0); | 1095 | il_write32(il, CSR_RESET, 0); |
1096 | } | 1096 | } |
1097 | 1097 | ||
1098 | static void il4965_ucode_callback(const struct firmware *ucode_raw, | 1098 | static void il4965_ucode_callback(const struct firmware *ucode_raw, |
1099 | void *context); | 1099 | void *context); |
1100 | static int il4965_mac_setup_register(struct il_priv *priv, | 1100 | static int il4965_mac_setup_register(struct il_priv *il, |
1101 | u32 max_probe_length); | 1101 | u32 max_probe_length); |
1102 | 1102 | ||
1103 | static int __must_check il4965_request_firmware(struct il_priv *priv, bool first) | 1103 | static int __must_check il4965_request_firmware(struct il_priv *il, bool first) |
1104 | { | 1104 | { |
1105 | const char *name_pre = priv->cfg->fw_name_pre; | 1105 | const char *name_pre = il->cfg->fw_name_pre; |
1106 | char tag[8]; | 1106 | char tag[8]; |
1107 | 1107 | ||
1108 | if (first) { | 1108 | if (first) { |
1109 | priv->fw_index = priv->cfg->ucode_api_max; | 1109 | il->fw_index = il->cfg->ucode_api_max; |
1110 | sprintf(tag, "%d", priv->fw_index); | 1110 | sprintf(tag, "%d", il->fw_index); |
1111 | } else { | 1111 | } else { |
1112 | priv->fw_index--; | 1112 | il->fw_index--; |
1113 | sprintf(tag, "%d", priv->fw_index); | 1113 | sprintf(tag, "%d", il->fw_index); |
1114 | } | 1114 | } |
1115 | 1115 | ||
1116 | if (priv->fw_index < priv->cfg->ucode_api_min) { | 1116 | if (il->fw_index < il->cfg->ucode_api_min) { |
1117 | IL_ERR(priv, "no suitable firmware found!\n"); | 1117 | IL_ERR(il, "no suitable firmware found!\n"); |
1118 | return -ENOENT; | 1118 | return -ENOENT; |
1119 | } | 1119 | } |
1120 | 1120 | ||
1121 | sprintf(priv->firmware_name, "%s%s%s", name_pre, tag, ".ucode"); | 1121 | sprintf(il->firmware_name, "%s%s%s", name_pre, tag, ".ucode"); |
1122 | 1122 | ||
1123 | IL_DEBUG_INFO(priv, "attempting to load firmware '%s'\n", | 1123 | IL_DEBUG_INFO(il, "attempting to load firmware '%s'\n", |
1124 | priv->firmware_name); | 1124 | il->firmware_name); |
1125 | 1125 | ||
1126 | return request_firmware_nowait(THIS_MODULE, 1, priv->firmware_name, | 1126 | return request_firmware_nowait(THIS_MODULE, 1, il->firmware_name, |
1127 | &priv->pci_dev->dev, GFP_KERNEL, priv, | 1127 | &il->pci_dev->dev, GFP_KERNEL, il, |
1128 | il4965_ucode_callback); | 1128 | il4965_ucode_callback); |
1129 | } | 1129 | } |
1130 | 1130 | ||
@@ -1133,7 +1133,7 @@ struct il4965_firmware_pieces { | |||
1133 | size_t inst_size, data_size, init_size, init_data_size, boot_size; | 1133 | size_t inst_size, data_size, init_size, init_data_size, boot_size; |
1134 | }; | 1134 | }; |
1135 | 1135 | ||
1136 | static int il4965_load_firmware(struct il_priv *priv, | 1136 | static int il4965_load_firmware(struct il_priv *il, |
1137 | const struct firmware *ucode_raw, | 1137 | const struct firmware *ucode_raw, |
1138 | struct il4965_firmware_pieces *pieces) | 1138 | struct il4965_firmware_pieces *pieces) |
1139 | { | 1139 | { |
@@ -1141,8 +1141,8 @@ static int il4965_load_firmware(struct il_priv *priv, | |||
1141 | u32 api_ver, hdr_size; | 1141 | u32 api_ver, hdr_size; |
1142 | const u8 *src; | 1142 | const u8 *src; |
1143 | 1143 | ||
1144 | priv->ucode_ver = le32_to_cpu(ucode->ver); | 1144 | il->ucode_ver = le32_to_cpu(ucode->ver); |
1145 | api_ver = IL_UCODE_API(priv->ucode_ver); | 1145 | api_ver = IL_UCODE_API(il->ucode_ver); |
1146 | 1146 | ||
1147 | switch (api_ver) { | 1147 | switch (api_ver) { |
1148 | default: | 1148 | default: |
@@ -1151,7 +1151,7 @@ static int il4965_load_firmware(struct il_priv *priv, | |||
1151 | case 2: | 1151 | case 2: |
1152 | hdr_size = 24; | 1152 | hdr_size = 24; |
1153 | if (ucode_raw->size < hdr_size) { | 1153 | if (ucode_raw->size < hdr_size) { |
1154 | IL_ERR(priv, "File size too small!\n"); | 1154 | IL_ERR(il, "File size too small!\n"); |
1155 | return -EINVAL; | 1155 | return -EINVAL; |
1156 | } | 1156 | } |
1157 | pieces->inst_size = le32_to_cpu(ucode->v1.inst_size); | 1157 | pieces->inst_size = le32_to_cpu(ucode->v1.inst_size); |
@@ -1169,7 +1169,7 @@ static int il4965_load_firmware(struct il_priv *priv, | |||
1169 | pieces->data_size + pieces->init_size + | 1169 | pieces->data_size + pieces->init_size + |
1170 | pieces->init_data_size + pieces->boot_size) { | 1170 | pieces->init_data_size + pieces->boot_size) { |
1171 | 1171 | ||
1172 | IL_ERR(priv, | 1172 | IL_ERR(il, |
1173 | "uCode file size %d does not match expected size\n", | 1173 | "uCode file size %d does not match expected size\n", |
1174 | (int)ucode_raw->size); | 1174 | (int)ucode_raw->size); |
1175 | return -EINVAL; | 1175 | return -EINVAL; |
@@ -1198,12 +1198,12 @@ static int il4965_load_firmware(struct il_priv *priv, | |||
1198 | static void | 1198 | static void |
1199 | il4965_ucode_callback(const struct firmware *ucode_raw, void *context) | 1199 | il4965_ucode_callback(const struct firmware *ucode_raw, void *context) |
1200 | { | 1200 | { |
1201 | struct il_priv *priv = context; | 1201 | struct il_priv *il = context; |
1202 | struct il_ucode_header *ucode; | 1202 | struct il_ucode_header *ucode; |
1203 | int err; | 1203 | int err; |
1204 | struct il4965_firmware_pieces pieces; | 1204 | struct il4965_firmware_pieces pieces; |
1205 | const unsigned int api_max = priv->cfg->ucode_api_max; | 1205 | const unsigned int api_max = il->cfg->ucode_api_max; |
1206 | const unsigned int api_min = priv->cfg->ucode_api_min; | 1206 | const unsigned int api_min = il->cfg->ucode_api_min; |
1207 | u32 api_ver; | 1207 | u32 api_ver; |
1208 | 1208 | ||
1209 | u32 max_probe_length = 200; | 1209 | u32 max_probe_length = 200; |
@@ -1213,31 +1213,31 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1213 | memset(&pieces, 0, sizeof(pieces)); | 1213 | memset(&pieces, 0, sizeof(pieces)); |
1214 | 1214 | ||
1215 | if (!ucode_raw) { | 1215 | if (!ucode_raw) { |
1216 | if (priv->fw_index <= priv->cfg->ucode_api_max) | 1216 | if (il->fw_index <= il->cfg->ucode_api_max) |
1217 | IL_ERR(priv, | 1217 | IL_ERR(il, |
1218 | "request for firmware file '%s' failed.\n", | 1218 | "request for firmware file '%s' failed.\n", |
1219 | priv->firmware_name); | 1219 | il->firmware_name); |
1220 | goto try_again; | 1220 | goto try_again; |
1221 | } | 1221 | } |
1222 | 1222 | ||
1223 | IL_DEBUG_INFO(priv, "Loaded firmware file '%s' (%zd bytes).\n", | 1223 | IL_DEBUG_INFO(il, "Loaded firmware file '%s' (%zd bytes).\n", |
1224 | priv->firmware_name, ucode_raw->size); | 1224 | il->firmware_name, ucode_raw->size); |
1225 | 1225 | ||
1226 | /* Make sure that we got at least the API version number */ | 1226 | /* Make sure that we got at least the API version number */ |
1227 | if (ucode_raw->size < 4) { | 1227 | if (ucode_raw->size < 4) { |
1228 | IL_ERR(priv, "File size way too small!\n"); | 1228 | IL_ERR(il, "File size way too small!\n"); |
1229 | goto try_again; | 1229 | goto try_again; |
1230 | } | 1230 | } |
1231 | 1231 | ||
1232 | /* Data from ucode file: header followed by uCode images */ | 1232 | /* Data from ucode file: header followed by uCode images */ |
1233 | ucode = (struct il_ucode_header *)ucode_raw->data; | 1233 | ucode = (struct il_ucode_header *)ucode_raw->data; |
1234 | 1234 | ||
1235 | err = il4965_load_firmware(priv, ucode_raw, &pieces); | 1235 | err = il4965_load_firmware(il, ucode_raw, &pieces); |
1236 | 1236 | ||
1237 | if (err) | 1237 | if (err) |
1238 | goto try_again; | 1238 | goto try_again; |
1239 | 1239 | ||
1240 | api_ver = IL_UCODE_API(priv->ucode_ver); | 1240 | api_ver = IL_UCODE_API(il->ucode_ver); |
1241 | 1241 | ||
1242 | /* | 1242 | /* |
1243 | * api_ver should match the api version forming part of the | 1243 | * api_ver should match the api version forming part of the |
@@ -1245,7 +1245,7 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1245 | * on the API version read from firmware header from here on forward | 1245 | * on the API version read from firmware header from here on forward |
1246 | */ | 1246 | */ |
1247 | if (api_ver < api_min || api_ver > api_max) { | 1247 | if (api_ver < api_min || api_ver > api_max) { |
1248 | IL_ERR(priv, | 1248 | IL_ERR(il, |
1249 | "Driver unable to support your firmware API. " | 1249 | "Driver unable to support your firmware API. " |
1250 | "Driver supports v%u, firmware is v%u.\n", | 1250 | "Driver supports v%u, firmware is v%u.\n", |
1251 | api_max, api_ver); | 1251 | api_max, api_ver); |
@@ -1253,25 +1253,25 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1253 | } | 1253 | } |
1254 | 1254 | ||
1255 | if (api_ver != api_max) | 1255 | if (api_ver != api_max) |
1256 | IL_ERR(priv, | 1256 | IL_ERR(il, |
1257 | "Firmware has old API version. Expected v%u, " | 1257 | "Firmware has old API version. Expected v%u, " |
1258 | "got v%u. New firmware can be obtained " | 1258 | "got v%u. New firmware can be obtained " |
1259 | "from http://www.intellinuxwireless.org.\n", | 1259 | "from http://www.intellinuxwireless.org.\n", |
1260 | api_max, api_ver); | 1260 | api_max, api_ver); |
1261 | 1261 | ||
1262 | IL_INFO(priv, "loaded firmware version %u.%u.%u.%u\n", | 1262 | IL_INFO(il, "loaded firmware version %u.%u.%u.%u\n", |
1263 | IL_UCODE_MAJOR(priv->ucode_ver), | 1263 | IL_UCODE_MAJOR(il->ucode_ver), |
1264 | IL_UCODE_MINOR(priv->ucode_ver), | 1264 | IL_UCODE_MINOR(il->ucode_ver), |
1265 | IL_UCODE_API(priv->ucode_ver), | 1265 | IL_UCODE_API(il->ucode_ver), |
1266 | IL_UCODE_SERIAL(priv->ucode_ver)); | 1266 | IL_UCODE_SERIAL(il->ucode_ver)); |
1267 | 1267 | ||
1268 | snprintf(priv->hw->wiphy->fw_version, | 1268 | snprintf(il->hw->wiphy->fw_version, |
1269 | sizeof(priv->hw->wiphy->fw_version), | 1269 | sizeof(il->hw->wiphy->fw_version), |
1270 | "%u.%u.%u.%u", | 1270 | "%u.%u.%u.%u", |
1271 | IL_UCODE_MAJOR(priv->ucode_ver), | 1271 | IL_UCODE_MAJOR(il->ucode_ver), |
1272 | IL_UCODE_MINOR(priv->ucode_ver), | 1272 | IL_UCODE_MINOR(il->ucode_ver), |
1273 | IL_UCODE_API(priv->ucode_ver), | 1273 | IL_UCODE_API(il->ucode_ver), |
1274 | IL_UCODE_SERIAL(priv->ucode_ver)); | 1274 | IL_UCODE_SERIAL(il->ucode_ver)); |
1275 | 1275 | ||
1276 | /* | 1276 | /* |
1277 | * For any of the failures below (before allocating pci memory) | 1277 | * For any of the failures below (before allocating pci memory) |
@@ -1279,46 +1279,46 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1279 | * user just got a corrupted version of the latest API. | 1279 | * user just got a corrupted version of the latest API. |
1280 | */ | 1280 | */ |
1281 | 1281 | ||
1282 | IL_DEBUG_INFO(priv, "f/w package hdr ucode version raw = 0x%x\n", | 1282 | IL_DEBUG_INFO(il, "f/w package hdr ucode version raw = 0x%x\n", |
1283 | priv->ucode_ver); | 1283 | il->ucode_ver); |
1284 | IL_DEBUG_INFO(priv, "f/w package hdr runtime inst size = %Zd\n", | 1284 | IL_DEBUG_INFO(il, "f/w package hdr runtime inst size = %Zd\n", |
1285 | pieces.inst_size); | 1285 | pieces.inst_size); |
1286 | IL_DEBUG_INFO(priv, "f/w package hdr runtime data size = %Zd\n", | 1286 | IL_DEBUG_INFO(il, "f/w package hdr runtime data size = %Zd\n", |
1287 | pieces.data_size); | 1287 | pieces.data_size); |
1288 | IL_DEBUG_INFO(priv, "f/w package hdr init inst size = %Zd\n", | 1288 | IL_DEBUG_INFO(il, "f/w package hdr init inst size = %Zd\n", |
1289 | pieces.init_size); | 1289 | pieces.init_size); |
1290 | IL_DEBUG_INFO(priv, "f/w package hdr init data size = %Zd\n", | 1290 | IL_DEBUG_INFO(il, "f/w package hdr init data size = %Zd\n", |
1291 | pieces.init_data_size); | 1291 | pieces.init_data_size); |
1292 | IL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %Zd\n", | 1292 | IL_DEBUG_INFO(il, "f/w package hdr boot inst size = %Zd\n", |
1293 | pieces.boot_size); | 1293 | pieces.boot_size); |
1294 | 1294 | ||
1295 | /* Verify that uCode images will fit in card's SRAM */ | 1295 | /* Verify that uCode images will fit in card's SRAM */ |
1296 | if (pieces.inst_size > priv->hw_params.max_inst_size) { | 1296 | if (pieces.inst_size > il->hw_params.max_inst_size) { |
1297 | IL_ERR(priv, "uCode instr len %Zd too large to fit in\n", | 1297 | IL_ERR(il, "uCode instr len %Zd too large to fit in\n", |
1298 | pieces.inst_size); | 1298 | pieces.inst_size); |
1299 | goto try_again; | 1299 | goto try_again; |
1300 | } | 1300 | } |
1301 | 1301 | ||
1302 | if (pieces.data_size > priv->hw_params.max_data_size) { | 1302 | if (pieces.data_size > il->hw_params.max_data_size) { |
1303 | IL_ERR(priv, "uCode data len %Zd too large to fit in\n", | 1303 | IL_ERR(il, "uCode data len %Zd too large to fit in\n", |
1304 | pieces.data_size); | 1304 | pieces.data_size); |
1305 | goto try_again; | 1305 | goto try_again; |
1306 | } | 1306 | } |
1307 | 1307 | ||
1308 | if (pieces.init_size > priv->hw_params.max_inst_size) { | 1308 | if (pieces.init_size > il->hw_params.max_inst_size) { |
1309 | IL_ERR(priv, "uCode init instr len %Zd too large to fit in\n", | 1309 | IL_ERR(il, "uCode init instr len %Zd too large to fit in\n", |
1310 | pieces.init_size); | 1310 | pieces.init_size); |
1311 | goto try_again; | 1311 | goto try_again; |
1312 | } | 1312 | } |
1313 | 1313 | ||
1314 | if (pieces.init_data_size > priv->hw_params.max_data_size) { | 1314 | if (pieces.init_data_size > il->hw_params.max_data_size) { |
1315 | IL_ERR(priv, "uCode init data len %Zd too large to fit in\n", | 1315 | IL_ERR(il, "uCode init data len %Zd too large to fit in\n", |
1316 | pieces.init_data_size); | 1316 | pieces.init_data_size); |
1317 | goto try_again; | 1317 | goto try_again; |
1318 | } | 1318 | } |
1319 | 1319 | ||
1320 | if (pieces.boot_size > priv->hw_params.max_bsm_size) { | 1320 | if (pieces.boot_size > il->hw_params.max_bsm_size) { |
1321 | IL_ERR(priv, "uCode boot instr len %Zd too large to fit in\n", | 1321 | IL_ERR(il, "uCode boot instr len %Zd too large to fit in\n", |
1322 | pieces.boot_size); | 1322 | pieces.boot_size); |
1323 | goto try_again; | 1323 | goto try_again; |
1324 | } | 1324 | } |
@@ -1328,92 +1328,92 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1328 | /* Runtime instructions and 2 copies of data: | 1328 | /* Runtime instructions and 2 copies of data: |
1329 | * 1) unmodified from disk | 1329 | * 1) unmodified from disk |
1330 | * 2) backup cache for save/restore during power-downs */ | 1330 | * 2) backup cache for save/restore during power-downs */ |
1331 | priv->ucode_code.len = pieces.inst_size; | 1331 | il->ucode_code.len = pieces.inst_size; |
1332 | il_alloc_fw_desc(priv->pci_dev, &priv->ucode_code); | 1332 | il_alloc_fw_desc(il->pci_dev, &il->ucode_code); |
1333 | 1333 | ||
1334 | priv->ucode_data.len = pieces.data_size; | 1334 | il->ucode_data.len = pieces.data_size; |
1335 | il_alloc_fw_desc(priv->pci_dev, &priv->ucode_data); | 1335 | il_alloc_fw_desc(il->pci_dev, &il->ucode_data); |
1336 | 1336 | ||
1337 | priv->ucode_data_backup.len = pieces.data_size; | 1337 | il->ucode_data_backup.len = pieces.data_size; |
1338 | il_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup); | 1338 | il_alloc_fw_desc(il->pci_dev, &il->ucode_data_backup); |
1339 | 1339 | ||
1340 | if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr || | 1340 | if (!il->ucode_code.v_addr || !il->ucode_data.v_addr || |
1341 | !priv->ucode_data_backup.v_addr) | 1341 | !il->ucode_data_backup.v_addr) |
1342 | goto err_pci_alloc; | 1342 | goto err_pci_alloc; |
1343 | 1343 | ||
1344 | /* Initialization instructions and data */ | 1344 | /* Initialization instructions and data */ |
1345 | if (pieces.init_size && pieces.init_data_size) { | 1345 | if (pieces.init_size && pieces.init_data_size) { |
1346 | priv->ucode_init.len = pieces.init_size; | 1346 | il->ucode_init.len = pieces.init_size; |
1347 | il_alloc_fw_desc(priv->pci_dev, &priv->ucode_init); | 1347 | il_alloc_fw_desc(il->pci_dev, &il->ucode_init); |
1348 | 1348 | ||
1349 | priv->ucode_init_data.len = pieces.init_data_size; | 1349 | il->ucode_init_data.len = pieces.init_data_size; |
1350 | il_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data); | 1350 | il_alloc_fw_desc(il->pci_dev, &il->ucode_init_data); |
1351 | 1351 | ||
1352 | if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr) | 1352 | if (!il->ucode_init.v_addr || !il->ucode_init_data.v_addr) |
1353 | goto err_pci_alloc; | 1353 | goto err_pci_alloc; |
1354 | } | 1354 | } |
1355 | 1355 | ||
1356 | /* Bootstrap (instructions only, no data) */ | 1356 | /* Bootstrap (instructions only, no data) */ |
1357 | if (pieces.boot_size) { | 1357 | if (pieces.boot_size) { |
1358 | priv->ucode_boot.len = pieces.boot_size; | 1358 | il->ucode_boot.len = pieces.boot_size; |
1359 | il_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot); | 1359 | il_alloc_fw_desc(il->pci_dev, &il->ucode_boot); |
1360 | 1360 | ||
1361 | if (!priv->ucode_boot.v_addr) | 1361 | if (!il->ucode_boot.v_addr) |
1362 | goto err_pci_alloc; | 1362 | goto err_pci_alloc; |
1363 | } | 1363 | } |
1364 | 1364 | ||
1365 | /* Now that we can no longer fail, copy information */ | 1365 | /* Now that we can no longer fail, copy information */ |
1366 | 1366 | ||
1367 | priv->sta_key_max_num = STA_KEY_MAX_NUM; | 1367 | il->sta_key_max_num = STA_KEY_MAX_NUM; |
1368 | 1368 | ||
1369 | /* Copy images into buffers for card's bus-master reads ... */ | 1369 | /* Copy images into buffers for card's bus-master reads ... */ |
1370 | 1370 | ||
1371 | /* Runtime instructions (first block of data in file) */ | 1371 | /* Runtime instructions (first block of data in file) */ |
1372 | IL_DEBUG_INFO(priv, "Copying (but not loading) uCode instr len %Zd\n", | 1372 | IL_DEBUG_INFO(il, "Copying (but not loading) uCode instr len %Zd\n", |
1373 | pieces.inst_size); | 1373 | pieces.inst_size); |
1374 | memcpy(priv->ucode_code.v_addr, pieces.inst, pieces.inst_size); | 1374 | memcpy(il->ucode_code.v_addr, pieces.inst, pieces.inst_size); |
1375 | 1375 | ||
1376 | IL_DEBUG_INFO(priv, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n", | 1376 | IL_DEBUG_INFO(il, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n", |
1377 | priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr); | 1377 | il->ucode_code.v_addr, (u32)il->ucode_code.p_addr); |
1378 | 1378 | ||
1379 | /* | 1379 | /* |
1380 | * Runtime data | 1380 | * Runtime data |
1381 | * NOTE: Copy into backup buffer will be done in il_up() | 1381 | * NOTE: Copy into backup buffer will be done in il_up() |
1382 | */ | 1382 | */ |
1383 | IL_DEBUG_INFO(priv, "Copying (but not loading) uCode data len %Zd\n", | 1383 | IL_DEBUG_INFO(il, "Copying (but not loading) uCode data len %Zd\n", |
1384 | pieces.data_size); | 1384 | pieces.data_size); |
1385 | memcpy(priv->ucode_data.v_addr, pieces.data, pieces.data_size); | 1385 | memcpy(il->ucode_data.v_addr, pieces.data, pieces.data_size); |
1386 | memcpy(priv->ucode_data_backup.v_addr, pieces.data, pieces.data_size); | 1386 | memcpy(il->ucode_data_backup.v_addr, pieces.data, pieces.data_size); |
1387 | 1387 | ||
1388 | /* Initialization instructions */ | 1388 | /* Initialization instructions */ |
1389 | if (pieces.init_size) { | 1389 | if (pieces.init_size) { |
1390 | IL_DEBUG_INFO(priv, | 1390 | IL_DEBUG_INFO(il, |
1391 | "Copying (but not loading) init instr len %Zd\n", | 1391 | "Copying (but not loading) init instr len %Zd\n", |
1392 | pieces.init_size); | 1392 | pieces.init_size); |
1393 | memcpy(priv->ucode_init.v_addr, pieces.init, pieces.init_size); | 1393 | memcpy(il->ucode_init.v_addr, pieces.init, pieces.init_size); |
1394 | } | 1394 | } |
1395 | 1395 | ||
1396 | /* Initialization data */ | 1396 | /* Initialization data */ |
1397 | if (pieces.init_data_size) { | 1397 | if (pieces.init_data_size) { |
1398 | IL_DEBUG_INFO(priv, | 1398 | IL_DEBUG_INFO(il, |
1399 | "Copying (but not loading) init data len %Zd\n", | 1399 | "Copying (but not loading) init data len %Zd\n", |
1400 | pieces.init_data_size); | 1400 | pieces.init_data_size); |
1401 | memcpy(priv->ucode_init_data.v_addr, pieces.init_data, | 1401 | memcpy(il->ucode_init_data.v_addr, pieces.init_data, |
1402 | pieces.init_data_size); | 1402 | pieces.init_data_size); |
1403 | } | 1403 | } |
1404 | 1404 | ||
1405 | /* Bootstrap instructions */ | 1405 | /* Bootstrap instructions */ |
1406 | IL_DEBUG_INFO(priv, "Copying (but not loading) boot instr len %Zd\n", | 1406 | IL_DEBUG_INFO(il, "Copying (but not loading) boot instr len %Zd\n", |
1407 | pieces.boot_size); | 1407 | pieces.boot_size); |
1408 | memcpy(priv->ucode_boot.v_addr, pieces.boot, pieces.boot_size); | 1408 | memcpy(il->ucode_boot.v_addr, pieces.boot, pieces.boot_size); |
1409 | 1409 | ||
1410 | /* | 1410 | /* |
1411 | * figure out the offset of chain noise reset and gain commands | 1411 | * figure out the offset of chain noise reset and gain commands |
1412 | * base on the size of standard phy calibration commands table size | 1412 | * base on the size of standard phy calibration commands table size |
1413 | */ | 1413 | */ |
1414 | priv->_4965.phy_calib_chain_noise_reset_cmd = | 1414 | il->_4965.phy_calib_chain_noise_reset_cmd = |
1415 | standard_phy_calibration_size; | 1415 | standard_phy_calibration_size; |
1416 | priv->_4965.phy_calib_chain_noise_gain_cmd = | 1416 | il->_4965.phy_calib_chain_noise_gain_cmd = |
1417 | standard_phy_calibration_size + 1; | 1417 | standard_phy_calibration_size + 1; |
1418 | 1418 | ||
1419 | /************************************************** | 1419 | /************************************************** |
@@ -1421,40 +1421,40 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1421 | * | 1421 | * |
1422 | * 9. Setup and register with mac80211 and debugfs | 1422 | * 9. Setup and register with mac80211 and debugfs |
1423 | **************************************************/ | 1423 | **************************************************/ |
1424 | err = il4965_mac_setup_register(priv, max_probe_length); | 1424 | err = il4965_mac_setup_register(il, max_probe_length); |
1425 | if (err) | 1425 | if (err) |
1426 | goto out_unbind; | 1426 | goto out_unbind; |
1427 | 1427 | ||
1428 | err = il_dbgfs_register(priv, DRV_NAME); | 1428 | err = il_dbgfs_register(il, DRV_NAME); |
1429 | if (err) | 1429 | if (err) |
1430 | IL_ERR(priv, | 1430 | IL_ERR(il, |
1431 | "failed to create debugfs files. Ignoring error: %d\n", err); | 1431 | "failed to create debugfs files. Ignoring error: %d\n", err); |
1432 | 1432 | ||
1433 | err = sysfs_create_group(&priv->pci_dev->dev.kobj, | 1433 | err = sysfs_create_group(&il->pci_dev->dev.kobj, |
1434 | &il_attribute_group); | 1434 | &il_attribute_group); |
1435 | if (err) { | 1435 | if (err) { |
1436 | IL_ERR(priv, "failed to create sysfs device attributes\n"); | 1436 | IL_ERR(il, "failed to create sysfs device attributes\n"); |
1437 | goto out_unbind; | 1437 | goto out_unbind; |
1438 | } | 1438 | } |
1439 | 1439 | ||
1440 | /* We have our copies now, allow OS release its copies */ | 1440 | /* We have our copies now, allow OS release its copies */ |
1441 | release_firmware(ucode_raw); | 1441 | release_firmware(ucode_raw); |
1442 | complete(&priv->_4965.firmware_loading_complete); | 1442 | complete(&il->_4965.firmware_loading_complete); |
1443 | return; | 1443 | return; |
1444 | 1444 | ||
1445 | try_again: | 1445 | try_again: |
1446 | /* try next, if any */ | 1446 | /* try next, if any */ |
1447 | if (il4965_request_firmware(priv, false)) | 1447 | if (il4965_request_firmware(il, false)) |
1448 | goto out_unbind; | 1448 | goto out_unbind; |
1449 | release_firmware(ucode_raw); | 1449 | release_firmware(ucode_raw); |
1450 | return; | 1450 | return; |
1451 | 1451 | ||
1452 | err_pci_alloc: | 1452 | err_pci_alloc: |
1453 | IL_ERR(priv, "failed to allocate pci memory\n"); | 1453 | IL_ERR(il, "failed to allocate pci memory\n"); |
1454 | il4965_dealloc_ucode_pci(priv); | 1454 | il4965_dealloc_ucode_pci(il); |
1455 | out_unbind: | 1455 | out_unbind: |
1456 | complete(&priv->_4965.firmware_loading_complete); | 1456 | complete(&il->_4965.firmware_loading_complete); |
1457 | device_release_driver(&priv->pci_dev->dev); | 1457 | device_release_driver(&il->pci_dev->dev); |
1458 | release_firmware(ucode_raw); | 1458 | release_firmware(ucode_raw); |
1459 | } | 1459 | } |
1460 | 1460 | ||
@@ -1527,79 +1527,79 @@ static const char *il4965_desc_lookup(u32 num) | |||
1527 | #define ERROR_START_OFFSET (1 * sizeof(u32)) | 1527 | #define ERROR_START_OFFSET (1 * sizeof(u32)) |
1528 | #define ERROR_ELEM_SIZE (7 * sizeof(u32)) | 1528 | #define ERROR_ELEM_SIZE (7 * sizeof(u32)) |
1529 | 1529 | ||
1530 | void il4965_dump_nic_error_log(struct il_priv *priv) | 1530 | void il4965_dump_nic_error_log(struct il_priv *il) |
1531 | { | 1531 | { |
1532 | u32 data2, line; | 1532 | u32 data2, line; |
1533 | u32 desc, time, count, base, data1; | 1533 | u32 desc, time, count, base, data1; |
1534 | u32 blink1, blink2, ilink1, ilink2; | 1534 | u32 blink1, blink2, ilink1, ilink2; |
1535 | u32 pc, hcmd; | 1535 | u32 pc, hcmd; |
1536 | 1536 | ||
1537 | if (priv->ucode_type == UCODE_INIT) { | 1537 | if (il->ucode_type == UCODE_INIT) { |
1538 | base = le32_to_cpu(priv->card_alive_init.error_event_table_ptr); | 1538 | base = le32_to_cpu(il->card_alive_init.error_event_table_ptr); |
1539 | } else { | 1539 | } else { |
1540 | base = le32_to_cpu(priv->card_alive.error_event_table_ptr); | 1540 | base = le32_to_cpu(il->card_alive.error_event_table_ptr); |
1541 | } | 1541 | } |
1542 | 1542 | ||
1543 | if (!priv->cfg->ops->lib->is_valid_rtc_data_addr(base)) { | 1543 | if (!il->cfg->ops->lib->is_valid_rtc_data_addr(base)) { |
1544 | IL_ERR(priv, | 1544 | IL_ERR(il, |
1545 | "Not valid error log pointer 0x%08X for %s uCode\n", | 1545 | "Not valid error log pointer 0x%08X for %s uCode\n", |
1546 | base, (priv->ucode_type == UCODE_INIT) ? "Init" : "RT"); | 1546 | base, (il->ucode_type == UCODE_INIT) ? "Init" : "RT"); |
1547 | return; | 1547 | return; |
1548 | } | 1548 | } |
1549 | 1549 | ||
1550 | count = il_read_targ_mem(priv, base); | 1550 | count = il_read_targ_mem(il, base); |
1551 | 1551 | ||
1552 | if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { | 1552 | if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { |
1553 | IL_ERR(priv, "Start IWL Error Log Dump:\n"); | 1553 | IL_ERR(il, "Start IWL Error Log Dump:\n"); |
1554 | IL_ERR(priv, "Status: 0x%08lX, count: %d\n", | 1554 | IL_ERR(il, "Status: 0x%08lX, count: %d\n", |
1555 | priv->status, count); | 1555 | il->status, count); |
1556 | } | 1556 | } |
1557 | 1557 | ||
1558 | desc = il_read_targ_mem(priv, base + 1 * sizeof(u32)); | 1558 | desc = il_read_targ_mem(il, base + 1 * sizeof(u32)); |
1559 | priv->isr_stats.err_code = desc; | 1559 | il->isr_stats.err_code = desc; |
1560 | pc = il_read_targ_mem(priv, base + 2 * sizeof(u32)); | 1560 | pc = il_read_targ_mem(il, base + 2 * sizeof(u32)); |
1561 | blink1 = il_read_targ_mem(priv, base + 3 * sizeof(u32)); | 1561 | blink1 = il_read_targ_mem(il, base + 3 * sizeof(u32)); |
1562 | blink2 = il_read_targ_mem(priv, base + 4 * sizeof(u32)); | 1562 | blink2 = il_read_targ_mem(il, base + 4 * sizeof(u32)); |
1563 | ilink1 = il_read_targ_mem(priv, base + 5 * sizeof(u32)); | 1563 | ilink1 = il_read_targ_mem(il, base + 5 * sizeof(u32)); |
1564 | ilink2 = il_read_targ_mem(priv, base + 6 * sizeof(u32)); | 1564 | ilink2 = il_read_targ_mem(il, base + 6 * sizeof(u32)); |
1565 | data1 = il_read_targ_mem(priv, base + 7 * sizeof(u32)); | 1565 | data1 = il_read_targ_mem(il, base + 7 * sizeof(u32)); |
1566 | data2 = il_read_targ_mem(priv, base + 8 * sizeof(u32)); | 1566 | data2 = il_read_targ_mem(il, base + 8 * sizeof(u32)); |
1567 | line = il_read_targ_mem(priv, base + 9 * sizeof(u32)); | 1567 | line = il_read_targ_mem(il, base + 9 * sizeof(u32)); |
1568 | time = il_read_targ_mem(priv, base + 11 * sizeof(u32)); | 1568 | time = il_read_targ_mem(il, base + 11 * sizeof(u32)); |
1569 | hcmd = il_read_targ_mem(priv, base + 22 * sizeof(u32)); | 1569 | hcmd = il_read_targ_mem(il, base + 22 * sizeof(u32)); |
1570 | 1570 | ||
1571 | IL_ERR(priv, "Desc Time " | 1571 | IL_ERR(il, "Desc Time " |
1572 | "data1 data2 line\n"); | 1572 | "data1 data2 line\n"); |
1573 | IL_ERR(priv, "%-28s (0x%04X) %010u 0x%08X 0x%08X %u\n", | 1573 | IL_ERR(il, "%-28s (0x%04X) %010u 0x%08X 0x%08X %u\n", |
1574 | il4965_desc_lookup(desc), desc, time, data1, data2, line); | 1574 | il4965_desc_lookup(desc), desc, time, data1, data2, line); |
1575 | IL_ERR(priv, "pc blink1 blink2 ilink1 ilink2 hcmd\n"); | 1575 | IL_ERR(il, "pc blink1 blink2 ilink1 ilink2 hcmd\n"); |
1576 | IL_ERR(priv, "0x%05X 0x%05X 0x%05X 0x%05X 0x%05X 0x%05X\n", | 1576 | IL_ERR(il, "0x%05X 0x%05X 0x%05X 0x%05X 0x%05X 0x%05X\n", |
1577 | pc, blink1, blink2, ilink1, ilink2, hcmd); | 1577 | pc, blink1, blink2, ilink1, ilink2, hcmd); |
1578 | } | 1578 | } |
1579 | 1579 | ||
1580 | static void il4965_rf_kill_ct_config(struct il_priv *priv) | 1580 | static void il4965_rf_kill_ct_config(struct il_priv *il) |
1581 | { | 1581 | { |
1582 | struct il_ct_kill_config cmd; | 1582 | struct il_ct_kill_config cmd; |
1583 | unsigned long flags; | 1583 | unsigned long flags; |
1584 | int ret = 0; | 1584 | int ret = 0; |
1585 | 1585 | ||
1586 | spin_lock_irqsave(&priv->lock, flags); | 1586 | spin_lock_irqsave(&il->lock, flags); |
1587 | il_write32(priv, CSR_UCODE_DRV_GP1_CLR, | 1587 | il_write32(il, CSR_UCODE_DRV_GP1_CLR, |
1588 | CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); | 1588 | CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); |
1589 | spin_unlock_irqrestore(&priv->lock, flags); | 1589 | spin_unlock_irqrestore(&il->lock, flags); |
1590 | 1590 | ||
1591 | cmd.critical_temperature_R = | 1591 | cmd.critical_temperature_R = |
1592 | cpu_to_le32(priv->hw_params.ct_kill_threshold); | 1592 | cpu_to_le32(il->hw_params.ct_kill_threshold); |
1593 | 1593 | ||
1594 | ret = il_send_cmd_pdu(priv, REPLY_CT_KILL_CONFIG_CMD, | 1594 | ret = il_send_cmd_pdu(il, REPLY_CT_KILL_CONFIG_CMD, |
1595 | sizeof(cmd), &cmd); | 1595 | sizeof(cmd), &cmd); |
1596 | if (ret) | 1596 | if (ret) |
1597 | IL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n"); | 1597 | IL_ERR(il, "REPLY_CT_KILL_CONFIG_CMD failed\n"); |
1598 | else | 1598 | else |
1599 | IL_DEBUG_INFO(priv, "REPLY_CT_KILL_CONFIG_CMD " | 1599 | IL_DEBUG_INFO(il, "REPLY_CT_KILL_CONFIG_CMD " |
1600 | "succeeded, " | 1600 | "succeeded, " |
1601 | "critical temperature is %d\n", | 1601 | "critical temperature is %d\n", |
1602 | priv->hw_params.ct_kill_threshold); | 1602 | il->hw_params.ct_kill_threshold); |
1603 | } | 1603 | } |
1604 | 1604 | ||
1605 | static const s8 default_queue_to_tx_fifo[] = { | 1605 | static const s8 default_queue_to_tx_fifo[] = { |
@@ -1612,62 +1612,62 @@ static const s8 default_queue_to_tx_fifo[] = { | |||
1612 | IL_TX_FIFO_UNUSED, | 1612 | IL_TX_FIFO_UNUSED, |
1613 | }; | 1613 | }; |
1614 | 1614 | ||
1615 | static int il4965_alive_notify(struct il_priv *priv) | 1615 | static int il4965_alive_notify(struct il_priv *il) |
1616 | { | 1616 | { |
1617 | u32 a; | 1617 | u32 a; |
1618 | unsigned long flags; | 1618 | unsigned long flags; |
1619 | int i, chan; | 1619 | int i, chan; |
1620 | u32 reg_val; | 1620 | u32 reg_val; |
1621 | 1621 | ||
1622 | spin_lock_irqsave(&priv->lock, flags); | 1622 | spin_lock_irqsave(&il->lock, flags); |
1623 | 1623 | ||
1624 | /* Clear 4965's internal Tx Scheduler data base */ | 1624 | /* Clear 4965's internal Tx Scheduler data base */ |
1625 | priv->scd_base_addr = il_read_prph(priv, | 1625 | il->scd_base_addr = il_read_prph(il, |
1626 | IWL49_SCD_SRAM_BASE_ADDR); | 1626 | IWL49_SCD_SRAM_BASE_ADDR); |
1627 | a = priv->scd_base_addr + IWL49_SCD_CONTEXT_DATA_OFFSET; | 1627 | a = il->scd_base_addr + IWL49_SCD_CONTEXT_DATA_OFFSET; |
1628 | for (; a < priv->scd_base_addr + IWL49_SCD_TX_STTS_BITMAP_OFFSET; a += 4) | 1628 | for (; a < il->scd_base_addr + IWL49_SCD_TX_STTS_BITMAP_OFFSET; a += 4) |
1629 | il_write_targ_mem(priv, a, 0); | 1629 | il_write_targ_mem(il, a, 0); |
1630 | for (; a < priv->scd_base_addr + IWL49_SCD_TRANSLATE_TBL_OFFSET; a += 4) | 1630 | for (; a < il->scd_base_addr + IWL49_SCD_TRANSLATE_TBL_OFFSET; a += 4) |
1631 | il_write_targ_mem(priv, a, 0); | 1631 | il_write_targ_mem(il, a, 0); |
1632 | for (; a < priv->scd_base_addr + | 1632 | for (; a < il->scd_base_addr + |
1633 | IWL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(priv->hw_params.max_txq_num); a += 4) | 1633 | IWL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(il->hw_params.max_txq_num); a += 4) |
1634 | il_write_targ_mem(priv, a, 0); | 1634 | il_write_targ_mem(il, a, 0); |
1635 | 1635 | ||
1636 | /* Tel 4965 where to find Tx byte count tables */ | 1636 | /* Tel 4965 where to find Tx byte count tables */ |
1637 | il_write_prph(priv, IWL49_SCD_DRAM_BASE_ADDR, | 1637 | il_write_prph(il, IWL49_SCD_DRAM_BASE_ADDR, |
1638 | priv->scd_bc_tbls.dma >> 10); | 1638 | il->scd_bc_tbls.dma >> 10); |
1639 | 1639 | ||
1640 | /* Enable DMA channel */ | 1640 | /* Enable DMA channel */ |
1641 | for (chan = 0; chan < FH49_TCSR_CHNL_NUM ; chan++) | 1641 | for (chan = 0; chan < FH49_TCSR_CHNL_NUM ; chan++) |
1642 | il_write_direct32(priv, | 1642 | il_write_direct32(il, |
1643 | FH_TCSR_CHNL_TX_CONFIG_REG(chan), | 1643 | FH_TCSR_CHNL_TX_CONFIG_REG(chan), |
1644 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | | 1644 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | |
1645 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE); | 1645 | FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE); |
1646 | 1646 | ||
1647 | /* Update FH chicken bits */ | 1647 | /* Update FH chicken bits */ |
1648 | reg_val = il_read_direct32(priv, FH_TX_CHICKEN_BITS_REG); | 1648 | reg_val = il_read_direct32(il, FH_TX_CHICKEN_BITS_REG); |
1649 | il_write_direct32(priv, FH_TX_CHICKEN_BITS_REG, | 1649 | il_write_direct32(il, FH_TX_CHICKEN_BITS_REG, |
1650 | reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN); | 1650 | reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN); |
1651 | 1651 | ||
1652 | /* Disable chain mode for all queues */ | 1652 | /* Disable chain mode for all queues */ |
1653 | il_write_prph(priv, IWL49_SCD_QUEUECHAIN_SEL, 0); | 1653 | il_write_prph(il, IWL49_SCD_QUEUECHAIN_SEL, 0); |
1654 | 1654 | ||
1655 | /* Initialize each Tx queue (including the command queue) */ | 1655 | /* Initialize each Tx queue (including the command queue) */ |
1656 | for (i = 0; i < priv->hw_params.max_txq_num; i++) { | 1656 | for (i = 0; i < il->hw_params.max_txq_num; i++) { |
1657 | 1657 | ||
1658 | /* TFD circular buffer read/write indexes */ | 1658 | /* TFD circular buffer read/write indexes */ |
1659 | il_write_prph(priv, IWL49_SCD_QUEUE_RDPTR(i), 0); | 1659 | il_write_prph(il, IWL49_SCD_QUEUE_RDPTR(i), 0); |
1660 | il_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8)); | 1660 | il_write_direct32(il, HBUS_TARG_WRPTR, 0 | (i << 8)); |
1661 | 1661 | ||
1662 | /* Max Tx Window size for Scheduler-ACK mode */ | 1662 | /* Max Tx Window size for Scheduler-ACK mode */ |
1663 | il_write_targ_mem(priv, priv->scd_base_addr + | 1663 | il_write_targ_mem(il, il->scd_base_addr + |
1664 | IWL49_SCD_CONTEXT_QUEUE_OFFSET(i), | 1664 | IWL49_SCD_CONTEXT_QUEUE_OFFSET(i), |
1665 | (SCD_WIN_SIZE << | 1665 | (SCD_WIN_SIZE << |
1666 | IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & | 1666 | IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & |
1667 | IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK); | 1667 | IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK); |
1668 | 1668 | ||
1669 | /* Frame limit */ | 1669 | /* Frame limit */ |
1670 | il_write_targ_mem(priv, priv->scd_base_addr + | 1670 | il_write_targ_mem(il, il->scd_base_addr + |
1671 | IWL49_SCD_CONTEXT_QUEUE_OFFSET(i) + | 1671 | IWL49_SCD_CONTEXT_QUEUE_OFFSET(i) + |
1672 | sizeof(u32), | 1672 | sizeof(u32), |
1673 | (SCD_FRAME_LIMIT << | 1673 | (SCD_FRAME_LIMIT << |
@@ -1675,36 +1675,36 @@ static int il4965_alive_notify(struct il_priv *priv) | |||
1675 | IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); | 1675 | IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); |
1676 | 1676 | ||
1677 | } | 1677 | } |
1678 | il_write_prph(priv, IWL49_SCD_INTERRUPT_MASK, | 1678 | il_write_prph(il, IWL49_SCD_INTERRUPT_MASK, |
1679 | (1 << priv->hw_params.max_txq_num) - 1); | 1679 | (1 << il->hw_params.max_txq_num) - 1); |
1680 | 1680 | ||
1681 | /* Activate all Tx DMA/FIFO channels */ | 1681 | /* Activate all Tx DMA/FIFO channels */ |
1682 | il4965_txq_set_sched(priv, IL_MASK(0, 6)); | 1682 | il4965_txq_set_sched(il, IL_MASK(0, 6)); |
1683 | 1683 | ||
1684 | il4965_set_wr_ptrs(priv, IL_DEFAULT_CMD_QUEUE_NUM, 0); | 1684 | il4965_set_wr_ptrs(il, IL_DEFAULT_CMD_QUEUE_NUM, 0); |
1685 | 1685 | ||
1686 | /* make sure all queue are not stopped */ | 1686 | /* make sure all queue are not stopped */ |
1687 | memset(&priv->queue_stopped[0], 0, sizeof(priv->queue_stopped)); | 1687 | memset(&il->queue_stopped[0], 0, sizeof(il->queue_stopped)); |
1688 | for (i = 0; i < 4; i++) | 1688 | for (i = 0; i < 4; i++) |
1689 | atomic_set(&priv->queue_stop_count[i], 0); | 1689 | atomic_set(&il->queue_stop_count[i], 0); |
1690 | 1690 | ||
1691 | /* reset to 0 to enable all the queue first */ | 1691 | /* reset to 0 to enable all the queue first */ |
1692 | priv->txq_ctx_active_msk = 0; | 1692 | il->txq_ctx_active_msk = 0; |
1693 | /* Map each Tx/cmd queue to its corresponding fifo */ | 1693 | /* Map each Tx/cmd queue to its corresponding fifo */ |
1694 | BUILD_BUG_ON(ARRAY_SIZE(default_queue_to_tx_fifo) != 7); | 1694 | BUILD_BUG_ON(ARRAY_SIZE(default_queue_to_tx_fifo) != 7); |
1695 | 1695 | ||
1696 | for (i = 0; i < ARRAY_SIZE(default_queue_to_tx_fifo); i++) { | 1696 | for (i = 0; i < ARRAY_SIZE(default_queue_to_tx_fifo); i++) { |
1697 | int ac = default_queue_to_tx_fifo[i]; | 1697 | int ac = default_queue_to_tx_fifo[i]; |
1698 | 1698 | ||
1699 | il_txq_ctx_activate(priv, i); | 1699 | il_txq_ctx_activate(il, i); |
1700 | 1700 | ||
1701 | if (ac == IL_TX_FIFO_UNUSED) | 1701 | if (ac == IL_TX_FIFO_UNUSED) |
1702 | continue; | 1702 | continue; |
1703 | 1703 | ||
1704 | il4965_tx_queue_set_status(priv, &priv->txq[i], ac, 0); | 1704 | il4965_tx_queue_set_status(il, &il->txq[i], ac, 0); |
1705 | } | 1705 | } |
1706 | 1706 | ||
1707 | spin_unlock_irqrestore(&priv->lock, flags); | 1707 | spin_unlock_irqrestore(&il->lock, flags); |
1708 | 1708 | ||
1709 | return 0; | 1709 | return 0; |
1710 | } | 1710 | } |
@@ -1714,50 +1714,50 @@ static int il4965_alive_notify(struct il_priv *priv) | |||
1714 | * from protocol/runtime uCode (initialization uCode's | 1714 | * from protocol/runtime uCode (initialization uCode's |
1715 | * Alive gets handled by il_init_alive_start()). | 1715 | * Alive gets handled by il_init_alive_start()). |
1716 | */ | 1716 | */ |
1717 | static void il4965_alive_start(struct il_priv *priv) | 1717 | static void il4965_alive_start(struct il_priv *il) |
1718 | { | 1718 | { |
1719 | int ret = 0; | 1719 | int ret = 0; |
1720 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 1720 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
1721 | 1721 | ||
1722 | IL_DEBUG_INFO(priv, "Runtime Alive received.\n"); | 1722 | IL_DEBUG_INFO(il, "Runtime Alive received.\n"); |
1723 | 1723 | ||
1724 | if (priv->card_alive.is_valid != UCODE_VALID_OK) { | 1724 | if (il->card_alive.is_valid != UCODE_VALID_OK) { |
1725 | /* We had an error bringing up the hardware, so take it | 1725 | /* We had an error bringing up the hardware, so take it |
1726 | * all the way back down so we can try again */ | 1726 | * all the way back down so we can try again */ |
1727 | IL_DEBUG_INFO(priv, "Alive failed.\n"); | 1727 | IL_DEBUG_INFO(il, "Alive failed.\n"); |
1728 | goto restart; | 1728 | goto restart; |
1729 | } | 1729 | } |
1730 | 1730 | ||
1731 | /* Initialize uCode has loaded Runtime uCode ... verify inst image. | 1731 | /* Initialize uCode has loaded Runtime uCode ... verify inst image. |
1732 | * This is a paranoid check, because we would not have gotten the | 1732 | * This is a paranoid check, because we would not have gotten the |
1733 | * "runtime" alive if code weren't properly loaded. */ | 1733 | * "runtime" alive if code weren't properly loaded. */ |
1734 | if (il4965_verify_ucode(priv)) { | 1734 | if (il4965_verify_ucode(il)) { |
1735 | /* Runtime instruction load was bad; | 1735 | /* Runtime instruction load was bad; |
1736 | * take it all the way back down so we can try again */ | 1736 | * take it all the way back down so we can try again */ |
1737 | IL_DEBUG_INFO(priv, "Bad runtime uCode load.\n"); | 1737 | IL_DEBUG_INFO(il, "Bad runtime uCode load.\n"); |
1738 | goto restart; | 1738 | goto restart; |
1739 | } | 1739 | } |
1740 | 1740 | ||
1741 | ret = il4965_alive_notify(priv); | 1741 | ret = il4965_alive_notify(il); |
1742 | if (ret) { | 1742 | if (ret) { |
1743 | IL_WARN(priv, | 1743 | IL_WARN(il, |
1744 | "Could not complete ALIVE transition [ntf]: %d\n", ret); | 1744 | "Could not complete ALIVE transition [ntf]: %d\n", ret); |
1745 | goto restart; | 1745 | goto restart; |
1746 | } | 1746 | } |
1747 | 1747 | ||
1748 | 1748 | ||
1749 | /* After the ALIVE response, we can send host commands to the uCode */ | 1749 | /* After the ALIVE response, we can send host commands to the uCode */ |
1750 | set_bit(STATUS_ALIVE, &priv->status); | 1750 | set_bit(STATUS_ALIVE, &il->status); |
1751 | 1751 | ||
1752 | /* Enable watchdog to monitor the driver tx queues */ | 1752 | /* Enable watchdog to monitor the driver tx queues */ |
1753 | il_setup_watchdog(priv); | 1753 | il_setup_watchdog(il); |
1754 | 1754 | ||
1755 | if (il_is_rfkill(priv)) | 1755 | if (il_is_rfkill(il)) |
1756 | return; | 1756 | return; |
1757 | 1757 | ||
1758 | ieee80211_wake_queues(priv->hw); | 1758 | ieee80211_wake_queues(il->hw); |
1759 | 1759 | ||
1760 | priv->active_rate = IL_RATES_MASK; | 1760 | il->active_rate = IL_RATES_MASK; |
1761 | 1761 | ||
1762 | if (il_is_associated_ctx(ctx)) { | 1762 | if (il_is_associated_ctx(ctx)) { |
1763 | struct il_rxon_cmd *active_rxon = | 1763 | struct il_rxon_cmd *active_rxon = |
@@ -1768,290 +1768,290 @@ static void il4965_alive_start(struct il_priv *priv) | |||
1768 | } else { | 1768 | } else { |
1769 | struct il_rxon_context *tmp; | 1769 | struct il_rxon_context *tmp; |
1770 | /* Initialize our rx_config data */ | 1770 | /* Initialize our rx_config data */ |
1771 | for_each_context(priv, tmp) | 1771 | for_each_context(il, tmp) |
1772 | il_connection_init_rx_config(priv, tmp); | 1772 | il_connection_init_rx_config(il, tmp); |
1773 | 1773 | ||
1774 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 1774 | if (il->cfg->ops->hcmd->set_rxon_chain) |
1775 | priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx); | 1775 | il->cfg->ops->hcmd->set_rxon_chain(il, ctx); |
1776 | } | 1776 | } |
1777 | 1777 | ||
1778 | /* Configure bluetooth coexistence if enabled */ | 1778 | /* Configure bluetooth coexistence if enabled */ |
1779 | il_send_bt_config(priv); | 1779 | il_send_bt_config(il); |
1780 | 1780 | ||
1781 | il4965_reset_run_time_calib(priv); | 1781 | il4965_reset_run_time_calib(il); |
1782 | 1782 | ||
1783 | set_bit(STATUS_READY, &priv->status); | 1783 | set_bit(STATUS_READY, &il->status); |
1784 | 1784 | ||
1785 | /* Configure the adapter for unassociated operation */ | 1785 | /* Configure the adapter for unassociated operation */ |
1786 | il_commit_rxon(priv, ctx); | 1786 | il_commit_rxon(il, ctx); |
1787 | 1787 | ||
1788 | /* At this point, the NIC is initialized and operational */ | 1788 | /* At this point, the NIC is initialized and operational */ |
1789 | il4965_rf_kill_ct_config(priv); | 1789 | il4965_rf_kill_ct_config(il); |
1790 | 1790 | ||
1791 | IL_DEBUG_INFO(priv, "ALIVE processing complete.\n"); | 1791 | IL_DEBUG_INFO(il, "ALIVE processing complete.\n"); |
1792 | wake_up(&priv->wait_command_queue); | 1792 | wake_up(&il->wait_command_queue); |
1793 | 1793 | ||
1794 | il_power_update_mode(priv, true); | 1794 | il_power_update_mode(il, true); |
1795 | IL_DEBUG_INFO(priv, "Updated power mode\n"); | 1795 | IL_DEBUG_INFO(il, "Updated power mode\n"); |
1796 | 1796 | ||
1797 | return; | 1797 | return; |
1798 | 1798 | ||
1799 | restart: | 1799 | restart: |
1800 | queue_work(priv->workqueue, &priv->restart); | 1800 | queue_work(il->workqueue, &il->restart); |
1801 | } | 1801 | } |
1802 | 1802 | ||
1803 | static void il4965_cancel_deferred_work(struct il_priv *priv); | 1803 | static void il4965_cancel_deferred_work(struct il_priv *il); |
1804 | 1804 | ||
1805 | static void __il4965_down(struct il_priv *priv) | 1805 | static void __il4965_down(struct il_priv *il) |
1806 | { | 1806 | { |
1807 | unsigned long flags; | 1807 | unsigned long flags; |
1808 | int exit_pending; | 1808 | int exit_pending; |
1809 | 1809 | ||
1810 | IL_DEBUG_INFO(priv, DRV_NAME " is going down\n"); | 1810 | IL_DEBUG_INFO(il, DRV_NAME " is going down\n"); |
1811 | 1811 | ||
1812 | il_scan_cancel_timeout(priv, 200); | 1812 | il_scan_cancel_timeout(il, 200); |
1813 | 1813 | ||
1814 | exit_pending = test_and_set_bit(STATUS_EXIT_PENDING, &priv->status); | 1814 | exit_pending = test_and_set_bit(STATUS_EXIT_PENDING, &il->status); |
1815 | 1815 | ||
1816 | /* Stop TX queues watchdog. We need to have STATUS_EXIT_PENDING bit set | 1816 | /* Stop TX queues watchdog. We need to have STATUS_EXIT_PENDING bit set |
1817 | * to prevent rearm timer */ | 1817 | * to prevent rearm timer */ |
1818 | del_timer_sync(&priv->watchdog); | 1818 | del_timer_sync(&il->watchdog); |
1819 | 1819 | ||
1820 | il_clear_ucode_stations(priv, NULL); | 1820 | il_clear_ucode_stations(il, NULL); |
1821 | il_dealloc_bcast_stations(priv); | 1821 | il_dealloc_bcast_stations(il); |
1822 | il_clear_driver_stations(priv); | 1822 | il_clear_driver_stations(il); |
1823 | 1823 | ||
1824 | /* Unblock any waiting calls */ | 1824 | /* Unblock any waiting calls */ |
1825 | wake_up_all(&priv->wait_command_queue); | 1825 | wake_up_all(&il->wait_command_queue); |
1826 | 1826 | ||
1827 | /* Wipe out the EXIT_PENDING status bit if we are not actually | 1827 | /* Wipe out the EXIT_PENDING status bit if we are not actually |
1828 | * exiting the module */ | 1828 | * exiting the module */ |
1829 | if (!exit_pending) | 1829 | if (!exit_pending) |
1830 | clear_bit(STATUS_EXIT_PENDING, &priv->status); | 1830 | clear_bit(STATUS_EXIT_PENDING, &il->status); |
1831 | 1831 | ||
1832 | /* stop and reset the on-board processor */ | 1832 | /* stop and reset the on-board processor */ |
1833 | il_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); | 1833 | il_write32(il, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); |
1834 | 1834 | ||
1835 | /* tell the device to stop sending interrupts */ | 1835 | /* tell the device to stop sending interrupts */ |
1836 | spin_lock_irqsave(&priv->lock, flags); | 1836 | spin_lock_irqsave(&il->lock, flags); |
1837 | il_disable_interrupts(priv); | 1837 | il_disable_interrupts(il); |
1838 | spin_unlock_irqrestore(&priv->lock, flags); | 1838 | spin_unlock_irqrestore(&il->lock, flags); |
1839 | il4965_synchronize_irq(priv); | 1839 | il4965_synchronize_irq(il); |
1840 | 1840 | ||
1841 | if (priv->mac80211_registered) | 1841 | if (il->mac80211_registered) |
1842 | ieee80211_stop_queues(priv->hw); | 1842 | ieee80211_stop_queues(il->hw); |
1843 | 1843 | ||
1844 | /* If we have not previously called il_init() then | 1844 | /* If we have not previously called il_init() then |
1845 | * clear all bits but the RF Kill bit and return */ | 1845 | * clear all bits but the RF Kill bit and return */ |
1846 | if (!il_is_init(priv)) { | 1846 | if (!il_is_init(il)) { |
1847 | priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << | 1847 | il->status = test_bit(STATUS_RF_KILL_HW, &il->status) << |
1848 | STATUS_RF_KILL_HW | | 1848 | STATUS_RF_KILL_HW | |
1849 | test_bit(STATUS_GEO_CONFIGURED, &priv->status) << | 1849 | test_bit(STATUS_GEO_CONFIGURED, &il->status) << |
1850 | STATUS_GEO_CONFIGURED | | 1850 | STATUS_GEO_CONFIGURED | |
1851 | test_bit(STATUS_EXIT_PENDING, &priv->status) << | 1851 | test_bit(STATUS_EXIT_PENDING, &il->status) << |
1852 | STATUS_EXIT_PENDING; | 1852 | STATUS_EXIT_PENDING; |
1853 | goto exit; | 1853 | goto exit; |
1854 | } | 1854 | } |
1855 | 1855 | ||
1856 | /* ...otherwise clear out all the status bits but the RF Kill | 1856 | /* ...otherwise clear out all the status bits but the RF Kill |
1857 | * bit and continue taking the NIC down. */ | 1857 | * bit and continue taking the NIC down. */ |
1858 | priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) << | 1858 | il->status &= test_bit(STATUS_RF_KILL_HW, &il->status) << |
1859 | STATUS_RF_KILL_HW | | 1859 | STATUS_RF_KILL_HW | |
1860 | test_bit(STATUS_GEO_CONFIGURED, &priv->status) << | 1860 | test_bit(STATUS_GEO_CONFIGURED, &il->status) << |
1861 | STATUS_GEO_CONFIGURED | | 1861 | STATUS_GEO_CONFIGURED | |
1862 | test_bit(STATUS_FW_ERROR, &priv->status) << | 1862 | test_bit(STATUS_FW_ERROR, &il->status) << |
1863 | STATUS_FW_ERROR | | 1863 | STATUS_FW_ERROR | |
1864 | test_bit(STATUS_EXIT_PENDING, &priv->status) << | 1864 | test_bit(STATUS_EXIT_PENDING, &il->status) << |
1865 | STATUS_EXIT_PENDING; | 1865 | STATUS_EXIT_PENDING; |
1866 | 1866 | ||
1867 | il4965_txq_ctx_stop(priv); | 1867 | il4965_txq_ctx_stop(il); |
1868 | il4965_rxq_stop(priv); | 1868 | il4965_rxq_stop(il); |
1869 | 1869 | ||
1870 | /* Power-down device's busmaster DMA clocks */ | 1870 | /* Power-down device's busmaster DMA clocks */ |
1871 | il_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); | 1871 | il_write_prph(il, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); |
1872 | udelay(5); | 1872 | udelay(5); |
1873 | 1873 | ||
1874 | /* Make sure (redundant) we've released our request to stay awake */ | 1874 | /* Make sure (redundant) we've released our request to stay awake */ |
1875 | il_clear_bit(priv, CSR_GP_CNTRL, | 1875 | il_clear_bit(il, CSR_GP_CNTRL, |
1876 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); | 1876 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); |
1877 | 1877 | ||
1878 | /* Stop the device, and put it in low power state */ | 1878 | /* Stop the device, and put it in low power state */ |
1879 | il_apm_stop(priv); | 1879 | il_apm_stop(il); |
1880 | 1880 | ||
1881 | exit: | 1881 | exit: |
1882 | memset(&priv->card_alive, 0, sizeof(struct il_alive_resp)); | 1882 | memset(&il->card_alive, 0, sizeof(struct il_alive_resp)); |
1883 | 1883 | ||
1884 | dev_kfree_skb(priv->beacon_skb); | 1884 | dev_kfree_skb(il->beacon_skb); |
1885 | priv->beacon_skb = NULL; | 1885 | il->beacon_skb = NULL; |
1886 | 1886 | ||
1887 | /* clear out any free frames */ | 1887 | /* clear out any free frames */ |
1888 | il4965_clear_free_frames(priv); | 1888 | il4965_clear_free_frames(il); |
1889 | } | 1889 | } |
1890 | 1890 | ||
1891 | static void il4965_down(struct il_priv *priv) | 1891 | static void il4965_down(struct il_priv *il) |
1892 | { | 1892 | { |
1893 | mutex_lock(&priv->mutex); | 1893 | mutex_lock(&il->mutex); |
1894 | __il4965_down(priv); | 1894 | __il4965_down(il); |
1895 | mutex_unlock(&priv->mutex); | 1895 | mutex_unlock(&il->mutex); |
1896 | 1896 | ||
1897 | il4965_cancel_deferred_work(priv); | 1897 | il4965_cancel_deferred_work(il); |
1898 | } | 1898 | } |
1899 | 1899 | ||
1900 | #define HW_READY_TIMEOUT (50) | 1900 | #define HW_READY_TIMEOUT (50) |
1901 | 1901 | ||
1902 | static int il4965_set_hw_ready(struct il_priv *priv) | 1902 | static int il4965_set_hw_ready(struct il_priv *il) |
1903 | { | 1903 | { |
1904 | int ret = 0; | 1904 | int ret = 0; |
1905 | 1905 | ||
1906 | il_set_bit(priv, CSR_HW_IF_CONFIG_REG, | 1906 | il_set_bit(il, CSR_HW_IF_CONFIG_REG, |
1907 | CSR_HW_IF_CONFIG_REG_BIT_NIC_READY); | 1907 | CSR_HW_IF_CONFIG_REG_BIT_NIC_READY); |
1908 | 1908 | ||
1909 | /* See if we got it */ | 1909 | /* See if we got it */ |
1910 | ret = il_poll_bit(priv, CSR_HW_IF_CONFIG_REG, | 1910 | ret = il_poll_bit(il, CSR_HW_IF_CONFIG_REG, |
1911 | CSR_HW_IF_CONFIG_REG_BIT_NIC_READY, | 1911 | CSR_HW_IF_CONFIG_REG_BIT_NIC_READY, |
1912 | CSR_HW_IF_CONFIG_REG_BIT_NIC_READY, | 1912 | CSR_HW_IF_CONFIG_REG_BIT_NIC_READY, |
1913 | HW_READY_TIMEOUT); | 1913 | HW_READY_TIMEOUT); |
1914 | if (ret != -ETIMEDOUT) | 1914 | if (ret != -ETIMEDOUT) |
1915 | priv->hw_ready = true; | 1915 | il->hw_ready = true; |
1916 | else | 1916 | else |
1917 | priv->hw_ready = false; | 1917 | il->hw_ready = false; |
1918 | 1918 | ||
1919 | IL_DEBUG_INFO(priv, "hardware %s\n", | 1919 | IL_DEBUG_INFO(il, "hardware %s\n", |
1920 | (priv->hw_ready == 1) ? "ready" : "not ready"); | 1920 | (il->hw_ready == 1) ? "ready" : "not ready"); |
1921 | return ret; | 1921 | return ret; |
1922 | } | 1922 | } |
1923 | 1923 | ||
1924 | static int il4965_prepare_card_hw(struct il_priv *priv) | 1924 | static int il4965_prepare_card_hw(struct il_priv *il) |
1925 | { | 1925 | { |
1926 | int ret = 0; | 1926 | int ret = 0; |
1927 | 1927 | ||
1928 | IL_DEBUG_INFO(priv, "il4965_prepare_card_hw enter\n"); | 1928 | IL_DEBUG_INFO(il, "il4965_prepare_card_hw enter\n"); |
1929 | 1929 | ||
1930 | ret = il4965_set_hw_ready(priv); | 1930 | ret = il4965_set_hw_ready(il); |
1931 | if (priv->hw_ready) | 1931 | if (il->hw_ready) |
1932 | return ret; | 1932 | return ret; |
1933 | 1933 | ||
1934 | /* If HW is not ready, prepare the conditions to check again */ | 1934 | /* If HW is not ready, prepare the conditions to check again */ |
1935 | il_set_bit(priv, CSR_HW_IF_CONFIG_REG, | 1935 | il_set_bit(il, CSR_HW_IF_CONFIG_REG, |
1936 | CSR_HW_IF_CONFIG_REG_PREPARE); | 1936 | CSR_HW_IF_CONFIG_REG_PREPARE); |
1937 | 1937 | ||
1938 | ret = il_poll_bit(priv, CSR_HW_IF_CONFIG_REG, | 1938 | ret = il_poll_bit(il, CSR_HW_IF_CONFIG_REG, |
1939 | ~CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, | 1939 | ~CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, |
1940 | CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, 150000); | 1940 | CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, 150000); |
1941 | 1941 | ||
1942 | /* HW should be ready by now, check again. */ | 1942 | /* HW should be ready by now, check again. */ |
1943 | if (ret != -ETIMEDOUT) | 1943 | if (ret != -ETIMEDOUT) |
1944 | il4965_set_hw_ready(priv); | 1944 | il4965_set_hw_ready(il); |
1945 | 1945 | ||
1946 | return ret; | 1946 | return ret; |
1947 | } | 1947 | } |
1948 | 1948 | ||
1949 | #define MAX_HW_RESTARTS 5 | 1949 | #define MAX_HW_RESTARTS 5 |
1950 | 1950 | ||
1951 | static int __il4965_up(struct il_priv *priv) | 1951 | static int __il4965_up(struct il_priv *il) |
1952 | { | 1952 | { |
1953 | struct il_rxon_context *ctx; | 1953 | struct il_rxon_context *ctx; |
1954 | int i; | 1954 | int i; |
1955 | int ret; | 1955 | int ret; |
1956 | 1956 | ||
1957 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { | 1957 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) { |
1958 | IL_WARN(priv, "Exit pending; will not bring the NIC up\n"); | 1958 | IL_WARN(il, "Exit pending; will not bring the NIC up\n"); |
1959 | return -EIO; | 1959 | return -EIO; |
1960 | } | 1960 | } |
1961 | 1961 | ||
1962 | if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) { | 1962 | if (!il->ucode_data_backup.v_addr || !il->ucode_data.v_addr) { |
1963 | IL_ERR(priv, "ucode not available for device bringup\n"); | 1963 | IL_ERR(il, "ucode not available for device bringup\n"); |
1964 | return -EIO; | 1964 | return -EIO; |
1965 | } | 1965 | } |
1966 | 1966 | ||
1967 | for_each_context(priv, ctx) { | 1967 | for_each_context(il, ctx) { |
1968 | ret = il4965_alloc_bcast_station(priv, ctx); | 1968 | ret = il4965_alloc_bcast_station(il, ctx); |
1969 | if (ret) { | 1969 | if (ret) { |
1970 | il_dealloc_bcast_stations(priv); | 1970 | il_dealloc_bcast_stations(il); |
1971 | return ret; | 1971 | return ret; |
1972 | } | 1972 | } |
1973 | } | 1973 | } |
1974 | 1974 | ||
1975 | il4965_prepare_card_hw(priv); | 1975 | il4965_prepare_card_hw(il); |
1976 | 1976 | ||
1977 | if (!priv->hw_ready) { | 1977 | if (!il->hw_ready) { |
1978 | IL_WARN(priv, "Exit HW not ready\n"); | 1978 | IL_WARN(il, "Exit HW not ready\n"); |
1979 | return -EIO; | 1979 | return -EIO; |
1980 | } | 1980 | } |
1981 | 1981 | ||
1982 | /* If platform's RF_KILL switch is NOT set to KILL */ | 1982 | /* If platform's RF_KILL switch is NOT set to KILL */ |
1983 | if (il_read32(priv, | 1983 | if (il_read32(il, |
1984 | CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) | 1984 | CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) |
1985 | clear_bit(STATUS_RF_KILL_HW, &priv->status); | 1985 | clear_bit(STATUS_RF_KILL_HW, &il->status); |
1986 | else | 1986 | else |
1987 | set_bit(STATUS_RF_KILL_HW, &priv->status); | 1987 | set_bit(STATUS_RF_KILL_HW, &il->status); |
1988 | 1988 | ||
1989 | if (il_is_rfkill(priv)) { | 1989 | if (il_is_rfkill(il)) { |
1990 | wiphy_rfkill_set_hw_state(priv->hw->wiphy, true); | 1990 | wiphy_rfkill_set_hw_state(il->hw->wiphy, true); |
1991 | 1991 | ||
1992 | il_enable_interrupts(priv); | 1992 | il_enable_interrupts(il); |
1993 | IL_WARN(priv, "Radio disabled by HW RF Kill switch\n"); | 1993 | IL_WARN(il, "Radio disabled by HW RF Kill switch\n"); |
1994 | return 0; | 1994 | return 0; |
1995 | } | 1995 | } |
1996 | 1996 | ||
1997 | il_write32(priv, CSR_INT, 0xFFFFFFFF); | 1997 | il_write32(il, CSR_INT, 0xFFFFFFFF); |
1998 | 1998 | ||
1999 | /* must be initialised before il_hw_nic_init */ | 1999 | /* must be initialised before il_hw_nic_init */ |
2000 | priv->cmd_queue = IL_DEFAULT_CMD_QUEUE_NUM; | 2000 | il->cmd_queue = IL_DEFAULT_CMD_QUEUE_NUM; |
2001 | 2001 | ||
2002 | ret = il4965_hw_nic_init(priv); | 2002 | ret = il4965_hw_nic_init(il); |
2003 | if (ret) { | 2003 | if (ret) { |
2004 | IL_ERR(priv, "Unable to init nic\n"); | 2004 | IL_ERR(il, "Unable to init nic\n"); |
2005 | return ret; | 2005 | return ret; |
2006 | } | 2006 | } |
2007 | 2007 | ||
2008 | /* make sure rfkill handshake bits are cleared */ | 2008 | /* make sure rfkill handshake bits are cleared */ |
2009 | il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); | 2009 | il_write32(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); |
2010 | il_write32(priv, CSR_UCODE_DRV_GP1_CLR, | 2010 | il_write32(il, CSR_UCODE_DRV_GP1_CLR, |
2011 | CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); | 2011 | CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); |
2012 | 2012 | ||
2013 | /* clear (again), then enable host interrupts */ | 2013 | /* clear (again), then enable host interrupts */ |
2014 | il_write32(priv, CSR_INT, 0xFFFFFFFF); | 2014 | il_write32(il, CSR_INT, 0xFFFFFFFF); |
2015 | il_enable_interrupts(priv); | 2015 | il_enable_interrupts(il); |
2016 | 2016 | ||
2017 | /* really make sure rfkill handshake bits are cleared */ | 2017 | /* really make sure rfkill handshake bits are cleared */ |
2018 | il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); | 2018 | il_write32(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); |
2019 | il_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); | 2019 | il_write32(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); |
2020 | 2020 | ||
2021 | /* Copy original ucode data image from disk into backup cache. | 2021 | /* Copy original ucode data image from disk into backup cache. |
2022 | * This will be used to initialize the on-board processor's | 2022 | * This will be used to initialize the on-board processor's |
2023 | * data SRAM for a clean start when the runtime program first loads. */ | 2023 | * data SRAM for a clean start when the runtime program first loads. */ |
2024 | memcpy(priv->ucode_data_backup.v_addr, priv->ucode_data.v_addr, | 2024 | memcpy(il->ucode_data_backup.v_addr, il->ucode_data.v_addr, |
2025 | priv->ucode_data.len); | 2025 | il->ucode_data.len); |
2026 | 2026 | ||
2027 | for (i = 0; i < MAX_HW_RESTARTS; i++) { | 2027 | for (i = 0; i < MAX_HW_RESTARTS; i++) { |
2028 | 2028 | ||
2029 | /* load bootstrap state machine, | 2029 | /* load bootstrap state machine, |
2030 | * load bootstrap program into processor's memory, | 2030 | * load bootstrap program into processor's memory, |
2031 | * prepare to load the "initialize" uCode */ | 2031 | * prepare to load the "initialize" uCode */ |
2032 | ret = priv->cfg->ops->lib->load_ucode(priv); | 2032 | ret = il->cfg->ops->lib->load_ucode(il); |
2033 | 2033 | ||
2034 | if (ret) { | 2034 | if (ret) { |
2035 | IL_ERR(priv, "Unable to set up bootstrap uCode: %d\n", | 2035 | IL_ERR(il, "Unable to set up bootstrap uCode: %d\n", |
2036 | ret); | 2036 | ret); |
2037 | continue; | 2037 | continue; |
2038 | } | 2038 | } |
2039 | 2039 | ||
2040 | /* start card; "initialize" will load runtime ucode */ | 2040 | /* start card; "initialize" will load runtime ucode */ |
2041 | il4965_nic_start(priv); | 2041 | il4965_nic_start(il); |
2042 | 2042 | ||
2043 | IL_DEBUG_INFO(priv, DRV_NAME " is coming up\n"); | 2043 | IL_DEBUG_INFO(il, DRV_NAME " is coming up\n"); |
2044 | 2044 | ||
2045 | return 0; | 2045 | return 0; |
2046 | } | 2046 | } |
2047 | 2047 | ||
2048 | set_bit(STATUS_EXIT_PENDING, &priv->status); | 2048 | set_bit(STATUS_EXIT_PENDING, &il->status); |
2049 | __il4965_down(priv); | 2049 | __il4965_down(il); |
2050 | clear_bit(STATUS_EXIT_PENDING, &priv->status); | 2050 | clear_bit(STATUS_EXIT_PENDING, &il->status); |
2051 | 2051 | ||
2052 | /* tried to restart and config the device for as long as our | 2052 | /* tried to restart and config the device for as long as our |
2053 | * patience could withstand */ | 2053 | * patience could withstand */ |
2054 | IL_ERR(priv, "Unable to initialize device after %d attempts.\n", i); | 2054 | IL_ERR(il, "Unable to initialize device after %d attempts.\n", i); |
2055 | return -EIO; | 2055 | return -EIO; |
2056 | } | 2056 | } |
2057 | 2057 | ||
@@ -2064,100 +2064,100 @@ static int __il4965_up(struct il_priv *priv) | |||
2064 | 2064 | ||
2065 | static void il4965_bg_init_alive_start(struct work_struct *data) | 2065 | static void il4965_bg_init_alive_start(struct work_struct *data) |
2066 | { | 2066 | { |
2067 | struct il_priv *priv = | 2067 | struct il_priv *il = |
2068 | container_of(data, struct il_priv, init_alive_start.work); | 2068 | container_of(data, struct il_priv, init_alive_start.work); |
2069 | 2069 | ||
2070 | mutex_lock(&priv->mutex); | 2070 | mutex_lock(&il->mutex); |
2071 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 2071 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) |
2072 | goto out; | 2072 | goto out; |
2073 | 2073 | ||
2074 | priv->cfg->ops->lib->init_alive_start(priv); | 2074 | il->cfg->ops->lib->init_alive_start(il); |
2075 | out: | 2075 | out: |
2076 | mutex_unlock(&priv->mutex); | 2076 | mutex_unlock(&il->mutex); |
2077 | } | 2077 | } |
2078 | 2078 | ||
2079 | static void il4965_bg_alive_start(struct work_struct *data) | 2079 | static void il4965_bg_alive_start(struct work_struct *data) |
2080 | { | 2080 | { |
2081 | struct il_priv *priv = | 2081 | struct il_priv *il = |
2082 | container_of(data, struct il_priv, alive_start.work); | 2082 | container_of(data, struct il_priv, alive_start.work); |
2083 | 2083 | ||
2084 | mutex_lock(&priv->mutex); | 2084 | mutex_lock(&il->mutex); |
2085 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 2085 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) |
2086 | goto out; | 2086 | goto out; |
2087 | 2087 | ||
2088 | il4965_alive_start(priv); | 2088 | il4965_alive_start(il); |
2089 | out: | 2089 | out: |
2090 | mutex_unlock(&priv->mutex); | 2090 | mutex_unlock(&il->mutex); |
2091 | } | 2091 | } |
2092 | 2092 | ||
2093 | static void il4965_bg_run_time_calib_work(struct work_struct *work) | 2093 | static void il4965_bg_run_time_calib_work(struct work_struct *work) |
2094 | { | 2094 | { |
2095 | struct il_priv *priv = container_of(work, struct il_priv, | 2095 | struct il_priv *il = container_of(work, struct il_priv, |
2096 | run_time_calib_work); | 2096 | run_time_calib_work); |
2097 | 2097 | ||
2098 | mutex_lock(&priv->mutex); | 2098 | mutex_lock(&il->mutex); |
2099 | 2099 | ||
2100 | if (test_bit(STATUS_EXIT_PENDING, &priv->status) || | 2100 | if (test_bit(STATUS_EXIT_PENDING, &il->status) || |
2101 | test_bit(STATUS_SCANNING, &priv->status)) { | 2101 | test_bit(STATUS_SCANNING, &il->status)) { |
2102 | mutex_unlock(&priv->mutex); | 2102 | mutex_unlock(&il->mutex); |
2103 | return; | 2103 | return; |
2104 | } | 2104 | } |
2105 | 2105 | ||
2106 | if (priv->start_calib) { | 2106 | if (il->start_calib) { |
2107 | il4965_chain_noise_calibration(priv, | 2107 | il4965_chain_noise_calibration(il, |
2108 | (void *)&priv->_4965.statistics); | 2108 | (void *)&il->_4965.statistics); |
2109 | il4965_sensitivity_calibration(priv, | 2109 | il4965_sensitivity_calibration(il, |
2110 | (void *)&priv->_4965.statistics); | 2110 | (void *)&il->_4965.statistics); |
2111 | } | 2111 | } |
2112 | 2112 | ||
2113 | mutex_unlock(&priv->mutex); | 2113 | mutex_unlock(&il->mutex); |
2114 | } | 2114 | } |
2115 | 2115 | ||
2116 | static void il4965_bg_restart(struct work_struct *data) | 2116 | static void il4965_bg_restart(struct work_struct *data) |
2117 | { | 2117 | { |
2118 | struct il_priv *priv = container_of(data, struct il_priv, restart); | 2118 | struct il_priv *il = container_of(data, struct il_priv, restart); |
2119 | 2119 | ||
2120 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 2120 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) |
2121 | return; | 2121 | return; |
2122 | 2122 | ||
2123 | if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) { | 2123 | if (test_and_clear_bit(STATUS_FW_ERROR, &il->status)) { |
2124 | struct il_rxon_context *ctx; | 2124 | struct il_rxon_context *ctx; |
2125 | 2125 | ||
2126 | mutex_lock(&priv->mutex); | 2126 | mutex_lock(&il->mutex); |
2127 | for_each_context(priv, ctx) | 2127 | for_each_context(il, ctx) |
2128 | ctx->vif = NULL; | 2128 | ctx->vif = NULL; |
2129 | priv->is_open = 0; | 2129 | il->is_open = 0; |
2130 | 2130 | ||
2131 | __il4965_down(priv); | 2131 | __il4965_down(il); |
2132 | 2132 | ||
2133 | mutex_unlock(&priv->mutex); | 2133 | mutex_unlock(&il->mutex); |
2134 | il4965_cancel_deferred_work(priv); | 2134 | il4965_cancel_deferred_work(il); |
2135 | ieee80211_restart_hw(priv->hw); | 2135 | ieee80211_restart_hw(il->hw); |
2136 | } else { | 2136 | } else { |
2137 | il4965_down(priv); | 2137 | il4965_down(il); |
2138 | 2138 | ||
2139 | mutex_lock(&priv->mutex); | 2139 | mutex_lock(&il->mutex); |
2140 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { | 2140 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) { |
2141 | mutex_unlock(&priv->mutex); | 2141 | mutex_unlock(&il->mutex); |
2142 | return; | 2142 | return; |
2143 | } | 2143 | } |
2144 | 2144 | ||
2145 | __il4965_up(priv); | 2145 | __il4965_up(il); |
2146 | mutex_unlock(&priv->mutex); | 2146 | mutex_unlock(&il->mutex); |
2147 | } | 2147 | } |
2148 | } | 2148 | } |
2149 | 2149 | ||
2150 | static void il4965_bg_rx_replenish(struct work_struct *data) | 2150 | static void il4965_bg_rx_replenish(struct work_struct *data) |
2151 | { | 2151 | { |
2152 | struct il_priv *priv = | 2152 | struct il_priv *il = |
2153 | container_of(data, struct il_priv, rx_replenish); | 2153 | container_of(data, struct il_priv, rx_replenish); |
2154 | 2154 | ||
2155 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 2155 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) |
2156 | return; | 2156 | return; |
2157 | 2157 | ||
2158 | mutex_lock(&priv->mutex); | 2158 | mutex_lock(&il->mutex); |
2159 | il4965_rx_replenish(priv); | 2159 | il4965_rx_replenish(il); |
2160 | mutex_unlock(&priv->mutex); | 2160 | mutex_unlock(&il->mutex); |
2161 | } | 2161 | } |
2162 | 2162 | ||
2163 | /***************************************************************************** | 2163 | /***************************************************************************** |
@@ -2172,11 +2172,11 @@ static void il4965_bg_rx_replenish(struct work_struct *data) | |||
2172 | * Not a mac80211 entry point function, but it fits in with all the | 2172 | * Not a mac80211 entry point function, but it fits in with all the |
2173 | * other mac80211 functions grouped here. | 2173 | * other mac80211 functions grouped here. |
2174 | */ | 2174 | */ |
2175 | static int il4965_mac_setup_register(struct il_priv *priv, | 2175 | static int il4965_mac_setup_register(struct il_priv *il, |
2176 | u32 max_probe_length) | 2176 | u32 max_probe_length) |
2177 | { | 2177 | { |
2178 | int ret; | 2178 | int ret; |
2179 | struct ieee80211_hw *hw = priv->hw; | 2179 | struct ieee80211_hw *hw = il->hw; |
2180 | struct il_rxon_context *ctx; | 2180 | struct il_rxon_context *ctx; |
2181 | 2181 | ||
2182 | hw->rate_control_algorithm = "iwl-4965-rs"; | 2182 | hw->rate_control_algorithm = "iwl-4965-rs"; |
@@ -2188,14 +2188,14 @@ static int il4965_mac_setup_register(struct il_priv *priv, | |||
2188 | IEEE80211_HW_SPECTRUM_MGMT | | 2188 | IEEE80211_HW_SPECTRUM_MGMT | |
2189 | IEEE80211_HW_REPORTS_TX_ACK_STATUS; | 2189 | IEEE80211_HW_REPORTS_TX_ACK_STATUS; |
2190 | 2190 | ||
2191 | if (priv->cfg->sku & IL_SKU_N) | 2191 | if (il->cfg->sku & IL_SKU_N) |
2192 | hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | | 2192 | hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | |
2193 | IEEE80211_HW_SUPPORTS_STATIC_SMPS; | 2193 | IEEE80211_HW_SUPPORTS_STATIC_SMPS; |
2194 | 2194 | ||
2195 | hw->sta_data_size = sizeof(struct il_station_priv); | 2195 | hw->sta_data_size = sizeof(struct il_station_priv); |
2196 | hw->vif_data_size = sizeof(struct il_vif_priv); | 2196 | hw->vif_data_size = sizeof(struct il_vif_priv); |
2197 | 2197 | ||
2198 | for_each_context(priv, ctx) { | 2198 | for_each_context(il, ctx) { |
2199 | hw->wiphy->interface_modes |= ctx->interface_modes; | 2199 | hw->wiphy->interface_modes |= ctx->interface_modes; |
2200 | hw->wiphy->interface_modes |= ctx->exclusive_interface_modes; | 2200 | hw->wiphy->interface_modes |= ctx->exclusive_interface_modes; |
2201 | } | 2201 | } |
@@ -2218,21 +2218,21 @@ static int il4965_mac_setup_register(struct il_priv *priv, | |||
2218 | 2218 | ||
2219 | hw->max_listen_interval = IL_CONN_MAX_LISTEN_INTERVAL; | 2219 | hw->max_listen_interval = IL_CONN_MAX_LISTEN_INTERVAL; |
2220 | 2220 | ||
2221 | if (priv->bands[IEEE80211_BAND_2GHZ].n_channels) | 2221 | if (il->bands[IEEE80211_BAND_2GHZ].n_channels) |
2222 | priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = | 2222 | il->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = |
2223 | &priv->bands[IEEE80211_BAND_2GHZ]; | 2223 | &il->bands[IEEE80211_BAND_2GHZ]; |
2224 | if (priv->bands[IEEE80211_BAND_5GHZ].n_channels) | 2224 | if (il->bands[IEEE80211_BAND_5GHZ].n_channels) |
2225 | priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = | 2225 | il->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = |
2226 | &priv->bands[IEEE80211_BAND_5GHZ]; | 2226 | &il->bands[IEEE80211_BAND_5GHZ]; |
2227 | 2227 | ||
2228 | il_leds_init(priv); | 2228 | il_leds_init(il); |
2229 | 2229 | ||
2230 | ret = ieee80211_register_hw(priv->hw); | 2230 | ret = ieee80211_register_hw(il->hw); |
2231 | if (ret) { | 2231 | if (ret) { |
2232 | IL_ERR(priv, "Failed to register hw (error %d)\n", ret); | 2232 | IL_ERR(il, "Failed to register hw (error %d)\n", ret); |
2233 | return ret; | 2233 | return ret; |
2234 | } | 2234 | } |
2235 | priv->mac80211_registered = 1; | 2235 | il->mac80211_registered = 1; |
2236 | 2236 | ||
2237 | return 0; | 2237 | return 0; |
2238 | } | 2238 | } |
@@ -2240,81 +2240,81 @@ static int il4965_mac_setup_register(struct il_priv *priv, | |||
2240 | 2240 | ||
2241 | int il4965_mac_start(struct ieee80211_hw *hw) | 2241 | int il4965_mac_start(struct ieee80211_hw *hw) |
2242 | { | 2242 | { |
2243 | struct il_priv *priv = hw->priv; | 2243 | struct il_priv *il = hw->priv; |
2244 | int ret; | 2244 | int ret; |
2245 | 2245 | ||
2246 | IL_DEBUG_MAC80211(priv, "enter\n"); | 2246 | IL_DEBUG_MAC80211(il, "enter\n"); |
2247 | 2247 | ||
2248 | /* we should be verifying the device is ready to be opened */ | 2248 | /* we should be verifying the device is ready to be opened */ |
2249 | mutex_lock(&priv->mutex); | 2249 | mutex_lock(&il->mutex); |
2250 | ret = __il4965_up(priv); | 2250 | ret = __il4965_up(il); |
2251 | mutex_unlock(&priv->mutex); | 2251 | mutex_unlock(&il->mutex); |
2252 | 2252 | ||
2253 | if (ret) | 2253 | if (ret) |
2254 | return ret; | 2254 | return ret; |
2255 | 2255 | ||
2256 | if (il_is_rfkill(priv)) | 2256 | if (il_is_rfkill(il)) |
2257 | goto out; | 2257 | goto out; |
2258 | 2258 | ||
2259 | IL_DEBUG_INFO(priv, "Start UP work done.\n"); | 2259 | IL_DEBUG_INFO(il, "Start UP work done.\n"); |
2260 | 2260 | ||
2261 | /* Wait for START_ALIVE from Run Time ucode. Otherwise callbacks from | 2261 | /* Wait for START_ALIVE from Run Time ucode. Otherwise callbacks from |
2262 | * mac80211 will not be run successfully. */ | 2262 | * mac80211 will not be run successfully. */ |
2263 | ret = wait_event_timeout(priv->wait_command_queue, | 2263 | ret = wait_event_timeout(il->wait_command_queue, |
2264 | test_bit(STATUS_READY, &priv->status), | 2264 | test_bit(STATUS_READY, &il->status), |
2265 | UCODE_READY_TIMEOUT); | 2265 | UCODE_READY_TIMEOUT); |
2266 | if (!ret) { | 2266 | if (!ret) { |
2267 | if (!test_bit(STATUS_READY, &priv->status)) { | 2267 | if (!test_bit(STATUS_READY, &il->status)) { |
2268 | IL_ERR(priv, "START_ALIVE timeout after %dms.\n", | 2268 | IL_ERR(il, "START_ALIVE timeout after %dms.\n", |
2269 | jiffies_to_msecs(UCODE_READY_TIMEOUT)); | 2269 | jiffies_to_msecs(UCODE_READY_TIMEOUT)); |
2270 | return -ETIMEDOUT; | 2270 | return -ETIMEDOUT; |
2271 | } | 2271 | } |
2272 | } | 2272 | } |
2273 | 2273 | ||
2274 | il4965_led_enable(priv); | 2274 | il4965_led_enable(il); |
2275 | 2275 | ||
2276 | out: | 2276 | out: |
2277 | priv->is_open = 1; | 2277 | il->is_open = 1; |
2278 | IL_DEBUG_MAC80211(priv, "leave\n"); | 2278 | IL_DEBUG_MAC80211(il, "leave\n"); |
2279 | return 0; | 2279 | return 0; |
2280 | } | 2280 | } |
2281 | 2281 | ||
2282 | void il4965_mac_stop(struct ieee80211_hw *hw) | 2282 | void il4965_mac_stop(struct ieee80211_hw *hw) |
2283 | { | 2283 | { |
2284 | struct il_priv *priv = hw->priv; | 2284 | struct il_priv *il = hw->priv; |
2285 | 2285 | ||
2286 | IL_DEBUG_MAC80211(priv, "enter\n"); | 2286 | IL_DEBUG_MAC80211(il, "enter\n"); |
2287 | 2287 | ||
2288 | if (!priv->is_open) | 2288 | if (!il->is_open) |
2289 | return; | 2289 | return; |
2290 | 2290 | ||
2291 | priv->is_open = 0; | 2291 | il->is_open = 0; |
2292 | 2292 | ||
2293 | il4965_down(priv); | 2293 | il4965_down(il); |
2294 | 2294 | ||
2295 | flush_workqueue(priv->workqueue); | 2295 | flush_workqueue(il->workqueue); |
2296 | 2296 | ||
2297 | /* User space software may expect getting rfkill changes | 2297 | /* User space software may expect getting rfkill changes |
2298 | * even if interface is down */ | 2298 | * even if interface is down */ |
2299 | il_write32(priv, CSR_INT, 0xFFFFFFFF); | 2299 | il_write32(il, CSR_INT, 0xFFFFFFFF); |
2300 | il_enable_rfkill_int(priv); | 2300 | il_enable_rfkill_int(il); |
2301 | 2301 | ||
2302 | IL_DEBUG_MAC80211(priv, "leave\n"); | 2302 | IL_DEBUG_MAC80211(il, "leave\n"); |
2303 | } | 2303 | } |
2304 | 2304 | ||
2305 | void il4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 2305 | void il4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) |
2306 | { | 2306 | { |
2307 | struct il_priv *priv = hw->priv; | 2307 | struct il_priv *il = hw->priv; |
2308 | 2308 | ||
2309 | IL_DEBUG_MACDUMP(priv, "enter\n"); | 2309 | IL_DEBUG_MACDUMP(il, "enter\n"); |
2310 | 2310 | ||
2311 | IL_DEBUG_TX(priv, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, | 2311 | IL_DEBUG_TX(il, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, |
2312 | ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); | 2312 | ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); |
2313 | 2313 | ||
2314 | if (il4965_tx_skb(priv, skb)) | 2314 | if (il4965_tx_skb(il, skb)) |
2315 | dev_kfree_skb_any(skb); | 2315 | dev_kfree_skb_any(skb); |
2316 | 2316 | ||
2317 | IL_DEBUG_MACDUMP(priv, "leave\n"); | 2317 | IL_DEBUG_MACDUMP(il, "leave\n"); |
2318 | } | 2318 | } |
2319 | 2319 | ||
2320 | void il4965_mac_update_tkip_key(struct ieee80211_hw *hw, | 2320 | void il4965_mac_update_tkip_key(struct ieee80211_hw *hw, |
@@ -2323,41 +2323,41 @@ void il4965_mac_update_tkip_key(struct ieee80211_hw *hw, | |||
2323 | struct ieee80211_sta *sta, | 2323 | struct ieee80211_sta *sta, |
2324 | u32 iv32, u16 *phase1key) | 2324 | u32 iv32, u16 *phase1key) |
2325 | { | 2325 | { |
2326 | struct il_priv *priv = hw->priv; | 2326 | struct il_priv *il = hw->priv; |
2327 | struct il_vif_priv *vif_priv = (void *)vif->drv_priv; | 2327 | struct il_vif_priv *vif_priv = (void *)vif->drv_priv; |
2328 | 2328 | ||
2329 | IL_DEBUG_MAC80211(priv, "enter\n"); | 2329 | IL_DEBUG_MAC80211(il, "enter\n"); |
2330 | 2330 | ||
2331 | il4965_update_tkip_key(priv, vif_priv->ctx, keyconf, sta, | 2331 | il4965_update_tkip_key(il, vif_priv->ctx, keyconf, sta, |
2332 | iv32, phase1key); | 2332 | iv32, phase1key); |
2333 | 2333 | ||
2334 | IL_DEBUG_MAC80211(priv, "leave\n"); | 2334 | IL_DEBUG_MAC80211(il, "leave\n"); |
2335 | } | 2335 | } |
2336 | 2336 | ||
2337 | int il4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | 2337 | int il4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, |
2338 | struct ieee80211_vif *vif, struct ieee80211_sta *sta, | 2338 | struct ieee80211_vif *vif, struct ieee80211_sta *sta, |
2339 | struct ieee80211_key_conf *key) | 2339 | struct ieee80211_key_conf *key) |
2340 | { | 2340 | { |
2341 | struct il_priv *priv = hw->priv; | 2341 | struct il_priv *il = hw->priv; |
2342 | struct il_vif_priv *vif_priv = (void *)vif->drv_priv; | 2342 | struct il_vif_priv *vif_priv = (void *)vif->drv_priv; |
2343 | struct il_rxon_context *ctx = vif_priv->ctx; | 2343 | struct il_rxon_context *ctx = vif_priv->ctx; |
2344 | int ret; | 2344 | int ret; |
2345 | u8 sta_id; | 2345 | u8 sta_id; |
2346 | bool is_default_wep_key = false; | 2346 | bool is_default_wep_key = false; |
2347 | 2347 | ||
2348 | IL_DEBUG_MAC80211(priv, "enter\n"); | 2348 | IL_DEBUG_MAC80211(il, "enter\n"); |
2349 | 2349 | ||
2350 | if (priv->cfg->mod_params->sw_crypto) { | 2350 | if (il->cfg->mod_params->sw_crypto) { |
2351 | IL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n"); | 2351 | IL_DEBUG_MAC80211(il, "leave - hwcrypto disabled\n"); |
2352 | return -EOPNOTSUPP; | 2352 | return -EOPNOTSUPP; |
2353 | } | 2353 | } |
2354 | 2354 | ||
2355 | sta_id = il_sta_id_or_broadcast(priv, vif_priv->ctx, sta); | 2355 | sta_id = il_sta_id_or_broadcast(il, vif_priv->ctx, sta); |
2356 | if (sta_id == IL_INVALID_STATION) | 2356 | if (sta_id == IL_INVALID_STATION) |
2357 | return -EINVAL; | 2357 | return -EINVAL; |
2358 | 2358 | ||
2359 | mutex_lock(&priv->mutex); | 2359 | mutex_lock(&il->mutex); |
2360 | il_scan_cancel_timeout(priv, 100); | 2360 | il_scan_cancel_timeout(il, 100); |
2361 | 2361 | ||
2362 | /* | 2362 | /* |
2363 | * If we are getting WEP group key and we didn't receive any key mapping | 2363 | * If we are getting WEP group key and we didn't receive any key mapping |
@@ -2378,29 +2378,29 @@ int il4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
2378 | switch (cmd) { | 2378 | switch (cmd) { |
2379 | case SET_KEY: | 2379 | case SET_KEY: |
2380 | if (is_default_wep_key) | 2380 | if (is_default_wep_key) |
2381 | ret = il4965_set_default_wep_key(priv, | 2381 | ret = il4965_set_default_wep_key(il, |
2382 | vif_priv->ctx, key); | 2382 | vif_priv->ctx, key); |
2383 | else | 2383 | else |
2384 | ret = il4965_set_dynamic_key(priv, vif_priv->ctx, | 2384 | ret = il4965_set_dynamic_key(il, vif_priv->ctx, |
2385 | key, sta_id); | 2385 | key, sta_id); |
2386 | 2386 | ||
2387 | IL_DEBUG_MAC80211(priv, "enable hwcrypto key\n"); | 2387 | IL_DEBUG_MAC80211(il, "enable hwcrypto key\n"); |
2388 | break; | 2388 | break; |
2389 | case DISABLE_KEY: | 2389 | case DISABLE_KEY: |
2390 | if (is_default_wep_key) | 2390 | if (is_default_wep_key) |
2391 | ret = il4965_remove_default_wep_key(priv, ctx, key); | 2391 | ret = il4965_remove_default_wep_key(il, ctx, key); |
2392 | else | 2392 | else |
2393 | ret = il4965_remove_dynamic_key(priv, ctx, | 2393 | ret = il4965_remove_dynamic_key(il, ctx, |
2394 | key, sta_id); | 2394 | key, sta_id); |
2395 | 2395 | ||
2396 | IL_DEBUG_MAC80211(priv, "disable hwcrypto key\n"); | 2396 | IL_DEBUG_MAC80211(il, "disable hwcrypto key\n"); |
2397 | break; | 2397 | break; |
2398 | default: | 2398 | default: |
2399 | ret = -EINVAL; | 2399 | ret = -EINVAL; |
2400 | } | 2400 | } |
2401 | 2401 | ||
2402 | mutex_unlock(&priv->mutex); | 2402 | mutex_unlock(&il->mutex); |
2403 | IL_DEBUG_MAC80211(priv, "leave\n"); | 2403 | IL_DEBUG_MAC80211(il, "leave\n"); |
2404 | 2404 | ||
2405 | return ret; | 2405 | return ret; |
2406 | } | 2406 | } |
@@ -2411,43 +2411,43 @@ int il4965_mac_ampdu_action(struct ieee80211_hw *hw, | |||
2411 | struct ieee80211_sta *sta, u16 tid, u16 *ssn, | 2411 | struct ieee80211_sta *sta, u16 tid, u16 *ssn, |
2412 | u8 buf_size) | 2412 | u8 buf_size) |
2413 | { | 2413 | { |
2414 | struct il_priv *priv = hw->priv; | 2414 | struct il_priv *il = hw->priv; |
2415 | int ret = -EINVAL; | 2415 | int ret = -EINVAL; |
2416 | 2416 | ||
2417 | IL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n", | 2417 | IL_DEBUG_HT(il, "A-MPDU action on addr %pM tid %d\n", |
2418 | sta->addr, tid); | 2418 | sta->addr, tid); |
2419 | 2419 | ||
2420 | if (!(priv->cfg->sku & IL_SKU_N)) | 2420 | if (!(il->cfg->sku & IL_SKU_N)) |
2421 | return -EACCES; | 2421 | return -EACCES; |
2422 | 2422 | ||
2423 | mutex_lock(&priv->mutex); | 2423 | mutex_lock(&il->mutex); |
2424 | 2424 | ||
2425 | switch (action) { | 2425 | switch (action) { |
2426 | case IEEE80211_AMPDU_RX_START: | 2426 | case IEEE80211_AMPDU_RX_START: |
2427 | IL_DEBUG_HT(priv, "start Rx\n"); | 2427 | IL_DEBUG_HT(il, "start Rx\n"); |
2428 | ret = il4965_sta_rx_agg_start(priv, sta, tid, *ssn); | 2428 | ret = il4965_sta_rx_agg_start(il, sta, tid, *ssn); |
2429 | break; | 2429 | break; |
2430 | case IEEE80211_AMPDU_RX_STOP: | 2430 | case IEEE80211_AMPDU_RX_STOP: |
2431 | IL_DEBUG_HT(priv, "stop Rx\n"); | 2431 | IL_DEBUG_HT(il, "stop Rx\n"); |
2432 | ret = il4965_sta_rx_agg_stop(priv, sta, tid); | 2432 | ret = il4965_sta_rx_agg_stop(il, sta, tid); |
2433 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 2433 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) |
2434 | ret = 0; | 2434 | ret = 0; |
2435 | break; | 2435 | break; |
2436 | case IEEE80211_AMPDU_TX_START: | 2436 | case IEEE80211_AMPDU_TX_START: |
2437 | IL_DEBUG_HT(priv, "start Tx\n"); | 2437 | IL_DEBUG_HT(il, "start Tx\n"); |
2438 | ret = il4965_tx_agg_start(priv, vif, sta, tid, ssn); | 2438 | ret = il4965_tx_agg_start(il, vif, sta, tid, ssn); |
2439 | break; | 2439 | break; |
2440 | case IEEE80211_AMPDU_TX_STOP: | 2440 | case IEEE80211_AMPDU_TX_STOP: |
2441 | IL_DEBUG_HT(priv, "stop Tx\n"); | 2441 | IL_DEBUG_HT(il, "stop Tx\n"); |
2442 | ret = il4965_tx_agg_stop(priv, vif, sta, tid); | 2442 | ret = il4965_tx_agg_stop(il, vif, sta, tid); |
2443 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 2443 | if (test_bit(STATUS_EXIT_PENDING, &il->status)) |
2444 | ret = 0; | 2444 | ret = 0; |
2445 | break; | 2445 | break; |
2446 | case IEEE80211_AMPDU_TX_OPERATIONAL: | 2446 | case IEEE80211_AMPDU_TX_OPERATIONAL: |
2447 | ret = 0; | 2447 | ret = 0; |
2448 | break; | 2448 | break; |
2449 | } | 2449 | } |
2450 | mutex_unlock(&priv->mutex); | 2450 | mutex_unlock(&il->mutex); |
2451 | 2451 | ||
2452 | return ret; | 2452 | return ret; |
2453 | } | 2453 | } |
@@ -2456,39 +2456,39 @@ int il4965_mac_sta_add(struct ieee80211_hw *hw, | |||
2456 | struct ieee80211_vif *vif, | 2456 | struct ieee80211_vif *vif, |
2457 | struct ieee80211_sta *sta) | 2457 | struct ieee80211_sta *sta) |
2458 | { | 2458 | { |
2459 | struct il_priv *priv = hw->priv; | 2459 | struct il_priv *il = hw->priv; |
2460 | struct il_station_priv *sta_priv = (void *)sta->drv_priv; | 2460 | struct il_station_priv *sta_priv = (void *)sta->drv_priv; |
2461 | struct il_vif_priv *vif_priv = (void *)vif->drv_priv; | 2461 | struct il_vif_priv *vif_priv = (void *)vif->drv_priv; |
2462 | bool is_ap = vif->type == NL80211_IFTYPE_STATION; | 2462 | bool is_ap = vif->type == NL80211_IFTYPE_STATION; |
2463 | int ret; | 2463 | int ret; |
2464 | u8 sta_id; | 2464 | u8 sta_id; |
2465 | 2465 | ||
2466 | IL_DEBUG_INFO(priv, "received request to add station %pM\n", | 2466 | IL_DEBUG_INFO(il, "received request to add station %pM\n", |
2467 | sta->addr); | 2467 | sta->addr); |
2468 | mutex_lock(&priv->mutex); | 2468 | mutex_lock(&il->mutex); |
2469 | IL_DEBUG_INFO(priv, "proceeding to add station %pM\n", | 2469 | IL_DEBUG_INFO(il, "proceeding to add station %pM\n", |
2470 | sta->addr); | 2470 | sta->addr); |
2471 | sta_priv->common.sta_id = IL_INVALID_STATION; | 2471 | sta_priv->common.sta_id = IL_INVALID_STATION; |
2472 | 2472 | ||
2473 | atomic_set(&sta_priv->pending_frames, 0); | 2473 | atomic_set(&sta_priv->pending_frames, 0); |
2474 | 2474 | ||
2475 | ret = il_add_station_common(priv, vif_priv->ctx, sta->addr, | 2475 | ret = il_add_station_common(il, vif_priv->ctx, sta->addr, |
2476 | is_ap, sta, &sta_id); | 2476 | is_ap, sta, &sta_id); |
2477 | if (ret) { | 2477 | if (ret) { |
2478 | IL_ERR(priv, "Unable to add station %pM (%d)\n", | 2478 | IL_ERR(il, "Unable to add station %pM (%d)\n", |
2479 | sta->addr, ret); | 2479 | sta->addr, ret); |
2480 | /* Should we return success if return code is EEXIST ? */ | 2480 | /* Should we return success if return code is EEXIST ? */ |
2481 | mutex_unlock(&priv->mutex); | 2481 | mutex_unlock(&il->mutex); |
2482 | return ret; | 2482 | return ret; |
2483 | } | 2483 | } |
2484 | 2484 | ||
2485 | sta_priv->common.sta_id = sta_id; | 2485 | sta_priv->common.sta_id = sta_id; |
2486 | 2486 | ||
2487 | /* Initialize rate scaling */ | 2487 | /* Initialize rate scaling */ |
2488 | IL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", | 2488 | IL_DEBUG_INFO(il, "Initializing rate scaling for station %pM\n", |
2489 | sta->addr); | 2489 | sta->addr); |
2490 | il4965_rs_rate_init(priv, sta, sta_id); | 2490 | il4965_rs_rate_init(il, sta, sta_id); |
2491 | mutex_unlock(&priv->mutex); | 2491 | mutex_unlock(&il->mutex); |
2492 | 2492 | ||
2493 | return 0; | 2493 | return 0; |
2494 | } | 2494 | } |
@@ -2496,46 +2496,46 @@ int il4965_mac_sta_add(struct ieee80211_hw *hw, | |||
2496 | void il4965_mac_channel_switch(struct ieee80211_hw *hw, | 2496 | void il4965_mac_channel_switch(struct ieee80211_hw *hw, |
2497 | struct ieee80211_channel_switch *ch_switch) | 2497 | struct ieee80211_channel_switch *ch_switch) |
2498 | { | 2498 | { |
2499 | struct il_priv *priv = hw->priv; | 2499 | struct il_priv *il = hw->priv; |
2500 | const struct il_channel_info *ch_info; | 2500 | const struct il_channel_info *ch_info; |
2501 | struct ieee80211_conf *conf = &hw->conf; | 2501 | struct ieee80211_conf *conf = &hw->conf; |
2502 | struct ieee80211_channel *channel = ch_switch->channel; | 2502 | struct ieee80211_channel *channel = ch_switch->channel; |
2503 | struct il_ht_config *ht_conf = &priv->current_ht_config; | 2503 | struct il_ht_config *ht_conf = &il->current_ht_config; |
2504 | 2504 | ||
2505 | struct il_rxon_context *ctx = &priv->contexts[IL_RXON_CTX_BSS]; | 2505 | struct il_rxon_context *ctx = &il->contexts[IL_RXON_CTX_BSS]; |
2506 | u16 ch; | 2506 | u16 ch; |
2507 | 2507 | ||
2508 | IL_DEBUG_MAC80211(priv, "enter\n"); | 2508 | IL_DEBUG_MAC80211(il, "enter\n"); |
2509 | 2509 | ||
2510 | mutex_lock(&priv->mutex); | 2510 | mutex_lock(&il->mutex); |
2511 | 2511 | ||
2512 | if (il_is_rfkill(priv)) | 2512 | if (il_is_rfkill(il)) |
2513 | goto out; | 2513 | goto out; |
2514 | 2514 | ||
2515 | if (test_bit(STATUS_EXIT_PENDING, &priv->status) || | 2515 | if (test_bit(STATUS_EXIT_PENDING, &il->status) || |
2516 | test_bit(STATUS_SCANNING, &priv->status) || | 2516 | test_bit(STATUS_SCANNING, &il->status) || |
2517 | test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) | 2517 | test_bit(STATUS_CHANNEL_SWITCH_PENDING, &il->status)) |
2518 | goto out; | 2518 | goto out; |
2519 | 2519 | ||
2520 | if (!il_is_associated_ctx(ctx)) | 2520 | if (!il_is_associated_ctx(ctx)) |
2521 | goto out; | 2521 | goto out; |
2522 | 2522 | ||
2523 | if (!priv->cfg->ops->lib->set_channel_switch) | 2523 | if (!il->cfg->ops->lib->set_channel_switch) |
2524 | goto out; | 2524 | goto out; |
2525 | 2525 | ||
2526 | ch = channel->hw_value; | 2526 | ch = channel->hw_value; |
2527 | if (le16_to_cpu(ctx->active.channel) == ch) | 2527 | if (le16_to_cpu(ctx->active.channel) == ch) |
2528 | goto out; | 2528 | goto out; |
2529 | 2529 | ||
2530 | ch_info = il_get_channel_info(priv, channel->band, ch); | 2530 | ch_info = il_get_channel_info(il, channel->band, ch); |
2531 | if (!il_is_channel_valid(ch_info)) { | 2531 | if (!il_is_channel_valid(ch_info)) { |
2532 | IL_DEBUG_MAC80211(priv, "invalid channel\n"); | 2532 | IL_DEBUG_MAC80211(il, "invalid channel\n"); |
2533 | goto out; | 2533 | goto out; |
2534 | } | 2534 | } |
2535 | 2535 | ||
2536 | spin_lock_irq(&priv->lock); | 2536 | spin_lock_irq(&il->lock); |
2537 | 2537 | ||
2538 | priv->current_ht_config.smps = conf->smps_mode; | 2538 | il->current_ht_config.smps = conf->smps_mode; |
2539 | 2539 | ||
2540 | /* Configure HT40 channels */ | 2540 | /* Configure HT40 channels */ |
2541 | ctx->ht.enabled = conf_is_ht(conf); | 2541 | ctx->ht.enabled = conf_is_ht(conf); |
@@ -2559,28 +2559,28 @@ void il4965_mac_channel_switch(struct ieee80211_hw *hw, | |||
2559 | if ((le16_to_cpu(ctx->staging.channel) != ch)) | 2559 | if ((le16_to_cpu(ctx->staging.channel) != ch)) |
2560 | ctx->staging.flags = 0; | 2560 | ctx->staging.flags = 0; |
2561 | 2561 | ||
2562 | il_set_rxon_channel(priv, channel, ctx); | 2562 | il_set_rxon_channel(il, channel, ctx); |
2563 | il_set_rxon_ht(priv, ht_conf); | 2563 | il_set_rxon_ht(il, ht_conf); |
2564 | il_set_flags_for_band(priv, ctx, channel->band, ctx->vif); | 2564 | il_set_flags_for_band(il, ctx, channel->band, ctx->vif); |
2565 | 2565 | ||
2566 | spin_unlock_irq(&priv->lock); | 2566 | spin_unlock_irq(&il->lock); |
2567 | 2567 | ||
2568 | il_set_rate(priv); | 2568 | il_set_rate(il); |
2569 | /* | 2569 | /* |
2570 | * at this point, staging_rxon has the | 2570 | * at this point, staging_rxon has the |
2571 | * configuration for channel switch | 2571 | * configuration for channel switch |
2572 | */ | 2572 | */ |
2573 | set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status); | 2573 | set_bit(STATUS_CHANNEL_SWITCH_PENDING, &il->status); |
2574 | priv->switch_channel = cpu_to_le16(ch); | 2574 | il->switch_channel = cpu_to_le16(ch); |
2575 | if (priv->cfg->ops->lib->set_channel_switch(priv, ch_switch)) { | 2575 | if (il->cfg->ops->lib->set_channel_switch(il, ch_switch)) { |
2576 | clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status); | 2576 | clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &il->status); |
2577 | priv->switch_channel = 0; | 2577 | il->switch_channel = 0; |
2578 | ieee80211_chswitch_done(ctx->vif, false); | 2578 | ieee80211_chswitch_done(ctx->vif, false); |
2579 | } | 2579 | } |
2580 | 2580 | ||
2581 | out: | 2581 | out: |
2582 | mutex_unlock(&priv->mutex); | 2582 | mutex_unlock(&il->mutex); |
2583 | IL_DEBUG_MAC80211(priv, "leave\n"); | 2583 | IL_DEBUG_MAC80211(il, "leave\n"); |
2584 | } | 2584 | } |
2585 | 2585 | ||
2586 | void il4965_configure_filter(struct ieee80211_hw *hw, | 2586 | void il4965_configure_filter(struct ieee80211_hw *hw, |
@@ -2588,7 +2588,7 @@ void il4965_configure_filter(struct ieee80211_hw *hw, | |||
2588 | unsigned int *total_flags, | 2588 | unsigned int *total_flags, |
2589 | u64 multicast) | 2589 | u64 multicast) |
2590 | { | 2590 | { |
2591 | struct il_priv *priv = hw->priv; | 2591 | struct il_priv *il = hw->priv; |
2592 | __le32 filter_or = 0, filter_nand = 0; | 2592 | __le32 filter_or = 0, filter_nand = 0; |
2593 | struct il_rxon_context *ctx; | 2593 | struct il_rxon_context *ctx; |
2594 | 2594 | ||
@@ -2599,7 +2599,7 @@ void il4965_configure_filter(struct ieee80211_hw *hw, | |||
2599 | filter_nand |= (flag); \ | 2599 | filter_nand |= (flag); \ |
2600 | } while (0) | 2600 | } while (0) |
2601 | 2601 | ||
2602 | IL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", | 2602 | IL_DEBUG_MAC80211(il, "Enter: changed: 0x%x, total: 0x%x\n", |
2603 | changed_flags, *total_flags); | 2603 | changed_flags, *total_flags); |
2604 | 2604 | ||
2605 | CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); | 2605 | CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); |
@@ -2609,9 +2609,9 @@ void il4965_configure_filter(struct ieee80211_hw *hw, | |||
2609 | 2609 | ||
2610 | #undef CHK | 2610 | #undef CHK |
2611 | 2611 | ||
2612 | mutex_lock(&priv->mutex); | 2612 | mutex_lock(&il->mutex); |
2613 | 2613 | ||
2614 | for_each_context(priv, ctx) { | 2614 | for_each_context(il, ctx) { |
2615 | ctx->staging.filter_flags &= ~filter_nand; | 2615 | ctx->staging.filter_flags &= ~filter_nand; |
2616 | ctx->staging.filter_flags |= filter_or; | 2616 | ctx->staging.filter_flags |= filter_or; |
2617 | 2617 | ||
@@ -2621,7 +2621,7 @@ void il4965_configure_filter(struct ieee80211_hw *hw, | |||
2621 | */ | 2621 | */ |
2622 | } | 2622 | } |
2623 | 2623 | ||
2624 | mutex_unlock(&priv->mutex); | 2624 | mutex_unlock(&il->mutex); |
2625 | 2625 | ||
2626 | /* | 2626 | /* |
2627 | * Receiving all multicast frames is always enabled by the | 2627 | * Receiving all multicast frames is always enabled by the |
@@ -2641,72 +2641,72 @@ void il4965_configure_filter(struct ieee80211_hw *hw, | |||
2641 | 2641 | ||
2642 | static void il4965_bg_txpower_work(struct work_struct *work) | 2642 | static void il4965_bg_txpower_work(struct work_struct *work) |
2643 | { | 2643 | { |
2644 | struct il_priv *priv = container_of(work, struct il_priv, | 2644 | struct il_priv *il = container_of(work, struct il_priv, |
2645 | txpower_work); | 2645 | txpower_work); |
2646 | 2646 | ||
2647 | mutex_lock(&priv->mutex); | 2647 | mutex_lock(&il->mutex); |
2648 | 2648 | ||
2649 | /* If a scan happened to start before we got here | 2649 | /* If a scan happened to start before we got here |
2650 | * then just return; the statistics notification will | 2650 | * then just return; the statistics notification will |
2651 | * kick off another scheduled work to compensate for | 2651 | * kick off another scheduled work to compensate for |
2652 | * any temperature delta we missed here. */ | 2652 | * any temperature delta we missed here. */ |
2653 | if (test_bit(STATUS_EXIT_PENDING, &priv->status) || | 2653 | if (test_bit(STATUS_EXIT_PENDING, &il->status) || |
2654 | test_bit(STATUS_SCANNING, &priv->status)) | 2654 | test_bit(STATUS_SCANNING, &il->status)) |
2655 | goto out; | 2655 | goto out; |
2656 | 2656 | ||
2657 | /* Regardless of if we are associated, we must reconfigure the | 2657 | /* Regardless of if we are associated, we must reconfigure the |
2658 | * TX power since frames can be sent on non-radar channels while | 2658 | * TX power since frames can be sent on non-radar channels while |
2659 | * not associated */ | 2659 | * not associated */ |
2660 | priv->cfg->ops->lib->send_tx_power(priv); | 2660 | il->cfg->ops->lib->send_tx_power(il); |
2661 | 2661 | ||
2662 | /* Update last_temperature to keep is_calib_needed from running | 2662 | /* Update last_temperature to keep is_calib_needed from running |
2663 | * when it isn't needed... */ | 2663 | * when it isn't needed... */ |
2664 | priv->last_temperature = priv->temperature; | 2664 | il->last_temperature = il->temperature; |
2665 | out: | 2665 | out: |
2666 | mutex_unlock(&priv->mutex); | 2666 | mutex_unlock(&il->mutex); |
2667 | } | 2667 | } |
2668 | 2668 | ||
2669 | static void il4965_setup_deferred_work(struct il_priv *priv) | 2669 | static void il4965_setup_deferred_work(struct il_priv *il) |
2670 | { | 2670 | { |
2671 | priv->workqueue = create_singlethread_workqueue(DRV_NAME); | 2671 | il->workqueue = create_singlethread_workqueue(DRV_NAME); |
2672 | 2672 | ||
2673 | init_waitqueue_head(&priv->wait_command_queue); | 2673 | init_waitqueue_head(&il->wait_command_queue); |
2674 | 2674 | ||
2675 | INIT_WORK(&priv->restart, il4965_bg_restart); | 2675 | INIT_WORK(&il->restart, il4965_bg_restart); |
2676 | INIT_WORK(&priv->rx_replenish, il4965_bg_rx_replenish); | 2676 | INIT_WORK(&il->rx_replenish, il4965_bg_rx_replenish); |
2677 | INIT_WORK(&priv->run_time_calib_work, il4965_bg_run_time_calib_work); | 2677 | INIT_WORK(&il->run_time_calib_work, il4965_bg_run_time_calib_work); |
2678 | INIT_DELAYED_WORK(&priv->init_alive_start, il4965_bg_init_alive_start); | 2678 | INIT_DELAYED_WORK(&il->init_alive_start, il4965_bg_init_alive_start); |
2679 | INIT_DELAYED_WORK(&priv->alive_start, il4965_bg_alive_start); | 2679 | INIT_DELAYED_WORK(&il->alive_start, il4965_bg_alive_start); |
2680 | 2680 | ||
2681 | il_setup_scan_deferred_work(priv); | 2681 | il_setup_scan_deferred_work(il); |
2682 | 2682 | ||
2683 | INIT_WORK(&priv->txpower_work, il4965_bg_txpower_work); | 2683 | INIT_WORK(&il->txpower_work, il4965_bg_txpower_work); |
2684 | 2684 | ||
2685 | init_timer(&priv->statistics_periodic); | 2685 | init_timer(&il->statistics_periodic); |
2686 | priv->statistics_periodic.data = (unsigned long)priv; | 2686 | il->statistics_periodic.data = (unsigned long)il; |
2687 | priv->statistics_periodic.function = il4965_bg_statistics_periodic; | 2687 | il->statistics_periodic.function = il4965_bg_statistics_periodic; |
2688 | 2688 | ||
2689 | init_timer(&priv->watchdog); | 2689 | init_timer(&il->watchdog); |
2690 | priv->watchdog.data = (unsigned long)priv; | 2690 | il->watchdog.data = (unsigned long)il; |
2691 | priv->watchdog.function = il_bg_watchdog; | 2691 | il->watchdog.function = il_bg_watchdog; |
2692 | 2692 | ||
2693 | tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) | 2693 | tasklet_init(&il->irq_tasklet, (void (*)(unsigned long)) |
2694 | il4965_irq_tasklet, (unsigned long)priv); | 2694 | il4965_irq_tasklet, (unsigned long)il); |
2695 | } | 2695 | } |
2696 | 2696 | ||
2697 | static void il4965_cancel_deferred_work(struct il_priv *priv) | 2697 | static void il4965_cancel_deferred_work(struct il_priv *il) |
2698 | { | 2698 | { |
2699 | cancel_work_sync(&priv->txpower_work); | 2699 | cancel_work_sync(&il->txpower_work); |
2700 | cancel_delayed_work_sync(&priv->init_alive_start); | 2700 | cancel_delayed_work_sync(&il->init_alive_start); |
2701 | cancel_delayed_work(&priv->alive_start); | 2701 | cancel_delayed_work(&il->alive_start); |
2702 | cancel_work_sync(&priv->run_time_calib_work); | 2702 | cancel_work_sync(&il->run_time_calib_work); |
2703 | 2703 | ||
2704 | il_cancel_scan_deferred_work(priv); | 2704 | il_cancel_scan_deferred_work(il); |
2705 | 2705 | ||
2706 | del_timer_sync(&priv->statistics_periodic); | 2706 | del_timer_sync(&il->statistics_periodic); |
2707 | } | 2707 | } |
2708 | 2708 | ||
2709 | static void il4965_init_hw_rates(struct il_priv *priv, | 2709 | static void il4965_init_hw_rates(struct il_priv *il, |
2710 | struct ieee80211_rate *rates) | 2710 | struct ieee80211_rate *rates) |
2711 | { | 2711 | { |
2712 | int i; | 2712 | int i; |
@@ -2727,26 +2727,26 @@ static void il4965_init_hw_rates(struct il_priv *priv, | |||
2727 | } | 2727 | } |
2728 | } | 2728 | } |
2729 | /* | 2729 | /* |
2730 | * Acquire priv->lock before calling this function ! | 2730 | * Acquire il->lock before calling this function ! |
2731 | */ | 2731 | */ |
2732 | void il4965_set_wr_ptrs(struct il_priv *priv, int txq_id, u32 index) | 2732 | void il4965_set_wr_ptrs(struct il_priv *il, int txq_id, u32 index) |
2733 | { | 2733 | { |
2734 | il_write_direct32(priv, HBUS_TARG_WRPTR, | 2734 | il_write_direct32(il, HBUS_TARG_WRPTR, |
2735 | (index & 0xff) | (txq_id << 8)); | 2735 | (index & 0xff) | (txq_id << 8)); |
2736 | il_write_prph(priv, IWL49_SCD_QUEUE_RDPTR(txq_id), index); | 2736 | il_write_prph(il, IWL49_SCD_QUEUE_RDPTR(txq_id), index); |
2737 | } | 2737 | } |
2738 | 2738 | ||
2739 | void il4965_tx_queue_set_status(struct il_priv *priv, | 2739 | void il4965_tx_queue_set_status(struct il_priv *il, |
2740 | struct il_tx_queue *txq, | 2740 | struct il_tx_queue *txq, |
2741 | int tx_fifo_id, int scd_retry) | 2741 | int tx_fifo_id, int scd_retry) |
2742 | { | 2742 | { |
2743 | int txq_id = txq->q.id; | 2743 | int txq_id = txq->q.id; |
2744 | 2744 | ||
2745 | /* Find out whether to activate Tx queue */ | 2745 | /* Find out whether to activate Tx queue */ |
2746 | int active = test_bit(txq_id, &priv->txq_ctx_active_msk) ? 1 : 0; | 2746 | int active = test_bit(txq_id, &il->txq_ctx_active_msk) ? 1 : 0; |
2747 | 2747 | ||
2748 | /* Set up and activate */ | 2748 | /* Set up and activate */ |
2749 | il_write_prph(priv, IWL49_SCD_QUEUE_STATUS_BITS(txq_id), | 2749 | il_write_prph(il, IWL49_SCD_QUEUE_STATUS_BITS(txq_id), |
2750 | (active << IWL49_SCD_QUEUE_STTS_REG_POS_ACTIVE) | | 2750 | (active << IWL49_SCD_QUEUE_STTS_REG_POS_ACTIVE) | |
2751 | (tx_fifo_id << IWL49_SCD_QUEUE_STTS_REG_POS_TXF) | | 2751 | (tx_fifo_id << IWL49_SCD_QUEUE_STTS_REG_POS_TXF) | |
2752 | (scd_retry << IWL49_SCD_QUEUE_STTS_REG_POS_WSL) | | 2752 | (scd_retry << IWL49_SCD_QUEUE_STTS_REG_POS_WSL) | |
@@ -2755,94 +2755,94 @@ void il4965_tx_queue_set_status(struct il_priv *priv, | |||
2755 | 2755 | ||
2756 | txq->sched_retry = scd_retry; | 2756 | txq->sched_retry = scd_retry; |
2757 | 2757 | ||
2758 | IL_DEBUG_INFO(priv, "%s %s Queue %d on AC %d\n", | 2758 | IL_DEBUG_INFO(il, "%s %s Queue %d on AC %d\n", |
2759 | active ? "Activate" : "Deactivate", | 2759 | active ? "Activate" : "Deactivate", |
2760 | scd_retry ? "BA" : "AC", txq_id, tx_fifo_id); | 2760 | scd_retry ? "BA" : "AC", txq_id, tx_fifo_id); |
2761 | } | 2761 | } |
2762 | 2762 | ||
2763 | 2763 | ||
2764 | static int il4965_init_drv(struct il_priv *priv) | 2764 | static int il4965_init_drv(struct il_priv *il) |
2765 | { | 2765 | { |
2766 | int ret; | 2766 | int ret; |
2767 | 2767 | ||
2768 | spin_lock_init(&priv->sta_lock); | 2768 | spin_lock_init(&il->sta_lock); |
2769 | spin_lock_init(&priv->hcmd_lock); | 2769 | spin_lock_init(&il->hcmd_lock); |
2770 | 2770 | ||
2771 | INIT_LIST_HEAD(&priv->free_frames); | 2771 | INIT_LIST_HEAD(&il->free_frames); |
2772 | 2772 | ||
2773 | mutex_init(&priv->mutex); | 2773 | mutex_init(&il->mutex); |
2774 | 2774 | ||
2775 | priv->ieee_channels = NULL; | 2775 | il->ieee_channels = NULL; |
2776 | priv->ieee_rates = NULL; | 2776 | il->ieee_rates = NULL; |
2777 | priv->band = IEEE80211_BAND_2GHZ; | 2777 | il->band = IEEE80211_BAND_2GHZ; |
2778 | 2778 | ||
2779 | priv->iw_mode = NL80211_IFTYPE_STATION; | 2779 | il->iw_mode = NL80211_IFTYPE_STATION; |
2780 | priv->current_ht_config.smps = IEEE80211_SMPS_STATIC; | 2780 | il->current_ht_config.smps = IEEE80211_SMPS_STATIC; |
2781 | priv->missed_beacon_threshold = IL_MISSED_BEACON_THRESHOLD_DEF; | 2781 | il->missed_beacon_threshold = IL_MISSED_BEACON_THRESHOLD_DEF; |
2782 | 2782 | ||
2783 | /* initialize force reset */ | 2783 | /* initialize force reset */ |
2784 | priv->force_reset.reset_duration = IL_DELAY_NEXT_FORCE_FW_RELOAD; | 2784 | il->force_reset.reset_duration = IL_DELAY_NEXT_FORCE_FW_RELOAD; |
2785 | 2785 | ||
2786 | /* Choose which receivers/antennas to use */ | 2786 | /* Choose which receivers/antennas to use */ |
2787 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 2787 | if (il->cfg->ops->hcmd->set_rxon_chain) |
2788 | priv->cfg->ops->hcmd->set_rxon_chain(priv, | 2788 | il->cfg->ops->hcmd->set_rxon_chain(il, |
2789 | &priv->contexts[IL_RXON_CTX_BSS]); | 2789 | &il->contexts[IL_RXON_CTX_BSS]); |
2790 | 2790 | ||
2791 | il_init_scan_params(priv); | 2791 | il_init_scan_params(il); |
2792 | 2792 | ||
2793 | ret = il_init_channel_map(priv); | 2793 | ret = il_init_channel_map(il); |
2794 | if (ret) { | 2794 | if (ret) { |
2795 | IL_ERR(priv, "initializing regulatory failed: %d\n", ret); | 2795 | IL_ERR(il, "initializing regulatory failed: %d\n", ret); |
2796 | goto err; | 2796 | goto err; |
2797 | } | 2797 | } |
2798 | 2798 | ||
2799 | ret = il_init_geos(priv); | 2799 | ret = il_init_geos(il); |
2800 | if (ret) { | 2800 | if (ret) { |
2801 | IL_ERR(priv, "initializing geos failed: %d\n", ret); | 2801 | IL_ERR(il, "initializing geos failed: %d\n", ret); |
2802 | goto err_free_channel_map; | 2802 | goto err_free_channel_map; |
2803 | } | 2803 | } |
2804 | il4965_init_hw_rates(priv, priv->ieee_rates); | 2804 | il4965_init_hw_rates(il, il->ieee_rates); |
2805 | 2805 | ||
2806 | return 0; | 2806 | return 0; |
2807 | 2807 | ||
2808 | err_free_channel_map: | 2808 | err_free_channel_map: |
2809 | il_free_channel_map(priv); | 2809 | il_free_channel_map(il); |
2810 | err: | 2810 | err: |
2811 | return ret; | 2811 | return ret; |
2812 | } | 2812 | } |
2813 | 2813 | ||
2814 | static void il4965_uninit_drv(struct il_priv *priv) | 2814 | static void il4965_uninit_drv(struct il_priv *il) |
2815 | { | 2815 | { |
2816 | il4965_calib_free_results(priv); | 2816 | il4965_calib_free_results(il); |
2817 | il_free_geos(priv); | 2817 | il_free_geos(il); |
2818 | il_free_channel_map(priv); | 2818 | il_free_channel_map(il); |
2819 | kfree(priv->scan_cmd); | 2819 | kfree(il->scan_cmd); |
2820 | } | 2820 | } |
2821 | 2821 | ||
2822 | static void il4965_hw_detect(struct il_priv *priv) | 2822 | static void il4965_hw_detect(struct il_priv *il) |
2823 | { | 2823 | { |
2824 | priv->hw_rev = _il_read32(priv, CSR_HW_REV); | 2824 | il->hw_rev = _il_read32(il, CSR_HW_REV); |
2825 | priv->hw_wa_rev = _il_read32(priv, CSR_HW_REV_WA_REG); | 2825 | il->hw_wa_rev = _il_read32(il, CSR_HW_REV_WA_REG); |
2826 | priv->rev_id = priv->pci_dev->revision; | 2826 | il->rev_id = il->pci_dev->revision; |
2827 | IL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n", priv->rev_id); | 2827 | IL_DEBUG_INFO(il, "HW Revision ID = 0x%X\n", il->rev_id); |
2828 | } | 2828 | } |
2829 | 2829 | ||
2830 | static int il4965_set_hw_params(struct il_priv *priv) | 2830 | static int il4965_set_hw_params(struct il_priv *il) |
2831 | { | 2831 | { |
2832 | priv->hw_params.max_rxq_size = RX_QUEUE_SIZE; | 2832 | il->hw_params.max_rxq_size = RX_QUEUE_SIZE; |
2833 | priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG; | 2833 | il->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG; |
2834 | if (priv->cfg->mod_params->amsdu_size_8K) | 2834 | if (il->cfg->mod_params->amsdu_size_8K) |
2835 | priv->hw_params.rx_page_order = get_order(IL_RX_BUF_SIZE_8K); | 2835 | il->hw_params.rx_page_order = get_order(IL_RX_BUF_SIZE_8K); |
2836 | else | 2836 | else |
2837 | priv->hw_params.rx_page_order = get_order(IL_RX_BUF_SIZE_4K); | 2837 | il->hw_params.rx_page_order = get_order(IL_RX_BUF_SIZE_4K); |
2838 | 2838 | ||
2839 | priv->hw_params.max_beacon_itrvl = IL_MAX_UCODE_BEACON_INTERVAL; | 2839 | il->hw_params.max_beacon_itrvl = IL_MAX_UCODE_BEACON_INTERVAL; |
2840 | 2840 | ||
2841 | if (priv->cfg->mod_params->disable_11n) | 2841 | if (il->cfg->mod_params->disable_11n) |
2842 | priv->cfg->sku &= ~IL_SKU_N; | 2842 | il->cfg->sku &= ~IL_SKU_N; |
2843 | 2843 | ||
2844 | /* Device-specific setup */ | 2844 | /* Device-specific setup */ |
2845 | return priv->cfg->ops->lib->set_hw_params(priv); | 2845 | return il->cfg->ops->lib->set_hw_params(il); |
2846 | } | 2846 | } |
2847 | 2847 | ||
2848 | static const u8 il4965_bss_ac_to_fifo[] = { | 2848 | static const u8 il4965_bss_ac_to_fifo[] = { |
@@ -2860,7 +2860,7 @@ static int | |||
2860 | il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 2860 | il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
2861 | { | 2861 | { |
2862 | int err = 0, i; | 2862 | int err = 0, i; |
2863 | struct il_priv *priv; | 2863 | struct il_priv *il; |
2864 | struct ieee80211_hw *hw; | 2864 | struct ieee80211_hw *hw; |
2865 | struct il_cfg *cfg = (struct il_cfg *)(ent->driver_data); | 2865 | struct il_cfg *cfg = (struct il_cfg *)(ent->driver_data); |
2866 | unsigned long flags; | 2866 | unsigned long flags; |
@@ -2875,49 +2875,49 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2875 | err = -ENOMEM; | 2875 | err = -ENOMEM; |
2876 | goto out; | 2876 | goto out; |
2877 | } | 2877 | } |
2878 | priv = hw->priv; | 2878 | il = hw->priv; |
2879 | /* At this point both hw and priv are allocated. */ | 2879 | /* At this point both hw and il are allocated. */ |
2880 | 2880 | ||
2881 | /* | 2881 | /* |
2882 | * The default context is always valid, | 2882 | * The default context is always valid, |
2883 | * more may be discovered when firmware | 2883 | * more may be discovered when firmware |
2884 | * is loaded. | 2884 | * is loaded. |
2885 | */ | 2885 | */ |
2886 | priv->valid_contexts = BIT(IL_RXON_CTX_BSS); | 2886 | il->valid_contexts = BIT(IL_RXON_CTX_BSS); |
2887 | 2887 | ||
2888 | for (i = 0; i < NUM_IL_RXON_CTX; i++) | 2888 | for (i = 0; i < NUM_IL_RXON_CTX; i++) |
2889 | priv->contexts[i].ctxid = i; | 2889 | il->contexts[i].ctxid = i; |
2890 | 2890 | ||
2891 | priv->contexts[IL_RXON_CTX_BSS].always_active = true; | 2891 | il->contexts[IL_RXON_CTX_BSS].always_active = true; |
2892 | priv->contexts[IL_RXON_CTX_BSS].is_active = true; | 2892 | il->contexts[IL_RXON_CTX_BSS].is_active = true; |
2893 | priv->contexts[IL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON; | 2893 | il->contexts[IL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON; |
2894 | priv->contexts[IL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING; | 2894 | il->contexts[IL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING; |
2895 | priv->contexts[IL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC; | 2895 | il->contexts[IL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC; |
2896 | priv->contexts[IL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM; | 2896 | il->contexts[IL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM; |
2897 | priv->contexts[IL_RXON_CTX_BSS].ap_sta_id = IL_AP_ID; | 2897 | il->contexts[IL_RXON_CTX_BSS].ap_sta_id = IL_AP_ID; |
2898 | priv->contexts[IL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY; | 2898 | il->contexts[IL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY; |
2899 | priv->contexts[IL_RXON_CTX_BSS].ac_to_fifo = il4965_bss_ac_to_fifo; | 2899 | il->contexts[IL_RXON_CTX_BSS].ac_to_fifo = il4965_bss_ac_to_fifo; |
2900 | priv->contexts[IL_RXON_CTX_BSS].ac_to_queue = il4965_bss_ac_to_queue; | 2900 | il->contexts[IL_RXON_CTX_BSS].ac_to_queue = il4965_bss_ac_to_queue; |
2901 | priv->contexts[IL_RXON_CTX_BSS].exclusive_interface_modes = | 2901 | il->contexts[IL_RXON_CTX_BSS].exclusive_interface_modes = |
2902 | BIT(NL80211_IFTYPE_ADHOC); | 2902 | BIT(NL80211_IFTYPE_ADHOC); |
2903 | priv->contexts[IL_RXON_CTX_BSS].interface_modes = | 2903 | il->contexts[IL_RXON_CTX_BSS].interface_modes = |
2904 | BIT(NL80211_IFTYPE_STATION); | 2904 | BIT(NL80211_IFTYPE_STATION); |
2905 | priv->contexts[IL_RXON_CTX_BSS].ap_devtype = RXON_DEV_TYPE_AP; | 2905 | il->contexts[IL_RXON_CTX_BSS].ap_devtype = RXON_DEV_TYPE_AP; |
2906 | priv->contexts[IL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS; | 2906 | il->contexts[IL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS; |
2907 | priv->contexts[IL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS; | 2907 | il->contexts[IL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS; |
2908 | priv->contexts[IL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS; | 2908 | il->contexts[IL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS; |
2909 | 2909 | ||
2910 | BUILD_BUG_ON(NUM_IL_RXON_CTX != 1); | 2910 | BUILD_BUG_ON(NUM_IL_RXON_CTX != 1); |
2911 | 2911 | ||
2912 | SET_IEEE80211_DEV(hw, &pdev->dev); | 2912 | SET_IEEE80211_DEV(hw, &pdev->dev); |
2913 | 2913 | ||
2914 | IL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n"); | 2914 | IL_DEBUG_INFO(il, "*** LOAD DRIVER ***\n"); |
2915 | priv->cfg = cfg; | 2915 | il->cfg = cfg; |
2916 | priv->pci_dev = pdev; | 2916 | il->pci_dev = pdev; |
2917 | priv->inta_mask = CSR_INI_SET_MASK; | 2917 | il->inta_mask = CSR_INI_SET_MASK; |
2918 | 2918 | ||
2919 | if (il_alloc_traffic_mem(priv)) | 2919 | if (il_alloc_traffic_mem(il)) |
2920 | IL_ERR(priv, "Not enough memory to generate traffic log\n"); | 2920 | IL_ERR(il, "Not enough memory to generate traffic log\n"); |
2921 | 2921 | ||
2922 | /************************** | 2922 | /************************** |
2923 | * 2. Initializing PCI bus | 2923 | * 2. Initializing PCI bus |
@@ -2942,7 +2942,7 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2942 | DMA_BIT_MASK(32)); | 2942 | DMA_BIT_MASK(32)); |
2943 | /* both attempts failed: */ | 2943 | /* both attempts failed: */ |
2944 | if (err) { | 2944 | if (err) { |
2945 | IL_WARN(priv, "No suitable DMA available.\n"); | 2945 | IL_WARN(il, "No suitable DMA available.\n"); |
2946 | goto out_pci_disable_device; | 2946 | goto out_pci_disable_device; |
2947 | } | 2947 | } |
2948 | } | 2948 | } |
@@ -2951,46 +2951,46 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2951 | if (err) | 2951 | if (err) |
2952 | goto out_pci_disable_device; | 2952 | goto out_pci_disable_device; |
2953 | 2953 | ||
2954 | pci_set_drvdata(pdev, priv); | 2954 | pci_set_drvdata(pdev, il); |
2955 | 2955 | ||
2956 | 2956 | ||
2957 | /*********************** | 2957 | /*********************** |
2958 | * 3. Read REV register | 2958 | * 3. Read REV register |
2959 | ***********************/ | 2959 | ***********************/ |
2960 | priv->hw_base = pci_iomap(pdev, 0, 0); | 2960 | il->hw_base = pci_iomap(pdev, 0, 0); |
2961 | if (!priv->hw_base) { | 2961 | if (!il->hw_base) { |
2962 | err = -ENODEV; | 2962 | err = -ENODEV; |
2963 | goto out_pci_release_regions; | 2963 | goto out_pci_release_regions; |
2964 | } | 2964 | } |
2965 | 2965 | ||
2966 | IL_DEBUG_INFO(priv, "pci_resource_len = 0x%08llx\n", | 2966 | IL_DEBUG_INFO(il, "pci_resource_len = 0x%08llx\n", |
2967 | (unsigned long long) pci_resource_len(pdev, 0)); | 2967 | (unsigned long long) pci_resource_len(pdev, 0)); |
2968 | IL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base); | 2968 | IL_DEBUG_INFO(il, "pci_resource_base = %p\n", il->hw_base); |
2969 | 2969 | ||
2970 | /* these spin locks will be used in apm_ops.init and EEPROM access | 2970 | /* these spin locks will be used in apm_ops.init and EEPROM access |
2971 | * we should init now | 2971 | * we should init now |
2972 | */ | 2972 | */ |
2973 | spin_lock_init(&priv->reg_lock); | 2973 | spin_lock_init(&il->reg_lock); |
2974 | spin_lock_init(&priv->lock); | 2974 | spin_lock_init(&il->lock); |
2975 | 2975 | ||
2976 | /* | 2976 | /* |
2977 | * stop and reset the on-board processor just in case it is in a | 2977 | * stop and reset the on-board processor just in case it is in a |
2978 | * strange state ... like being left stranded by a primary kernel | 2978 | * strange state ... like being left stranded by a primary kernel |
2979 | * and this is now the kdump kernel trying to start up | 2979 | * and this is now the kdump kernel trying to start up |
2980 | */ | 2980 | */ |
2981 | il_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); | 2981 | il_write32(il, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); |
2982 | 2982 | ||
2983 | il4965_hw_detect(priv); | 2983 | il4965_hw_detect(il); |
2984 | IL_INFO(priv, "Detected %s, REV=0x%X\n", | 2984 | IL_INFO(il, "Detected %s, REV=0x%X\n", |
2985 | priv->cfg->name, priv->hw_rev); | 2985 | il->cfg->name, il->hw_rev); |
2986 | 2986 | ||
2987 | /* We disable the RETRY_TIMEOUT register (0x41) to keep | 2987 | /* We disable the RETRY_TIMEOUT register (0x41) to keep |
2988 | * PCI Tx retries from interfering with C3 CPU state */ | 2988 | * PCI Tx retries from interfering with C3 CPU state */ |
2989 | pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); | 2989 | pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); |
2990 | 2990 | ||
2991 | il4965_prepare_card_hw(priv); | 2991 | il4965_prepare_card_hw(il); |
2992 | if (!priv->hw_ready) { | 2992 | if (!il->hw_ready) { |
2993 | IL_WARN(priv, "Failed, HW not ready\n"); | 2993 | IL_WARN(il, "Failed, HW not ready\n"); |
2994 | goto out_iounmap; | 2994 | goto out_iounmap; |
2995 | } | 2995 | } |
2996 | 2996 | ||
@@ -2998,12 +2998,12 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2998 | * 4. Read EEPROM | 2998 | * 4. Read EEPROM |
2999 | *****************/ | 2999 | *****************/ |
3000 | /* Read the EEPROM */ | 3000 | /* Read the EEPROM */ |
3001 | err = il_eeprom_init(priv); | 3001 | err = il_eeprom_init(il); |
3002 | if (err) { | 3002 | if (err) { |
3003 | IL_ERR(priv, "Unable to init EEPROM\n"); | 3003 | IL_ERR(il, "Unable to init EEPROM\n"); |
3004 | goto out_iounmap; | 3004 | goto out_iounmap; |
3005 | } | 3005 | } |
3006 | err = il4965_eeprom_check_version(priv); | 3006 | err = il4965_eeprom_check_version(il); |
3007 | if (err) | 3007 | if (err) |
3008 | goto out_free_eeprom; | 3008 | goto out_free_eeprom; |
3009 | 3009 | ||
@@ -3011,131 +3011,131 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3011 | goto out_free_eeprom; | 3011 | goto out_free_eeprom; |
3012 | 3012 | ||
3013 | /* extract MAC Address */ | 3013 | /* extract MAC Address */ |
3014 | il4965_eeprom_get_mac(priv, priv->addresses[0].addr); | 3014 | il4965_eeprom_get_mac(il, il->addresses[0].addr); |
3015 | IL_DEBUG_INFO(priv, "MAC address: %pM\n", priv->addresses[0].addr); | 3015 | IL_DEBUG_INFO(il, "MAC address: %pM\n", il->addresses[0].addr); |
3016 | priv->hw->wiphy->addresses = priv->addresses; | 3016 | il->hw->wiphy->addresses = il->addresses; |
3017 | priv->hw->wiphy->n_addresses = 1; | 3017 | il->hw->wiphy->n_addresses = 1; |
3018 | 3018 | ||
3019 | /************************ | 3019 | /************************ |
3020 | * 5. Setup HW constants | 3020 | * 5. Setup HW constants |
3021 | ************************/ | 3021 | ************************/ |
3022 | if (il4965_set_hw_params(priv)) { | 3022 | if (il4965_set_hw_params(il)) { |
3023 | IL_ERR(priv, "failed to set hw parameters\n"); | 3023 | IL_ERR(il, "failed to set hw parameters\n"); |
3024 | goto out_free_eeprom; | 3024 | goto out_free_eeprom; |
3025 | } | 3025 | } |
3026 | 3026 | ||
3027 | /******************* | 3027 | /******************* |
3028 | * 6. Setup priv | 3028 | * 6. Setup il |
3029 | *******************/ | 3029 | *******************/ |
3030 | 3030 | ||
3031 | err = il4965_init_drv(priv); | 3031 | err = il4965_init_drv(il); |
3032 | if (err) | 3032 | if (err) |
3033 | goto out_free_eeprom; | 3033 | goto out_free_eeprom; |
3034 | /* At this point both hw and priv are initialized. */ | 3034 | /* At this point both hw and il are initialized. */ |
3035 | 3035 | ||
3036 | /******************** | 3036 | /******************** |
3037 | * 7. Setup services | 3037 | * 7. Setup services |
3038 | ********************/ | 3038 | ********************/ |
3039 | spin_lock_irqsave(&priv->lock, flags); | 3039 | spin_lock_irqsave(&il->lock, flags); |
3040 | il_disable_interrupts(priv); | 3040 | il_disable_interrupts(il); |
3041 | spin_unlock_irqrestore(&priv->lock, flags); | 3041 | spin_unlock_irqrestore(&il->lock, flags); |
3042 | 3042 | ||
3043 | pci_enable_msi(priv->pci_dev); | 3043 | pci_enable_msi(il->pci_dev); |
3044 | 3044 | ||
3045 | err = request_irq(priv->pci_dev->irq, il_isr, | 3045 | err = request_irq(il->pci_dev->irq, il_isr, |
3046 | IRQF_SHARED, DRV_NAME, priv); | 3046 | IRQF_SHARED, DRV_NAME, il); |
3047 | if (err) { | 3047 | if (err) { |
3048 | IL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq); | 3048 | IL_ERR(il, "Error allocating IRQ %d\n", il->pci_dev->irq); |
3049 | goto out_disable_msi; | 3049 | goto out_disable_msi; |
3050 | } | 3050 | } |
3051 | 3051 | ||
3052 | il4965_setup_deferred_work(priv); | 3052 | il4965_setup_deferred_work(il); |
3053 | il4965_setup_rx_handlers(priv); | 3053 | il4965_setup_rx_handlers(il); |
3054 | 3054 | ||
3055 | /********************************************* | 3055 | /********************************************* |
3056 | * 8. Enable interrupts and read RFKILL state | 3056 | * 8. Enable interrupts and read RFKILL state |
3057 | *********************************************/ | 3057 | *********************************************/ |
3058 | 3058 | ||
3059 | /* enable rfkill interrupt: hw bug w/a */ | 3059 | /* enable rfkill interrupt: hw bug w/a */ |
3060 | pci_read_config_word(priv->pci_dev, PCI_COMMAND, &pci_cmd); | 3060 | pci_read_config_word(il->pci_dev, PCI_COMMAND, &pci_cmd); |
3061 | if (pci_cmd & PCI_COMMAND_INTX_DISABLE) { | 3061 | if (pci_cmd & PCI_COMMAND_INTX_DISABLE) { |
3062 | pci_cmd &= ~PCI_COMMAND_INTX_DISABLE; | 3062 | pci_cmd &= ~PCI_COMMAND_INTX_DISABLE; |
3063 | pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd); | 3063 | pci_write_config_word(il->pci_dev, PCI_COMMAND, pci_cmd); |
3064 | } | 3064 | } |
3065 | 3065 | ||
3066 | il_enable_rfkill_int(priv); | 3066 | il_enable_rfkill_int(il); |
3067 | 3067 | ||
3068 | /* If platform's RF_KILL switch is NOT set to KILL */ | 3068 | /* If platform's RF_KILL switch is NOT set to KILL */ |
3069 | if (il_read32(priv, CSR_GP_CNTRL) & | 3069 | if (il_read32(il, CSR_GP_CNTRL) & |
3070 | CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) | 3070 | CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) |
3071 | clear_bit(STATUS_RF_KILL_HW, &priv->status); | 3071 | clear_bit(STATUS_RF_KILL_HW, &il->status); |
3072 | else | 3072 | else |
3073 | set_bit(STATUS_RF_KILL_HW, &priv->status); | 3073 | set_bit(STATUS_RF_KILL_HW, &il->status); |
3074 | 3074 | ||
3075 | wiphy_rfkill_set_hw_state(priv->hw->wiphy, | 3075 | wiphy_rfkill_set_hw_state(il->hw->wiphy, |
3076 | test_bit(STATUS_RF_KILL_HW, &priv->status)); | 3076 | test_bit(STATUS_RF_KILL_HW, &il->status)); |
3077 | 3077 | ||
3078 | il_power_initialize(priv); | 3078 | il_power_initialize(il); |
3079 | 3079 | ||
3080 | init_completion(&priv->_4965.firmware_loading_complete); | 3080 | init_completion(&il->_4965.firmware_loading_complete); |
3081 | 3081 | ||
3082 | err = il4965_request_firmware(priv, true); | 3082 | err = il4965_request_firmware(il, true); |
3083 | if (err) | 3083 | if (err) |
3084 | goto out_destroy_workqueue; | 3084 | goto out_destroy_workqueue; |
3085 | 3085 | ||
3086 | return 0; | 3086 | return 0; |
3087 | 3087 | ||
3088 | out_destroy_workqueue: | 3088 | out_destroy_workqueue: |
3089 | destroy_workqueue(priv->workqueue); | 3089 | destroy_workqueue(il->workqueue); |
3090 | priv->workqueue = NULL; | 3090 | il->workqueue = NULL; |
3091 | free_irq(priv->pci_dev->irq, priv); | 3091 | free_irq(il->pci_dev->irq, il); |
3092 | out_disable_msi: | 3092 | out_disable_msi: |
3093 | pci_disable_msi(priv->pci_dev); | 3093 | pci_disable_msi(il->pci_dev); |
3094 | il4965_uninit_drv(priv); | 3094 | il4965_uninit_drv(il); |
3095 | out_free_eeprom: | 3095 | out_free_eeprom: |
3096 | il_eeprom_free(priv); | 3096 | il_eeprom_free(il); |
3097 | out_iounmap: | 3097 | out_iounmap: |
3098 | pci_iounmap(pdev, priv->hw_base); | 3098 | pci_iounmap(pdev, il->hw_base); |
3099 | out_pci_release_regions: | 3099 | out_pci_release_regions: |
3100 | pci_set_drvdata(pdev, NULL); | 3100 | pci_set_drvdata(pdev, NULL); |
3101 | pci_release_regions(pdev); | 3101 | pci_release_regions(pdev); |
3102 | out_pci_disable_device: | 3102 | out_pci_disable_device: |
3103 | pci_disable_device(pdev); | 3103 | pci_disable_device(pdev); |
3104 | out_ieee80211_free_hw: | 3104 | out_ieee80211_free_hw: |
3105 | il_free_traffic_mem(priv); | 3105 | il_free_traffic_mem(il); |
3106 | ieee80211_free_hw(priv->hw); | 3106 | ieee80211_free_hw(il->hw); |
3107 | out: | 3107 | out: |
3108 | return err; | 3108 | return err; |
3109 | } | 3109 | } |
3110 | 3110 | ||
3111 | static void __devexit il4965_pci_remove(struct pci_dev *pdev) | 3111 | static void __devexit il4965_pci_remove(struct pci_dev *pdev) |
3112 | { | 3112 | { |
3113 | struct il_priv *priv = pci_get_drvdata(pdev); | 3113 | struct il_priv *il = pci_get_drvdata(pdev); |
3114 | unsigned long flags; | 3114 | unsigned long flags; |
3115 | 3115 | ||
3116 | if (!priv) | 3116 | if (!il) |
3117 | return; | 3117 | return; |
3118 | 3118 | ||
3119 | wait_for_completion(&priv->_4965.firmware_loading_complete); | 3119 | wait_for_completion(&il->_4965.firmware_loading_complete); |
3120 | 3120 | ||
3121 | IL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); | 3121 | IL_DEBUG_INFO(il, "*** UNLOAD DRIVER ***\n"); |
3122 | 3122 | ||
3123 | il_dbgfs_unregister(priv); | 3123 | il_dbgfs_unregister(il); |
3124 | sysfs_remove_group(&pdev->dev.kobj, &il_attribute_group); | 3124 | sysfs_remove_group(&pdev->dev.kobj, &il_attribute_group); |
3125 | 3125 | ||
3126 | /* ieee80211_unregister_hw call wil cause il_mac_stop to | 3126 | /* ieee80211_unregister_hw call wil cause il_mac_stop to |
3127 | * to be called and il4965_down since we are removing the device | 3127 | * to be called and il4965_down since we are removing the device |
3128 | * we need to set STATUS_EXIT_PENDING bit. | 3128 | * we need to set STATUS_EXIT_PENDING bit. |
3129 | */ | 3129 | */ |
3130 | set_bit(STATUS_EXIT_PENDING, &priv->status); | 3130 | set_bit(STATUS_EXIT_PENDING, &il->status); |
3131 | 3131 | ||
3132 | il_leds_exit(priv); | 3132 | il_leds_exit(il); |
3133 | 3133 | ||
3134 | if (priv->mac80211_registered) { | 3134 | if (il->mac80211_registered) { |
3135 | ieee80211_unregister_hw(priv->hw); | 3135 | ieee80211_unregister_hw(il->hw); |
3136 | priv->mac80211_registered = 0; | 3136 | il->mac80211_registered = 0; |
3137 | } else { | 3137 | } else { |
3138 | il4965_down(priv); | 3138 | il4965_down(il); |
3139 | } | 3139 | } |
3140 | 3140 | ||
3141 | /* | 3141 | /* |
@@ -3145,57 +3145,57 @@ static void __devexit il4965_pci_remove(struct pci_dev *pdev) | |||
3145 | * paths to avoid running il4965_down() at all before leaving driver. | 3145 | * paths to avoid running il4965_down() at all before leaving driver. |
3146 | * This (inexpensive) call *makes sure* device is reset. | 3146 | * This (inexpensive) call *makes sure* device is reset. |
3147 | */ | 3147 | */ |
3148 | il_apm_stop(priv); | 3148 | il_apm_stop(il); |
3149 | 3149 | ||
3150 | /* make sure we flush any pending irq or | 3150 | /* make sure we flush any pending irq or |
3151 | * tasklet for the driver | 3151 | * tasklet for the driver |
3152 | */ | 3152 | */ |
3153 | spin_lock_irqsave(&priv->lock, flags); | 3153 | spin_lock_irqsave(&il->lock, flags); |
3154 | il_disable_interrupts(priv); | 3154 | il_disable_interrupts(il); |
3155 | spin_unlock_irqrestore(&priv->lock, flags); | 3155 | spin_unlock_irqrestore(&il->lock, flags); |
3156 | 3156 | ||
3157 | il4965_synchronize_irq(priv); | 3157 | il4965_synchronize_irq(il); |
3158 | 3158 | ||
3159 | il4965_dealloc_ucode_pci(priv); | 3159 | il4965_dealloc_ucode_pci(il); |
3160 | 3160 | ||
3161 | if (priv->rxq.bd) | 3161 | if (il->rxq.bd) |
3162 | il4965_rx_queue_free(priv, &priv->rxq); | 3162 | il4965_rx_queue_free(il, &il->rxq); |
3163 | il4965_hw_txq_ctx_free(priv); | 3163 | il4965_hw_txq_ctx_free(il); |
3164 | 3164 | ||
3165 | il_eeprom_free(priv); | 3165 | il_eeprom_free(il); |
3166 | 3166 | ||
3167 | 3167 | ||
3168 | /*netif_stop_queue(dev); */ | 3168 | /*netif_stop_queue(dev); */ |
3169 | flush_workqueue(priv->workqueue); | 3169 | flush_workqueue(il->workqueue); |
3170 | 3170 | ||
3171 | /* ieee80211_unregister_hw calls il_mac_stop, which flushes | 3171 | /* ieee80211_unregister_hw calls il_mac_stop, which flushes |
3172 | * priv->workqueue... so we can't take down the workqueue | 3172 | * il->workqueue... so we can't take down the workqueue |
3173 | * until now... */ | 3173 | * until now... */ |
3174 | destroy_workqueue(priv->workqueue); | 3174 | destroy_workqueue(il->workqueue); |
3175 | priv->workqueue = NULL; | 3175 | il->workqueue = NULL; |
3176 | il_free_traffic_mem(priv); | 3176 | il_free_traffic_mem(il); |
3177 | 3177 | ||
3178 | free_irq(priv->pci_dev->irq, priv); | 3178 | free_irq(il->pci_dev->irq, il); |
3179 | pci_disable_msi(priv->pci_dev); | 3179 | pci_disable_msi(il->pci_dev); |
3180 | pci_iounmap(pdev, priv->hw_base); | 3180 | pci_iounmap(pdev, il->hw_base); |
3181 | pci_release_regions(pdev); | 3181 | pci_release_regions(pdev); |
3182 | pci_disable_device(pdev); | 3182 | pci_disable_device(pdev); |
3183 | pci_set_drvdata(pdev, NULL); | 3183 | pci_set_drvdata(pdev, NULL); |
3184 | 3184 | ||
3185 | il4965_uninit_drv(priv); | 3185 | il4965_uninit_drv(il); |
3186 | 3186 | ||
3187 | dev_kfree_skb(priv->beacon_skb); | 3187 | dev_kfree_skb(il->beacon_skb); |
3188 | 3188 | ||
3189 | ieee80211_free_hw(priv->hw); | 3189 | ieee80211_free_hw(il->hw); |
3190 | } | 3190 | } |
3191 | 3191 | ||
3192 | /* | 3192 | /* |
3193 | * Activate/Deactivate Tx DMA/FIFO channels according tx fifos mask | 3193 | * Activate/Deactivate Tx DMA/FIFO channels according tx fifos mask |
3194 | * must be called under priv->lock and mac access | 3194 | * must be called under il->lock and mac access |
3195 | */ | 3195 | */ |
3196 | void il4965_txq_set_sched(struct il_priv *priv, u32 mask) | 3196 | void il4965_txq_set_sched(struct il_priv *il, u32 mask) |
3197 | { | 3197 | { |
3198 | il_write_prph(priv, IWL49_SCD_TXFACT, mask); | 3198 | il_write_prph(il, IWL49_SCD_TXFACT, mask); |
3199 | } | 3199 | } |
3200 | 3200 | ||
3201 | /***************************************************************************** | 3201 | /***************************************************************************** |