aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-3945-hw.h6
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-3945-rs.c110
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-3945.c314
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-hw.h36
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-lib.c4
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-rs.c290
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-sta.c14
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-tx.c34
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965.c84
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965.h4
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-commands.h42
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-csr.h6
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-dev.h34
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-eeprom.c30
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-eeprom.h2
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-fh.h30
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-helpers.h16
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-led.c2
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-legacy-rs.h6
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-prph.h18
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-rx.c22
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-sta.c14
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-sta.h2
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-tx.c36
-rw-r--r--drivers/net/wireless/iwlegacy/iwl3945-base.c44
-rw-r--r--drivers/net/wireless/iwlegacy/iwl4965-base.c36
26 files changed, 618 insertions, 618 deletions
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-hw.h b/drivers/net/wireless/iwlegacy/iwl-3945-hw.h
index fcb466a2f065..53e5fb4373d9 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945-hw.h
+++ b/drivers/net/wireless/iwlegacy/iwl-3945-hw.h
@@ -81,7 +81,7 @@
81 81
82/* 82/*
83 * Mapping of a Tx power level, at factory calibration temperature, 83 * Mapping of a Tx power level, at factory calibration temperature,
84 * to a radio/DSP gain table index. 84 * to a radio/DSP gain table idx.
85 * One for each of 5 "sample" power levels in each band. 85 * One for each of 5 "sample" power levels in each band.
86 * v_det is measured at the factory, using the 3945's built-in power amplifier 86 * v_det is measured at the factory, using the 3945's built-in power amplifier
87 * (PA) output voltage detector. This same detector is used during Tx of 87 * (PA) output voltage detector. This same detector is used during Tx of
@@ -91,13 +91,13 @@
91 * DO NOT ALTER THIS STRUCTURE!!! 91 * DO NOT ALTER THIS STRUCTURE!!!
92 */ 92 */
93struct il3945_eeprom_txpower_sample { 93struct il3945_eeprom_txpower_sample {
94 u8 gain_index; /* index into power (gain) setup table ... */ 94 u8 gain_idx; /* idx into power (gain) setup table ... */
95 s8 power; /* ... for this pwr level for this chnl group */ 95 s8 power; /* ... for this pwr level for this chnl group */
96 u16 v_det; /* PA output voltage */ 96 u16 v_det; /* PA output voltage */
97} __packed; 97} __packed;
98 98
99/* 99/*
100 * Mappings of Tx power levels -> nominal radio/DSP gain table indexes. 100 * Mappings of Tx power levels -> nominal radio/DSP gain table idxes.
101 * One for each channel group (a.k.a. "band") (1 for BG, 4 for A). 101 * One for each channel group (a.k.a. "band") (1 for BG, 4 for A).
102 * Tx power setup code interpolates between the 5 "sample" power levels 102 * Tx power setup code interpolates between the 5 "sample" power levels
103 * to determine the nominal setup for a requested power level. 103 * to determine the nominal setup for a requested power level.
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-rs.c b/drivers/net/wireless/iwlegacy/iwl-3945-rs.c
index 4d83c6292246..f84ed5ecc676 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-3945-rs.c
@@ -60,7 +60,7 @@ static s32 il3945_expected_tpt_b[RATE_COUNT_3945] = {
60 60
61struct il3945_tpt_entry { 61struct il3945_tpt_entry {
62 s8 min_rssi; 62 s8 min_rssi;
63 u8 index; 63 u8 idx;
64}; 64};
65 65
66static struct il3945_tpt_entry il3945_tpt_table_a[] = { 66static struct il3945_tpt_entry il3945_tpt_table_a[] = {
@@ -98,9 +98,9 @@ static struct il3945_tpt_entry il3945_tpt_table_g[] = {
98#define RATE_DECREASE_TH 1920 98#define RATE_DECREASE_TH 1920
99#define RATE_RETRY_TH 15 99#define RATE_RETRY_TH 15
100 100
101static u8 il3945_get_rate_index_by_rssi(s32 rssi, enum ieee80211_band band) 101static u8 il3945_get_rate_idx_by_rssi(s32 rssi, enum ieee80211_band band)
102{ 102{
103 u32 index = 0; 103 u32 idx = 0;
104 u32 table_size = 0; 104 u32 table_size = 0;
105 struct il3945_tpt_entry *tpt_table = NULL; 105 struct il3945_tpt_entry *tpt_table = NULL;
106 106
@@ -123,12 +123,12 @@ static u8 il3945_get_rate_index_by_rssi(s32 rssi, enum ieee80211_band band)
123 break; 123 break;
124 } 124 }
125 125
126 while (index < table_size && rssi < tpt_table[index].min_rssi) 126 while (idx < table_size && rssi < tpt_table[idx].min_rssi)
127 index++; 127 idx++;
128 128
129 index = min(index, (table_size - 1)); 129 idx = min(idx, (table_size - 1));
130 130
131 return tpt_table[index].index; 131 return tpt_table[idx].idx;
132} 132}
133 133
134static void il3945_clear_win(struct il3945_rate_scale_data *win) 134static void il3945_clear_win(struct il3945_rate_scale_data *win)
@@ -168,7 +168,7 @@ static int il3945_rate_scale_flush_wins(struct il3945_rs_sta *rs_sta)
168 if (time_after(jiffies, rs_sta->win[i].stamp + 168 if (time_after(jiffies, rs_sta->win[i].stamp +
169 RATE_WIN_FLUSH)) { 169 RATE_WIN_FLUSH)) {
170 D_RATE("flushing %d samples of rate " 170 D_RATE("flushing %d samples of rate "
171 "index %d\n", 171 "idx %d\n",
172 rs_sta->win[i].counter, i); 172 rs_sta->win[i].counter, i);
173 il3945_clear_win(&rs_sta->win[i]); 173 il3945_clear_win(&rs_sta->win[i]);
174 } else 174 } else
@@ -256,7 +256,7 @@ static void il3945_bg_rate_scale_flush(unsigned long data)
256 */ 256 */
257static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta, 257static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta,
258 struct il3945_rate_scale_data *win, 258 struct il3945_rate_scale_data *win,
259 int success, int retries, int index) 259 int success, int retries, int idx)
260{ 260{
261 unsigned long flags; 261 unsigned long flags;
262 s32 fail_count; 262 s32 fail_count;
@@ -318,7 +318,7 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta,
318 if (fail_count >= RATE_MIN_FAILURE_TH || 318 if (fail_count >= RATE_MIN_FAILURE_TH ||
319 win->success_counter >= RATE_MIN_SUCCESS_TH) 319 win->success_counter >= RATE_MIN_SUCCESS_TH)
320 win->average_tpt = ((win->success_ratio * 320 win->average_tpt = ((win->success_ratio *
321 rs_sta->expected_tpt[index] + 64) / 128); 321 rs_sta->expected_tpt[idx] + 64) / 128);
322 else 322 else
323 win->average_tpt = IL_INVALID_VALUE; 323 win->average_tpt = IL_INVALID_VALUE;
324 324
@@ -447,7 +447,7 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *
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_idx, first_idx, last_idx;
451 unsigned long flags; 451 unsigned long flags;
452 struct il_priv *il = (struct il_priv *)il_rate; 452 struct il_priv *il = (struct il_priv *)il_rate;
453 struct il3945_rs_sta *rs_sta = il_sta; 453 struct il3945_rs_sta *rs_sta = il_sta;
@@ -460,9 +460,9 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *
460 if (retries > RATE_RETRY_TH) 460 if (retries > RATE_RETRY_TH)
461 retries = RATE_RETRY_TH; 461 retries = RATE_RETRY_TH;
462 462
463 first_index = sband->bitrates[info->status.rates[0].idx].hw_value; 463 first_idx = sband->bitrates[info->status.rates[0].idx].hw_value;
464 if (first_index < 0 || first_index >= RATE_COUNT_3945) { 464 if (first_idx < 0 || first_idx >= RATE_COUNT_3945) {
465 D_RATE("leave: Rate out of bounds: %d\n", first_index); 465 D_RATE("leave: Rate out of bounds: %d\n", first_idx);
466 return; 466 return;
467 } 467 }
468 468
@@ -480,8 +480,8 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *
480 480
481 rs_sta->tx_packets++; 481 rs_sta->tx_packets++;
482 482
483 scale_rate_index = first_index; 483 scale_rate_idx = first_idx;
484 last_index = first_index; 484 last_idx = first_idx;
485 485
486 /* 486 /*
487 * Update the win for each rate. We determine which rates 487 * Update the win for each rate. We determine which rates
@@ -489,42 +489,42 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *
489 * of retries configured for each rate -- currently set to the 489 * of retries configured for each rate -- currently set to the
490 * il 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_idx 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) < il->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_idx = scale_rate_idx;
500 } else { 500 } else {
501 current_count = il->retry_rate; 501 current_count = il->retry_rate;
502 last_index = il3945_rs_next_rate(il, 502 last_idx = il3945_rs_next_rate(il,
503 scale_rate_index); 503 scale_rate_idx);
504 } 504 }
505 505
506 /* Update this rate accounting for as many retries 506 /* Update this rate accounting for as many retries
507 * as was used for it (per current_count) */ 507 * as was used for it (per current_count) */
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_idx],
510 0, current_count, scale_rate_index); 510 0, current_count, scale_rate_idx);
511 D_RATE("Update rate %d for %d retries.\n", 511 D_RATE("Update rate %d for %d retries.\n",
512 scale_rate_index, current_count); 512 scale_rate_idx, current_count);
513 513
514 retries -= current_count; 514 retries -= current_count;
515 515
516 scale_rate_index = last_index; 516 scale_rate_idx = last_idx;
517 } 517 }
518 518
519 519
520 /* Update the last index win with success/failure based on ACK */ 520 /* Update the last idx win with success/failure based on ACK */
521 D_RATE("Update rate %d with %s.\n", 521 D_RATE("Update rate %d with %s.\n",
522 last_index, 522 last_idx,
523 (info->flags & IEEE80211_TX_STAT_ACK) ? 523 (info->flags & IEEE80211_TX_STAT_ACK) ?
524 "success" : "failure"); 524 "success" : "failure");
525 il3945_collect_tx_data(rs_sta, 525 il3945_collect_tx_data(rs_sta,
526 &rs_sta->win[last_index], 526 &rs_sta->win[last_idx],
527 info->flags & IEEE80211_TX_STAT_ACK, 1, last_index); 527 info->flags & IEEE80211_TX_STAT_ACK, 1, last_idx);
528 528
529 /* We updated the rate scale win -- if its been more than 529 /* We updated the rate scale win -- if its been more than
530 * flush_time since the last run, schedule the flush 530 * flush_time since the last run, schedule the flush
@@ -547,7 +547,7 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *
547} 547}
548 548
549static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, 549static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
550 u8 index, u16 rate_mask, enum ieee80211_band band) 550 u8 idx, u16 rate_mask, enum ieee80211_band band)
551{ 551{
552 u8 high = RATE_INVALID; 552 u8 high = RATE_INVALID;
553 u8 low = RATE_INVALID; 553 u8 low = RATE_INVALID;
@@ -560,7 +560,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
560 u32 mask; 560 u32 mask;
561 561
562 /* Find the previous rate that is in the rate mask */ 562 /* Find the previous rate that is in the rate mask */
563 i = index - 1; 563 i = idx - 1;
564 for (mask = (1 << i); i >= 0; i--, mask >>= 1) { 564 for (mask = (1 << i); i >= 0; i--, mask >>= 1) {
565 if (rate_mask & mask) { 565 if (rate_mask & mask) {
566 low = i; 566 low = i;
@@ -569,7 +569,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
569 } 569 }
570 570
571 /* Find the next rate that is in the rate mask */ 571 /* Find the next rate that is in the rate mask */
572 i = index + 1; 572 i = idx + 1;
573 for (mask = (1 << i); i < RATE_COUNT_3945; 573 for (mask = (1 << i); i < RATE_COUNT_3945;
574 i++, mask <<= 1) { 574 i++, mask <<= 1) {
575 if (rate_mask & mask) { 575 if (rate_mask & mask) {
@@ -581,7 +581,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
581 return (high << 8) | low; 581 return (high << 8) | low;
582 } 582 }
583 583
584 low = index; 584 low = idx;
585 while (low != RATE_INVALID) { 585 while (low != RATE_INVALID) {
586 if (rs_sta->tgg) 586 if (rs_sta->tgg)
587 low = il3945_rates[low].prev_rs_tgg; 587 low = il3945_rates[low].prev_rs_tgg;
@@ -594,7 +594,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
594 D_RATE("Skipping masked lower rate: %d\n", low); 594 D_RATE("Skipping masked lower rate: %d\n", low);
595 } 595 }
596 596
597 high = index; 597 high = idx;
598 while (high != RATE_INVALID) { 598 while (high != RATE_INVALID) {
599 if (rs_sta->tgg) 599 if (rs_sta->tgg)
600 high = il3945_rates[high].next_rs_tgg; 600 high = il3945_rates[high].next_rs_tgg;
@@ -622,7 +622,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
622 * the entire A/B/G spectrum vs. being limited to just one particular 622 * the entire A/B/G spectrum vs. being limited to just one particular
623 * hw_mode. 623 * hw_mode.
624 * 624 *
625 * As such, we can't convert the index obtained below into the hw_mode's 625 * As such, we can't convert the idx obtained below into the hw_mode's
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 */
@@ -634,7 +634,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
634 u8 low = RATE_INVALID; 634 u8 low = RATE_INVALID;
635 u8 high = RATE_INVALID; 635 u8 high = RATE_INVALID;
636 u16 high_low; 636 u16 high_low;
637 int index; 637 int idx;
638 struct il3945_rs_sta *rs_sta = il_sta; 638 struct il3945_rs_sta *rs_sta = il_sta;
639 struct il3945_rate_scale_data *win = NULL; 639 struct il3945_rate_scale_data *win = NULL;
640 int current_tpt = IL_INVALID_VALUE; 640 int current_tpt = IL_INVALID_VALUE;
@@ -668,7 +668,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
668 if (max_rate_idx < 0 || max_rate_idx >= RATE_COUNT) 668 if (max_rate_idx < 0 || max_rate_idx >= RATE_COUNT)
669 max_rate_idx = -1; 669 max_rate_idx = -1;
670 670
671 index = min(rs_sta->last_txrate_idx & 0xffff, RATE_COUNT_3945 - 1); 671 idx = min(rs_sta->last_txrate_idx & 0xffff, RATE_COUNT_3945 - 1);
672 672
673 if (sband->band == IEEE80211_BAND_5GHZ) 673 if (sband->band == IEEE80211_BAND_5GHZ)
674 rate_mask = rate_mask << IL_FIRST_OFDM_RATE; 674 rate_mask = rate_mask << IL_FIRST_OFDM_RATE;
@@ -679,19 +679,19 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
679 * to rssi value 679 * to rssi value
680 */ 680 */
681 if (rs_sta->start_rate != RATE_INVALID) { 681 if (rs_sta->start_rate != RATE_INVALID) {
682 if (rs_sta->start_rate < index && 682 if (rs_sta->start_rate < idx &&
683 (rate_mask & (1 << rs_sta->start_rate))) 683 (rate_mask & (1 << rs_sta->start_rate)))
684 index = rs_sta->start_rate; 684 idx = rs_sta->start_rate;
685 rs_sta->start_rate = RATE_INVALID; 685 rs_sta->start_rate = RATE_INVALID;
686 } 686 }
687 687
688 /* force user max rate if set by user */ 688 /* force user max rate if set by user */
689 if (max_rate_idx != -1 && max_rate_idx < index) { 689 if (max_rate_idx != -1 && max_rate_idx < idx) {
690 if (rate_mask & (1 << max_rate_idx)) 690 if (rate_mask & (1 << max_rate_idx))
691 index = max_rate_idx; 691 idx = max_rate_idx;
692 } 692 }
693 693
694 win = &(rs_sta->win[index]); 694 win = &(rs_sta->win[idx]);
695 695
696 fail_count = win->counter - win->success_counter; 696 fail_count = win->counter - win->success_counter;
697 697
@@ -702,7 +702,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
702 D_RATE("Invalid average_tpt on rate %d: " 702 D_RATE("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 idx,
706 win->counter, 706 win->counter,
707 win->success_counter, 707 win->success_counter,
708 rs_sta->expected_tpt ? "not " : ""); 708 rs_sta->expected_tpt ? "not " : "");
@@ -715,7 +715,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
715 715
716 current_tpt = win->average_tpt; 716 current_tpt = win->average_tpt;
717 717
718 high_low = il3945_get_adjacent_rate(rs_sta, index, rate_mask, 718 high_low = il3945_get_adjacent_rate(rs_sta, idx, rate_mask,
719 sband->band); 719 sband->band);
720 low = high_low & 0xff; 720 low = high_low & 0xff;
721 high = (high_low >> 8) & 0xff; 721 high = (high_low >> 8) & 0xff;
@@ -800,13 +800,13 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
800 800
801 /* Decrese rate */ 801 /* Decrese rate */
802 if (low != RATE_INVALID) 802 if (low != RATE_INVALID)
803 index = low; 803 idx = low;
804 break; 804 break;
805 805
806 case 1: 806 case 1:
807 /* Increase rate */ 807 /* Increase rate */
808 if (high != RATE_INVALID) 808 if (high != RATE_INVALID)
809 index = high; 809 idx = high;
810 810
811 break; 811 break;
812 812
@@ -817,21 +817,21 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
817 } 817 }
818 818
819 D_RATE("Selected %d (action %d) - low %d high %d\n", 819 D_RATE("Selected %d (action %d) - low %d high %d\n",
820 index, scale_action, low, high); 820 idx, scale_action, low, high);
821 821
822 out: 822 out:
823 823
824 if (sband->band == IEEE80211_BAND_5GHZ) { 824 if (sband->band == IEEE80211_BAND_5GHZ) {
825 if (WARN_ON_ONCE(index < IL_FIRST_OFDM_RATE)) 825 if (WARN_ON_ONCE(idx < IL_FIRST_OFDM_RATE))
826 index = IL_FIRST_OFDM_RATE; 826 idx = IL_FIRST_OFDM_RATE;
827 rs_sta->last_txrate_idx = index; 827 rs_sta->last_txrate_idx = idx;
828 info->control.rates[0].idx = index - IL_FIRST_OFDM_RATE; 828 info->control.rates[0].idx = idx - IL_FIRST_OFDM_RATE;
829 } else { 829 } else {
830 rs_sta->last_txrate_idx = index; 830 rs_sta->last_txrate_idx = idx;
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 D_RATE("leave: %d\n", index); 834 D_RATE("leave: %d\n", idx);
835} 835}
836 836
837#ifdef CONFIG_MAC80211_DEBUGFS 837#ifdef CONFIG_MAC80211_DEBUGFS
@@ -855,7 +855,7 @@ static ssize_t il3945_sta_dbgfs_stats_table_read(struct file *file,
855 if (!buff) 855 if (!buff)
856 return -ENOMEM; 856 return -ENOMEM;
857 857
858 desc += sprintf(buff + desc, "tx packets=%d last rate index=%d\n" 858 desc += sprintf(buff + desc, "tx packets=%d last rate idx=%d\n"
859 "rate=0x%X flush time %d\n", 859 "rate=0x%X flush time %d\n",
860 lq_sta->tx_packets, 860 lq_sta->tx_packets,
861 lq_sta->last_txrate_idx, 861 lq_sta->last_txrate_idx,
@@ -977,9 +977,9 @@ void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
977 977
978 D_RATE("Network RSSI: %d\n", rssi); 978 D_RATE("Network RSSI: %d\n", rssi);
979 979
980 rs_sta->start_rate = il3945_get_rate_index_by_rssi(rssi, il->band); 980 rs_sta->start_rate = il3945_get_rate_idx_by_rssi(rssi, il->band);
981 981
982 D_RATE("leave: rssi %d assign rate index: " 982 D_RATE("leave: rssi %d assign rate idx: "
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 3908bff8e0ac..96a762804944 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945.c
+++ b/drivers/net/wireless/iwlegacy/iwl-3945.c
@@ -86,12 +86,12 @@ const struct il3945_rate_info il3945_rates[RATE_COUNT_3945] = {
86 IL_DECLARE_RATE_INFO(54, 48, INV, 48, INV, 48, INV),/* 54mbps */ 86 IL_DECLARE_RATE_INFO(54, 48, INV, 48, INV, 48, INV),/* 54mbps */
87}; 87};
88 88
89static inline u8 il3945_get_prev_ieee_rate(u8 rate_index) 89static inline u8 il3945_get_prev_ieee_rate(u8 rate_idx)
90{ 90{
91 u8 rate = il3945_rates[rate_index].prev_ieee; 91 u8 rate = il3945_rates[rate_idx].prev_ieee;
92 92
93 if (rate == RATE_INVALID) 93 if (rate == RATE_INVALID)
94 rate = rate_index; 94 rate = rate_idx;
95 return rate; 95 return rate;
96} 96}
97 97
@@ -270,12 +270,12 @@ int il3945_rs_next_rate(struct il_priv *il, int rate)
270/** 270/**
271 * il3945_tx_queue_reclaim - Reclaim Tx queue entries already Tx'd 271 * il3945_tx_queue_reclaim - Reclaim Tx queue entries already Tx'd
272 * 272 *
273 * When FW advances 'R' index, all entries between old and new 'R' index 273 * When FW advances 'R' idx, all entries between old and new 'R' idx
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 */
277static void il3945_tx_queue_reclaim(struct il_priv *il, 277static void il3945_tx_queue_reclaim(struct il_priv *il,
278 int txq_id, int index) 278 int txq_id, int idx)
279{ 279{
280 struct il_tx_queue *txq = &il->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;
@@ -283,8 +283,8 @@ static void il3945_tx_queue_reclaim(struct il_priv *il,
283 283
284 BUG_ON(txq_id == IL39_CMD_QUEUE_NUM); 284 BUG_ON(txq_id == IL39_CMD_QUEUE_NUM);
285 285
286 for (index = il_queue_inc_wrap(index, q->n_bd); 286 for (idx = il_queue_inc_wrap(idx, q->n_bd);
287 q->read_ptr != index; 287 q->read_ptr != idx;
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];
@@ -307,7 +307,7 @@ static void il3945_rx_reply_tx(struct il_priv *il,
307 struct il_rx_pkt *pkt = rxb_addr(rxb); 307 struct il_rx_pkt *pkt = rxb_addr(rxb);
308 u16 sequence = le16_to_cpu(pkt->hdr.sequence); 308 u16 sequence = le16_to_cpu(pkt->hdr.sequence);
309 int txq_id = SEQ_TO_QUEUE(sequence); 309 int txq_id = SEQ_TO_QUEUE(sequence);
310 int index = SEQ_TO_IDX(sequence); 310 int idx = SEQ_TO_IDX(sequence);
311 struct il_tx_queue *txq = &il->txq[txq_id]; 311 struct il_tx_queue *txq = &il->txq[txq_id];
312 struct ieee80211_tx_info *info; 312 struct ieee80211_tx_info *info;
313 struct il3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; 313 struct il3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
@@ -315,10 +315,10 @@ static void il3945_rx_reply_tx(struct il_priv *il,
315 int rate_idx; 315 int rate_idx;
316 int fail; 316 int fail;
317 317
318 if (index >= txq->q.n_bd || il_queue_used(&txq->q, index) == 0) { 318 if (idx >= txq->q.n_bd || il_queue_used(&txq->q, idx) == 0) {
319 IL_ERR("Read index for DMA queue txq_id (%d) index %d " 319 IL_ERR("Read idx for DMA queue txq_id (%d) idx %d "
320 "is out of range [0-%d] %d %d\n", txq_id, 320 "is out of range [0-%d] %d %d\n", txq_id,
321 index, txq->q.n_bd, txq->q.write_ptr, 321 idx, txq->q.n_bd, txq->q.write_ptr,
322 txq->q.read_ptr); 322 txq->q.read_ptr);
323 return; 323 return;
324 } 324 }
@@ -345,8 +345,8 @@ static void il3945_rx_reply_tx(struct il_priv *il,
345 txq_id, il3945_get_tx_fail_reason(status), status, 345 txq_id, il3945_get_tx_fail_reason(status), status,
346 tx_resp->rate, tx_resp->failure_frame); 346 tx_resp->rate, tx_resp->failure_frame);
347 347
348 D_TX_REPLY("Tx queue reclaim %d\n", index); 348 D_TX_REPLY("Tx queue reclaim %d\n", idx);
349 il3945_tx_queue_reclaim(il, txq_id, index); 349 il3945_tx_queue_reclaim(il, txq_id, idx);
350 350
351 if (status & TX_ABORT_REQUIRED_MSK) 351 if (status & TX_ABORT_REQUIRED_MSK)
352 IL_ERR("TODO: Implement Tx ABORT REQUIRED!!!\n"); 352 IL_ERR("TODO: Implement Tx ABORT REQUIRED!!!\n");
@@ -616,15 +616,15 @@ int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *il,
616} 616}
617 617
618/** 618/**
619 * il3945_hw_txq_free_tfd - Free one TFD, those at index [txq->q.read_ptr] 619 * il3945_hw_txq_free_tfd - Free one TFD, those at idx [txq->q.read_ptr]
620 * 620 *
621 * Does NOT advance any indexes 621 * Does NOT advance any idxes
622 */ 622 */
623void il3945_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq) 623void il3945_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq)
624{ 624{
625 struct il3945_tfd *tfd_tmp = (struct il3945_tfd *)txq->tfds; 625 struct il3945_tfd *tfd_tmp = (struct il3945_tfd *)txq->tfds;
626 int index = txq->q.read_ptr; 626 int idx = txq->q.read_ptr;
627 struct il3945_tfd *tfd = &tfd_tmp[index]; 627 struct il3945_tfd *tfd = &tfd_tmp[idx];
628 struct pci_dev *dev = il->pci_dev; 628 struct pci_dev *dev = il->pci_dev;
629 int i; 629 int i;
630 int counter; 630 int counter;
@@ -640,8 +640,8 @@ void il3945_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq)
640 /* Unmap tx_cmd */ 640 /* Unmap tx_cmd */
641 if (counter) 641 if (counter)
642 pci_unmap_single(dev, 642 pci_unmap_single(dev,
643 dma_unmap_addr(&txq->meta[index], mapping), 643 dma_unmap_addr(&txq->meta[idx], mapping),
644 dma_unmap_len(&txq->meta[index], len), 644 dma_unmap_len(&txq->meta[idx], len),
645 PCI_DMA_TODEVICE); 645 PCI_DMA_TODEVICE);
646 646
647 /* unmap chunks if any */ 647 /* unmap chunks if any */
@@ -675,7 +675,7 @@ void il3945_hw_build_tx_cmd_rate(struct il_priv *il,
675 int sta_id, int tx_id) 675 int sta_id, int tx_id)
676{ 676{
677 u16 hw_value = ieee80211_get_tx_rate(il->hw, info)->hw_value; 677 u16 hw_value = ieee80211_get_tx_rate(il->hw, info)->hw_value;
678 u16 rate_index = min(hw_value & 0xffff, RATE_COUNT_3945); 678 u16 rate_idx = min(hw_value & 0xffff, RATE_COUNT_3945);
679 u16 rate_mask; 679 u16 rate_mask;
680 int rate; 680 int rate;
681 u8 rts_retry_limit; 681 u8 rts_retry_limit;
@@ -684,7 +684,7 @@ void il3945_hw_build_tx_cmd_rate(struct il_priv *il,
684 __le16 fc = hdr->frame_control; 684 __le16 fc = hdr->frame_control;
685 struct il3945_tx_cmd *tx_cmd = (struct il3945_tx_cmd *)cmd->cmd.payload; 685 struct il3945_tx_cmd *tx_cmd = (struct il3945_tx_cmd *)cmd->cmd.payload;
686 686
687 rate = il3945_rates[rate_index].plcp; 687 rate = il3945_rates[rate_idx].plcp;
688 tx_flags = tx_cmd->tx_flags; 688 tx_flags = tx_cmd->tx_flags;
689 689
690 /* We need to figure out how to get the sta->supp_rates while 690 /* We need to figure out how to get the sta->supp_rates while
@@ -1040,7 +1040,7 @@ void il3945_hw_txq_ctx_stop(struct il_priv *il)
1040 1040
1041/** 1041/**
1042 * il3945_hw_reg_adjust_power_by_temp 1042 * il3945_hw_reg_adjust_power_by_temp
1043 * return index delta into power gain settings table 1043 * return idx delta into power gain settings table
1044*/ 1044*/
1045static int il3945_hw_reg_adjust_power_by_temp(int new_reading, int old_reading) 1045static int il3945_hw_reg_adjust_power_by_temp(int new_reading, int old_reading)
1046{ 1046{
@@ -1298,13 +1298,13 @@ static struct il3945_tx_power power_gain_table[2][IL_MAX_GAIN_ENTRIES] = {
1298 {3, 120} } /* 5.x GHz, lowest power */ 1298 {3, 120} } /* 5.x GHz, lowest power */
1299}; 1299};
1300 1300
1301static inline u8 il3945_hw_reg_fix_power_index(int index) 1301static inline u8 il3945_hw_reg_fix_power_idx(int idx)
1302{ 1302{
1303 if (index < 0) 1303 if (idx < 0)
1304 return 0; 1304 return 0;
1305 if (index >= IL_MAX_GAIN_ENTRIES) 1305 if (idx >= IL_MAX_GAIN_ENTRIES)
1306 return IL_MAX_GAIN_ENTRIES - 1; 1306 return IL_MAX_GAIN_ENTRIES - 1;
1307 return (u8) index; 1307 return (u8) idx;
1308} 1308}
1309 1309
1310/* Kick off thermal recalibration check every 60 seconds */ 1310/* Kick off thermal recalibration check every 60 seconds */
@@ -1316,16 +1316,16 @@ static inline u8 il3945_hw_reg_fix_power_index(int index)
1316 * Set (in our channel info database) the direct scan Tx power for 1 Mbit (CCK) 1316 * Set (in our channel info database) the direct scan Tx power for 1 Mbit (CCK)
1317 * or 6 Mbit (OFDM) rates. 1317 * or 6 Mbit (OFDM) rates.
1318 */ 1318 */
1319static void il3945_hw_reg_set_scan_power(struct il_priv *il, u32 scan_tbl_index, 1319static void il3945_hw_reg_set_scan_power(struct il_priv *il, u32 scan_tbl_idx,
1320 s32 rate_index, const s8 *clip_pwrs, 1320 s32 rate_idx, const s8 *clip_pwrs,
1321 struct il_channel_info *ch_info, 1321 struct il_channel_info *ch_info,
1322 int band_index) 1322 int band_idx)
1323{ 1323{
1324 struct il3945_scan_power_info *scan_power_info; 1324 struct il3945_scan_power_info *scan_power_info;
1325 s8 power; 1325 s8 power;
1326 u8 power_index; 1326 u8 power_idx;
1327 1327
1328 scan_power_info = &ch_info->scan_pwr_info[scan_tbl_index]; 1328 scan_power_info = &ch_info->scan_pwr_info[scan_tbl_idx];
1329 1329
1330 /* use this channel group's 6Mbit clipping/saturation pwr, 1330 /* use this channel group's 6Mbit clipping/saturation pwr,
1331 * but cap at regulatory scan power restriction (set during init 1331 * but cap at regulatory scan power restriction (set during init
@@ -1337,30 +1337,30 @@ static void il3945_hw_reg_set_scan_power(struct il_priv *il, u32 scan_tbl_index,
1337 1337
1338 /* find difference between new scan *power* and current "normal" 1338 /* find difference between new scan *power* and current "normal"
1339 * Tx *power* for 6Mb. Use this difference (x2) to adjust the 1339 * Tx *power* for 6Mb. Use this difference (x2) to adjust the
1340 * current "normal" temperature-compensated Tx power *index* for 1340 * current "normal" temperature-compensated Tx power *idx* for
1341 * this rate (1Mb or 6Mb) to yield new temp-compensated scan power 1341 * this rate (1Mb or 6Mb) to yield new temp-compensated scan power
1342 * *index*. */ 1342 * *idx*. */
1343 power_index = ch_info->power_info[rate_index].power_table_index 1343 power_idx = ch_info->power_info[rate_idx].power_table_idx
1344 - (power - ch_info->power_info 1344 - (power - ch_info->power_info
1345 [RATE_6M_IDX_TABLE].requested_power) * 2; 1345 [RATE_6M_IDX_TABLE].requested_power) * 2;
1346 1346
1347 /* store reference index that we use when adjusting *all* scan 1347 /* store reference idx that we use when adjusting *all* scan
1348 * powers. So we can accommodate user (all channel) or spectrum 1348 * powers. So we can accommodate user (all channel) or spectrum
1349 * management (single channel) power changes "between" temperature 1349 * management (single channel) power changes "between" temperature
1350 * feedback compensation procedures. 1350 * feedback compensation procedures.
1351 * don't force fit this reference index into gain table; it may be a 1351 * don't force fit this reference idx into gain table; it may be a
1352 * negative number. This will help avoid errors when we're at 1352 * negative number. This will help avoid errors when we're at
1353 * the lower bounds (highest gains, for warmest temperatures) 1353 * the lower bounds (highest gains, for warmest temperatures)
1354 * of the table. */ 1354 * of the table. */
1355 1355
1356 /* don't exceed table bounds for "real" setting */ 1356 /* don't exceed table bounds for "real" setting */
1357 power_index = il3945_hw_reg_fix_power_index(power_index); 1357 power_idx = il3945_hw_reg_fix_power_idx(power_idx);
1358 1358
1359 scan_power_info->power_table_index = power_index; 1359 scan_power_info->power_table_idx = power_idx;
1360 scan_power_info->tpc.tx_gain = 1360 scan_power_info->tpc.tx_gain =
1361 power_gain_table[band_index][power_index].tx_gain; 1361 power_gain_table[band_idx][power_idx].tx_gain;
1362 scan_power_info->tpc.dsp_atten = 1362 scan_power_info->tpc.dsp_atten =
1363 power_gain_table[band_index][power_index].dsp_atten; 1363 power_gain_table[band_idx][power_idx].dsp_atten;
1364} 1364}
1365 1365
1366/** 1366/**
@@ -1438,7 +1438,7 @@ static int il3945_send_tx_power(struct il_priv *il)
1438 * il3945_hw_reg_set_new_power - Configures power tables at new levels 1438 * il3945_hw_reg_set_new_power - Configures power tables at new levels
1439 * @ch_info: Channel to update. Uses power_info.requested_power. 1439 * @ch_info: Channel to update. Uses power_info.requested_power.
1440 * 1440 *
1441 * Replace requested_power and base_power_index ch_info fields for 1441 * Replace requested_power and base_power_idx ch_info fields for
1442 * one channel. 1442 * one channel.
1443 * 1443 *
1444 * Called if user or spectrum management changes power preferences. 1444 * Called if user or spectrum management changes power preferences.
@@ -1460,7 +1460,7 @@ static int il3945_hw_reg_set_new_power(struct il_priv *il,
1460 int power; 1460 int power;
1461 1461
1462 /* Get this chnlgrp's rate-to-max/clip-powers table */ 1462 /* Get this chnlgrp's rate-to-max/clip-powers table */
1463 clip_pwrs = il->_3945.clip_groups[ch_info->group_index].clip_powers; 1463 clip_pwrs = il->_3945.clip_groups[ch_info->group_idx].clip_powers;
1464 1464
1465 /* Get this channel's rate-to-current-power settings table */ 1465 /* Get this channel's rate-to-current-power settings table */
1466 power_info = ch_info->power_info; 1466 power_info = ch_info->power_info;
@@ -1476,9 +1476,9 @@ static int il3945_hw_reg_set_new_power(struct il_priv *il,
1476 continue; 1476 continue;
1477 1477
1478 /* find difference between old and new requested powers, 1478 /* find difference between old and new requested powers,
1479 * update base (non-temp-compensated) power index */ 1479 * update base (non-temp-compensated) power idx */
1480 delta_idx = (power - power_info->requested_power) * 2; 1480 delta_idx = (power - power_info->requested_power) * 2;
1481 power_info->base_power_index -= delta_idx; 1481 power_info->base_power_idx -= delta_idx;
1482 1482
1483 /* save new requested power value */ 1483 /* save new requested power value */
1484 power_info->requested_power = power; 1484 power_info->requested_power = power;
@@ -1496,9 +1496,9 @@ static int il3945_hw_reg_set_new_power(struct il_priv *il,
1496 /* do all CCK rates' il3945_channel_power_info structures */ 1496 /* do all CCK rates' il3945_channel_power_info structures */
1497 for (i = RATE_1M_IDX_TABLE; i <= RATE_11M_IDX_TABLE; i++) { 1497 for (i = RATE_1M_IDX_TABLE; i <= RATE_11M_IDX_TABLE; i++) {
1498 power_info->requested_power = power; 1498 power_info->requested_power = power;
1499 power_info->base_power_index = 1499 power_info->base_power_idx =
1500 ch_info->power_info[RATE_12M_IDX_TABLE]. 1500 ch_info->power_info[RATE_12M_IDX_TABLE].
1501 base_power_index + IL_CCK_FROM_OFDM_IDX_DIFF; 1501 base_power_idx + IL_CCK_FROM_OFDM_IDX_DIFF;
1502 ++power_info; 1502 ++power_info;
1503 } 1503 }
1504 } 1504 }
@@ -1537,7 +1537,7 @@ static int il3945_hw_reg_get_ch_txpower_limit(struct il_channel_info *ch_info)
1537 * Compensate txpower settings of *all* channels for temperature. 1537 * Compensate txpower settings of *all* channels for temperature.
1538 * This only accounts for the difference between current temperature 1538 * This only accounts for the difference between current temperature
1539 * and the factory calibration temperatures, and bases the new settings 1539 * and the factory calibration temperatures, and bases the new settings
1540 * on the channel's base_power_index. 1540 * on the channel's base_power_idx.
1541 * 1541 *
1542 * If RxOn is "associated", this sends the new Txpower to NIC! 1542 * If RxOn is "associated", this sends the new Txpower to NIC!
1543 */ 1543 */
@@ -1545,11 +1545,11 @@ static int il3945_hw_reg_comp_txpower_temp(struct il_priv *il)
1545{ 1545{
1546 struct il_channel_info *ch_info = NULL; 1546 struct il_channel_info *ch_info = NULL;
1547 struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; 1547 struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom;
1548 int delta_index; 1548 int delta_idx;
1549 const s8 *clip_pwrs; /* array of h/w max power levels for each rate */ 1549 const s8 *clip_pwrs; /* array of h/w max power levels for each rate */
1550 u8 a_band; 1550 u8 a_band;
1551 u8 rate_index; 1551 u8 rate_idx;
1552 u8 scan_tbl_index; 1552 u8 scan_tbl_idx;
1553 u8 i; 1553 u8 i;
1554 int ref_temp; 1554 int ref_temp;
1555 int temperature = il->temperature; 1555 int temperature = il->temperature;
@@ -1565,41 +1565,41 @@ static int il3945_hw_reg_comp_txpower_temp(struct il_priv *il)
1565 a_band = il_is_channel_a_band(ch_info); 1565 a_band = il_is_channel_a_band(ch_info);
1566 1566
1567 /* Get this chnlgrp's factory calibration temperature */ 1567 /* Get this chnlgrp's factory calibration temperature */
1568 ref_temp = (s16)eeprom->groups[ch_info->group_index]. 1568 ref_temp = (s16)eeprom->groups[ch_info->group_idx].
1569 temperature; 1569 temperature;
1570 1570
1571 /* get power index adjustment based on current and factory 1571 /* get power idx adjustment based on current and factory
1572 * temps */ 1572 * temps */
1573 delta_index = il3945_hw_reg_adjust_power_by_temp(temperature, 1573 delta_idx = il3945_hw_reg_adjust_power_by_temp(temperature,
1574 ref_temp); 1574 ref_temp);
1575 1575
1576 /* set tx power value for all rates, OFDM and CCK */ 1576 /* set tx power value for all rates, OFDM and CCK */
1577 for (rate_index = 0; rate_index < RATE_COUNT_3945; 1577 for (rate_idx = 0; rate_idx < RATE_COUNT_3945;
1578 rate_index++) { 1578 rate_idx++) {
1579 int power_idx = 1579 int power_idx =
1580 ch_info->power_info[rate_index].base_power_index; 1580 ch_info->power_info[rate_idx].base_power_idx;
1581 1581
1582 /* temperature compensate */ 1582 /* temperature compensate */
1583 power_idx += delta_index; 1583 power_idx += delta_idx;
1584 1584
1585 /* stay within table range */ 1585 /* stay within table range */
1586 power_idx = il3945_hw_reg_fix_power_index(power_idx); 1586 power_idx = il3945_hw_reg_fix_power_idx(power_idx);
1587 ch_info->power_info[rate_index]. 1587 ch_info->power_info[rate_idx].
1588 power_table_index = (u8) power_idx; 1588 power_table_idx = (u8) power_idx;
1589 ch_info->power_info[rate_index].tpc = 1589 ch_info->power_info[rate_idx].tpc =
1590 power_gain_table[a_band][power_idx]; 1590 power_gain_table[a_band][power_idx];
1591 } 1591 }
1592 1592
1593 /* Get this chnlgrp's rate-to-max/clip-powers table */ 1593 /* Get this chnlgrp's rate-to-max/clip-powers table */
1594 clip_pwrs = il->_3945.clip_groups[ch_info->group_index].clip_powers; 1594 clip_pwrs = il->_3945.clip_groups[ch_info->group_idx].clip_powers;
1595 1595
1596 /* set scan tx power, 1Mbit for CCK, 6Mbit for OFDM */ 1596 /* set scan tx power, 1Mbit for CCK, 6Mbit for OFDM */
1597 for (scan_tbl_index = 0; 1597 for (scan_tbl_idx = 0;
1598 scan_tbl_index < IL_NUM_SCAN_RATES; scan_tbl_index++) { 1598 scan_tbl_idx < IL_NUM_SCAN_RATES; scan_tbl_idx++) {
1599 s32 actual_index = (scan_tbl_index == 0) ? 1599 s32 actual_idx = (scan_tbl_idx == 0) ?
1600 RATE_1M_IDX_TABLE : RATE_6M_IDX_TABLE; 1600 RATE_1M_IDX_TABLE : RATE_6M_IDX_TABLE;
1601 il3945_hw_reg_set_scan_power(il, scan_tbl_index, 1601 il3945_hw_reg_set_scan_power(il, scan_tbl_idx,
1602 actual_index, clip_pwrs, 1602 actual_idx, clip_pwrs,
1603 ch_info, a_band); 1603 ch_info, a_band);
1604 } 1604 }
1605 } 1605 }
@@ -1878,7 +1878,7 @@ static void il3945_bg_reg_txpower_periodic(struct work_struct *work)
1878} 1878}
1879 1879
1880/** 1880/**
1881 * il3945_hw_reg_get_ch_grp_index - find the channel-group index (0-4) 1881 * il3945_hw_reg_get_ch_grp_idx - find the channel-group idx (0-4)
1882 * for the channel. 1882 * for the channel.
1883 * 1883 *
1884 * This function is used when initializing channel-info structs. 1884 * This function is used when initializing channel-info structs.
@@ -1888,48 +1888,48 @@ static void il3945_bg_reg_txpower_periodic(struct work_struct *work)
1888 * on A-band, EEPROM's "group frequency" entries represent the top 1888 * on A-band, EEPROM's "group frequency" entries represent the top
1889 * channel in each group 1-4. Group 5 All B/G channels are in group 0. 1889 * channel in each group 1-4. Group 5 All B/G channels are in group 0.
1890 */ 1890 */
1891static u16 il3945_hw_reg_get_ch_grp_index(struct il_priv *il, 1891static u16 il3945_hw_reg_get_ch_grp_idx(struct il_priv *il,
1892 const struct il_channel_info *ch_info) 1892 const struct il_channel_info *ch_info)
1893{ 1893{
1894 struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; 1894 struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom;
1895 struct il3945_eeprom_txpower_group *ch_grp = &eeprom->groups[0]; 1895 struct il3945_eeprom_txpower_group *ch_grp = &eeprom->groups[0];
1896 u8 group; 1896 u8 group;
1897 u16 group_index = 0; /* based on factory calib frequencies */ 1897 u16 group_idx = 0; /* based on factory calib frequencies */
1898 u8 grp_channel; 1898 u8 grp_channel;
1899 1899
1900 /* Find the group index for the channel ... don't use index 1(?) */ 1900 /* Find the group idx for the channel ... don't use idx 1(?) */
1901 if (il_is_channel_a_band(ch_info)) { 1901 if (il_is_channel_a_band(ch_info)) {
1902 for (group = 1; group < 5; group++) { 1902 for (group = 1; group < 5; group++) {
1903 grp_channel = ch_grp[group].group_channel; 1903 grp_channel = ch_grp[group].group_channel;
1904 if (ch_info->channel <= grp_channel) { 1904 if (ch_info->channel <= grp_channel) {
1905 group_index = group; 1905 group_idx = group;
1906 break; 1906 break;
1907 } 1907 }
1908 } 1908 }
1909 /* group 4 has a few channels *above* its factory cal freq */ 1909 /* group 4 has a few channels *above* its factory cal freq */
1910 if (group == 5) 1910 if (group == 5)
1911 group_index = 4; 1911 group_idx = 4;
1912 } else 1912 } else
1913 group_index = 0; /* 2.4 GHz, group 0 */ 1913 group_idx = 0; /* 2.4 GHz, group 0 */
1914 1914
1915 D_POWER("Chnl %d mapped to grp %d\n", ch_info->channel, 1915 D_POWER("Chnl %d mapped to grp %d\n", ch_info->channel,
1916 group_index); 1916 group_idx);
1917 return group_index; 1917 return group_idx;
1918} 1918}
1919 1919
1920/** 1920/**
1921 * il3945_hw_reg_get_matched_power_index - Interpolate to get nominal index 1921 * il3945_hw_reg_get_matched_power_idx - Interpolate to get nominal idx
1922 * 1922 *
1923 * Interpolate to get nominal (i.e. at factory calibration temperature) index 1923 * Interpolate to get nominal (i.e. at factory calibration temperature) idx
1924 * into radio/DSP gain settings table for requested power. 1924 * into radio/DSP gain settings table for requested power.
1925 */ 1925 */
1926static int il3945_hw_reg_get_matched_power_index(struct il_priv *il, 1926static int il3945_hw_reg_get_matched_power_idx(struct il_priv *il,
1927 s8 requested_power, 1927 s8 requested_power,
1928 s32 setting_index, s32 *new_index) 1928 s32 setting_idx, s32 *new_idx)
1929{ 1929{
1930 const struct il3945_eeprom_txpower_group *chnl_grp = NULL; 1930 const struct il3945_eeprom_txpower_group *chnl_grp = NULL;
1931 struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; 1931 struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom;
1932 s32 index0, index1; 1932 s32 idx0, idx1;
1933 s32 power = 2 * requested_power; 1933 s32 power = 2 * requested_power;
1934 s32 i; 1934 s32 i;
1935 const struct il3945_eeprom_txpower_sample *samples; 1935 const struct il3945_eeprom_txpower_sample *samples;
@@ -1937,45 +1937,45 @@ static int il3945_hw_reg_get_matched_power_index(struct il_priv *il,
1937 s32 res; 1937 s32 res;
1938 s32 denominator; 1938 s32 denominator;
1939 1939
1940 chnl_grp = &eeprom->groups[setting_index]; 1940 chnl_grp = &eeprom->groups[setting_idx];
1941 samples = chnl_grp->samples; 1941 samples = chnl_grp->samples;
1942 for (i = 0; i < 5; i++) { 1942 for (i = 0; i < 5; i++) {
1943 if (power == samples[i].power) { 1943 if (power == samples[i].power) {
1944 *new_index = samples[i].gain_index; 1944 *new_idx = samples[i].gain_idx;
1945 return 0; 1945 return 0;
1946 } 1946 }
1947 } 1947 }
1948 1948
1949 if (power > samples[1].power) { 1949 if (power > samples[1].power) {
1950 index0 = 0; 1950 idx0 = 0;
1951 index1 = 1; 1951 idx1 = 1;
1952 } else if (power > samples[2].power) { 1952 } else if (power > samples[2].power) {
1953 index0 = 1; 1953 idx0 = 1;
1954 index1 = 2; 1954 idx1 = 2;
1955 } else if (power > samples[3].power) { 1955 } else if (power > samples[3].power) {
1956 index0 = 2; 1956 idx0 = 2;
1957 index1 = 3; 1957 idx1 = 3;
1958 } else { 1958 } else {
1959 index0 = 3; 1959 idx0 = 3;
1960 index1 = 4; 1960 idx1 = 4;
1961 } 1961 }
1962 1962
1963 denominator = (s32) samples[index1].power - (s32) samples[index0].power; 1963 denominator = (s32) samples[idx1].power - (s32) samples[idx0].power;
1964 if (denominator == 0) 1964 if (denominator == 0)
1965 return -EINVAL; 1965 return -EINVAL;
1966 gains0 = (s32) samples[index0].gain_index * (1 << 19); 1966 gains0 = (s32) samples[idx0].gain_idx * (1 << 19);
1967 gains1 = (s32) samples[index1].gain_index * (1 << 19); 1967 gains1 = (s32) samples[idx1].gain_idx * (1 << 19);
1968 res = gains0 + (gains1 - gains0) * 1968 res = gains0 + (gains1 - gains0) *
1969 ((s32) power - (s32) samples[index0].power) / denominator + 1969 ((s32) power - (s32) samples[idx0].power) / denominator +
1970 (1 << 18); 1970 (1 << 18);
1971 *new_index = res >> 19; 1971 *new_idx = res >> 19;
1972 return 0; 1972 return 0;
1973} 1973}
1974 1974
1975static void il3945_hw_reg_init_channel_groups(struct il_priv *il) 1975static void il3945_hw_reg_init_channel_groups(struct il_priv *il)
1976{ 1976{
1977 u32 i; 1977 u32 i;
1978 s32 rate_index; 1978 s32 rate_idx;
1979 struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; 1979 struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom;
1980 const struct il3945_eeprom_txpower_group *group; 1980 const struct il3945_eeprom_txpower_group *group;
1981 1981
@@ -2009,9 +2009,9 @@ static void il3945_hw_reg_init_channel_groups(struct il_priv *il)
2009 satur_pwr = (s8) (group->saturation_power >> 1); 2009 satur_pwr = (s8) (group->saturation_power >> 1);
2010 2010
2011 /* fill in channel group's nominal powers for each rate */ 2011 /* fill in channel group's nominal powers for each rate */
2012 for (rate_index = 0; 2012 for (rate_idx = 0;
2013 rate_index < RATE_COUNT_3945; rate_index++, clip_pwrs++) { 2013 rate_idx < RATE_COUNT_3945; rate_idx++, clip_pwrs++) {
2014 switch (rate_index) { 2014 switch (rate_idx) {
2015 case RATE_36M_IDX_TABLE: 2015 case RATE_36M_IDX_TABLE:
2016 if (i == 0) /* B/G */ 2016 if (i == 0) /* B/G */
2017 *clip_pwrs = satur_pwr; 2017 *clip_pwrs = satur_pwr;
@@ -2058,13 +2058,13 @@ int il3945_txpower_set_from_eeprom(struct il_priv *il)
2058 struct il_channel_info *ch_info = NULL; 2058 struct il_channel_info *ch_info = NULL;
2059 struct il3945_channel_power_info *pwr_info; 2059 struct il3945_channel_power_info *pwr_info;
2060 struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; 2060 struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom;
2061 int delta_index; 2061 int delta_idx;
2062 u8 rate_index; 2062 u8 rate_idx;
2063 u8 scan_tbl_index; 2063 u8 scan_tbl_idx;
2064 const s8 *clip_pwrs; /* array of power levels for each rate */ 2064 const s8 *clip_pwrs; /* array of power levels for each rate */
2065 u8 gain, dsp_atten; 2065 u8 gain, dsp_atten;
2066 s8 power; 2066 s8 power;
2067 u8 pwr_index, base_pwr_index, a_band; 2067 u8 pwr_idx, base_pwr_idx, a_band;
2068 u8 i; 2068 u8 i;
2069 int temperature; 2069 int temperature;
2070 2070
@@ -2082,56 +2082,56 @@ int il3945_txpower_set_from_eeprom(struct il_priv *il)
2082 if (!il_is_channel_valid(ch_info)) 2082 if (!il_is_channel_valid(ch_info))
2083 continue; 2083 continue;
2084 2084
2085 /* find this channel's channel group (*not* "band") index */ 2085 /* find this channel's channel group (*not* "band") idx */
2086 ch_info->group_index = 2086 ch_info->group_idx =
2087 il3945_hw_reg_get_ch_grp_index(il, ch_info); 2087 il3945_hw_reg_get_ch_grp_idx(il, ch_info);
2088 2088
2089 /* Get this chnlgrp's rate->max/clip-powers table */ 2089 /* Get this chnlgrp's rate->max/clip-powers table */
2090 clip_pwrs = il->_3945.clip_groups[ch_info->group_index].clip_powers; 2090 clip_pwrs = il->_3945.clip_groups[ch_info->group_idx].clip_powers;
2091 2091
2092 /* calculate power index *adjustment* value according to 2092 /* calculate power idx *adjustment* value according to
2093 * diff between current temperature and factory temperature */ 2093 * diff between current temperature and factory temperature */
2094 delta_index = il3945_hw_reg_adjust_power_by_temp(temperature, 2094 delta_idx = il3945_hw_reg_adjust_power_by_temp(temperature,
2095 eeprom->groups[ch_info->group_index]. 2095 eeprom->groups[ch_info->group_idx].
2096 temperature); 2096 temperature);
2097 2097
2098 D_POWER("Delta index for channel %d: %d [%d]\n", 2098 D_POWER("Delta idx for channel %d: %d [%d]\n",
2099 ch_info->channel, delta_index, temperature + 2099 ch_info->channel, delta_idx, temperature +
2100 IL_TEMP_CONVERT); 2100 IL_TEMP_CONVERT);
2101 2101
2102 /* set tx power value for all OFDM rates */ 2102 /* set tx power value for all OFDM rates */
2103 for (rate_index = 0; rate_index < IL_OFDM_RATES; 2103 for (rate_idx = 0; rate_idx < IL_OFDM_RATES;
2104 rate_index++) { 2104 rate_idx++) {
2105 s32 uninitialized_var(power_idx); 2105 s32 uninitialized_var(power_idx);
2106 int rc; 2106 int rc;
2107 2107
2108 /* use channel group's clip-power table, 2108 /* use channel group's clip-power table,
2109 * but don't exceed channel's max power */ 2109 * but don't exceed channel's max power */
2110 s8 pwr = min(ch_info->max_power_avg, 2110 s8 pwr = min(ch_info->max_power_avg,
2111 clip_pwrs[rate_index]); 2111 clip_pwrs[rate_idx]);
2112 2112
2113 pwr_info = &ch_info->power_info[rate_index]; 2113 pwr_info = &ch_info->power_info[rate_idx];
2114 2114
2115 /* get base (i.e. at factory-measured temperature) 2115 /* get base (i.e. at factory-measured temperature)
2116 * power table index for this rate's power */ 2116 * power table idx for this rate's power */
2117 rc = il3945_hw_reg_get_matched_power_index(il, pwr, 2117 rc = il3945_hw_reg_get_matched_power_idx(il, pwr,
2118 ch_info->group_index, 2118 ch_info->group_idx,
2119 &power_idx); 2119 &power_idx);
2120 if (rc) { 2120 if (rc) {
2121 IL_ERR("Invalid power index\n"); 2121 IL_ERR("Invalid power idx\n");
2122 return rc; 2122 return rc;
2123 } 2123 }
2124 pwr_info->base_power_index = (u8) power_idx; 2124 pwr_info->base_power_idx = (u8) power_idx;
2125 2125
2126 /* temperature compensate */ 2126 /* temperature compensate */
2127 power_idx += delta_index; 2127 power_idx += delta_idx;
2128 2128
2129 /* stay within range of gain table */ 2129 /* stay within range of gain table */
2130 power_idx = il3945_hw_reg_fix_power_index(power_idx); 2130 power_idx = il3945_hw_reg_fix_power_idx(power_idx);
2131 2131
2132 /* fill 1 OFDM rate's il3945_channel_power_info struct */ 2132 /* fill 1 OFDM rate's il3945_channel_power_info struct */
2133 pwr_info->requested_power = pwr; 2133 pwr_info->requested_power = pwr;
2134 pwr_info->power_table_index = (u8) power_idx; 2134 pwr_info->power_table_idx = (u8) power_idx;
2135 pwr_info->tpc.tx_gain = 2135 pwr_info->tpc.tx_gain =
2136 power_gain_table[a_band][power_idx].tx_gain; 2136 power_gain_table[a_band][power_idx].tx_gain;
2137 pwr_info->tpc.dsp_atten = 2137 pwr_info->tpc.dsp_atten =
@@ -2142,36 +2142,36 @@ int il3945_txpower_set_from_eeprom(struct il_priv *il)
2142 pwr_info = &ch_info->power_info[RATE_12M_IDX_TABLE]; 2142 pwr_info = &ch_info->power_info[RATE_12M_IDX_TABLE];
2143 power = pwr_info->requested_power + 2143 power = pwr_info->requested_power +
2144 IL_CCK_FROM_OFDM_POWER_DIFF; 2144 IL_CCK_FROM_OFDM_POWER_DIFF;
2145 pwr_index = pwr_info->power_table_index + 2145 pwr_idx = pwr_info->power_table_idx +
2146 IL_CCK_FROM_OFDM_IDX_DIFF; 2146 IL_CCK_FROM_OFDM_IDX_DIFF;
2147 base_pwr_index = pwr_info->base_power_index + 2147 base_pwr_idx = pwr_info->base_power_idx +
2148 IL_CCK_FROM_OFDM_IDX_DIFF; 2148 IL_CCK_FROM_OFDM_IDX_DIFF;
2149 2149
2150 /* stay within table range */ 2150 /* stay within table range */
2151 pwr_index = il3945_hw_reg_fix_power_index(pwr_index); 2151 pwr_idx = il3945_hw_reg_fix_power_idx(pwr_idx);
2152 gain = power_gain_table[a_band][pwr_index].tx_gain; 2152 gain = power_gain_table[a_band][pwr_idx].tx_gain;
2153 dsp_atten = power_gain_table[a_band][pwr_index].dsp_atten; 2153 dsp_atten = power_gain_table[a_band][pwr_idx].dsp_atten;
2154 2154
2155 /* fill each CCK rate's il3945_channel_power_info structure 2155 /* fill each CCK rate's il3945_channel_power_info structure
2156 * NOTE: All CCK-rate Txpwrs are the same for a given chnl! 2156 * NOTE: All CCK-rate Txpwrs are the same for a given chnl!
2157 * NOTE: CCK rates start at end of OFDM rates! */ 2157 * NOTE: CCK rates start at end of OFDM rates! */
2158 for (rate_index = 0; 2158 for (rate_idx = 0;
2159 rate_index < IL_CCK_RATES; rate_index++) { 2159 rate_idx < IL_CCK_RATES; rate_idx++) {
2160 pwr_info = &ch_info->power_info[rate_index+IL_OFDM_RATES]; 2160 pwr_info = &ch_info->power_info[rate_idx+IL_OFDM_RATES];
2161 pwr_info->requested_power = power; 2161 pwr_info->requested_power = power;
2162 pwr_info->power_table_index = pwr_index; 2162 pwr_info->power_table_idx = pwr_idx;
2163 pwr_info->base_power_index = base_pwr_index; 2163 pwr_info->base_power_idx = base_pwr_idx;
2164 pwr_info->tpc.tx_gain = gain; 2164 pwr_info->tpc.tx_gain = gain;
2165 pwr_info->tpc.dsp_atten = dsp_atten; 2165 pwr_info->tpc.dsp_atten = dsp_atten;
2166 } 2166 }
2167 2167
2168 /* set scan tx power, 1Mbit for CCK, 6Mbit for OFDM */ 2168 /* set scan tx power, 1Mbit for CCK, 6Mbit for OFDM */
2169 for (scan_tbl_index = 0; 2169 for (scan_tbl_idx = 0;
2170 scan_tbl_index < IL_NUM_SCAN_RATES; scan_tbl_index++) { 2170 scan_tbl_idx < IL_NUM_SCAN_RATES; scan_tbl_idx++) {
2171 s32 actual_index = (scan_tbl_index == 0) ? 2171 s32 actual_idx = (scan_tbl_idx == 0) ?
2172 RATE_1M_IDX_TABLE : RATE_6M_IDX_TABLE; 2172 RATE_1M_IDX_TABLE : RATE_6M_IDX_TABLE;
2173 il3945_hw_reg_set_scan_power(il, scan_tbl_index, 2173 il3945_hw_reg_set_scan_power(il, scan_tbl_idx,
2174 actual_index, clip_pwrs, ch_info, a_band); 2174 actual_idx, clip_pwrs, ch_info, a_band);
2175 } 2175 }
2176 } 2176 }
2177 2177
@@ -2304,21 +2304,21 @@ static int il3945_manage_ibss_station(struct il_priv *il,
2304 */ 2304 */
2305int il3945_init_hw_rate_table(struct il_priv *il) 2305int il3945_init_hw_rate_table(struct il_priv *il)
2306{ 2306{
2307 int rc, i, index, prev_index; 2307 int rc, i, idx, prev_idx;
2308 struct il3945_rate_scaling_cmd rate_cmd = { 2308 struct il3945_rate_scaling_cmd rate_cmd = {
2309 .reserved = {0, 0, 0}, 2309 .reserved = {0, 0, 0},
2310 }; 2310 };
2311 struct il3945_rate_scaling_info *table = rate_cmd.table; 2311 struct il3945_rate_scaling_info *table = rate_cmd.table;
2312 2312
2313 for (i = 0; i < ARRAY_SIZE(il3945_rates); i++) { 2313 for (i = 0; i < ARRAY_SIZE(il3945_rates); i++) {
2314 index = il3945_rates[i].table_rs_index; 2314 idx = il3945_rates[i].table_rs_idx;
2315 2315
2316 table[index].rate_n_flags = 2316 table[idx].rate_n_flags =
2317 il3945_hw_set_rate_n_flags(il3945_rates[i].plcp, 0); 2317 il3945_hw_set_rate_n_flags(il3945_rates[i].plcp, 0);
2318 table[index].try_cnt = il->retry_rate; 2318 table[idx].try_cnt = il->retry_rate;
2319 prev_index = il3945_get_prev_ieee_rate(i); 2319 prev_idx = il3945_get_prev_ieee_rate(i);
2320 table[index].next_rate_index = 2320 table[idx].next_rate_idx =
2321 il3945_rates[prev_index].table_rs_index; 2321 il3945_rates[prev_idx].table_rs_idx;
2322 } 2322 }
2323 2323
2324 switch (il->band) { 2324 switch (il->band) {
@@ -2328,16 +2328,16 @@ int il3945_init_hw_rate_table(struct il_priv *il)
2328 * have it fall back to the 6M OFDM rate */ 2328 * have it fall back to the 6M OFDM rate */
2329 for (i = RATE_1M_IDX_TABLE; 2329 for (i = RATE_1M_IDX_TABLE;
2330 i <= RATE_11M_IDX_TABLE; i++) 2330 i <= RATE_11M_IDX_TABLE; i++)
2331 table[i].next_rate_index = 2331 table[i].next_rate_idx =
2332 il3945_rates[IL_FIRST_OFDM_RATE].table_rs_index; 2332 il3945_rates[IL_FIRST_OFDM_RATE].table_rs_idx;
2333 2333
2334 /* Don't fall back to CCK rates */ 2334 /* Don't fall back to CCK rates */
2335 table[RATE_12M_IDX_TABLE].next_rate_index = 2335 table[RATE_12M_IDX_TABLE].next_rate_idx =
2336 RATE_9M_IDX_TABLE; 2336 RATE_9M_IDX_TABLE;
2337 2337
2338 /* Don't drop out of OFDM rates */ 2338 /* Don't drop out of OFDM rates */
2339 table[RATE_6M_IDX_TABLE].next_rate_index = 2339 table[RATE_6M_IDX_TABLE].next_rate_idx =
2340 il3945_rates[IL_FIRST_OFDM_RATE].table_rs_index; 2340 il3945_rates[IL_FIRST_OFDM_RATE].table_rs_idx;
2341 break; 2341 break;
2342 2342
2343 case IEEE80211_BAND_2GHZ: 2343 case IEEE80211_BAND_2GHZ:
@@ -2348,15 +2348,15 @@ int il3945_init_hw_rate_table(struct il_priv *il)
2348 if (!(il->_3945.sta_supp_rates & IL_OFDM_RATES_MASK) && 2348 if (!(il->_3945.sta_supp_rates & IL_OFDM_RATES_MASK) &&
2349 il_is_associated(il)) { 2349 il_is_associated(il)) {
2350 2350
2351 index = IL_FIRST_CCK_RATE; 2351 idx = IL_FIRST_CCK_RATE;
2352 for (i = RATE_6M_IDX_TABLE; 2352 for (i = RATE_6M_IDX_TABLE;
2353 i <= RATE_54M_IDX_TABLE; i++) 2353 i <= RATE_54M_IDX_TABLE; i++)
2354 table[i].next_rate_index = 2354 table[i].next_rate_idx =
2355 il3945_rates[index].table_rs_index; 2355 il3945_rates[idx].table_rs_idx;
2356 2356
2357 index = RATE_11M_IDX_TABLE; 2357 idx = RATE_11M_IDX_TABLE;
2358 /* CCK shouldn't fall back to OFDM... */ 2358 /* CCK shouldn't fall back to OFDM... */
2359 table[index].next_rate_index = RATE_5M_IDX_TABLE; 2359 table[idx].next_rate_idx = RATE_5M_IDX_TABLE;
2360 } 2360 }
2361 break; 2361 break;
2362 2362
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
index 2c1b000e2369..5c8b8baa3b15 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
@@ -203,7 +203,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
203 * 1) Compare desired txpower vs. (EEPROM) regulatory limit for this channel. 203 * 1) Compare desired txpower vs. (EEPROM) regulatory limit for this channel.
204 * Do not exceed regulatory limit; reduce target txpower if necessary. 204 * Do not exceed regulatory limit; reduce target txpower if necessary.
205 * 205 *
206 * If setting up txpowers for MIMO rates (rate indexes 8-15, 24-31), 206 * If setting up txpowers for MIMO rates (rate idxes 8-15, 24-31),
207 * 2 transmitters will be used simultaneously; driver must reduce the 207 * 2 transmitters will be used simultaneously; driver must reduce the
208 * regulatory limit by 3 dB (half-power) for each transmitter, so the 208 * regulatory limit by 3 dB (half-power) for each transmitter, so the
209 * combined total output of the 2 transmitters is within regulatory limits. 209 * combined total output of the 2 transmitters is within regulatory limits.
@@ -269,7 +269,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
269 * be used (although only one at a time) even for non-MIMO transmissions. 269 * be used (although only one at a time) even for non-MIMO transmissions.
270 * 270 *
271 * Driver should interpolate factory values for temperature, gain table 271 * Driver should interpolate factory values for temperature, gain table
272 * index, and actual power. The power amplifier detector values are 272 * idx, and actual power. The power amplifier detector values are
273 * not used by the driver. 273 * not used by the driver.
274 * 274 *
275 * Sanity check: If the target channel happens to be one of the sample 275 * Sanity check: If the target channel happens to be one of the sample
@@ -278,13 +278,13 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
278 * 278 *
279 * 279 *
280 * 5) Find difference between desired txpower and (interpolated) 280 * 5) Find difference between desired txpower and (interpolated)
281 * factory-measured txpower. Using (interpolated) factory gain table index 281 * factory-measured txpower. Using (interpolated) factory gain table idx
282 * (shown elsewhere) as a starting point, adjust this index lower to 282 * (shown elsewhere) as a starting point, adjust this idx lower to
283 * increase txpower, or higher to decrease txpower, until the target 283 * increase txpower, or higher to decrease txpower, until the target
284 * txpower is reached. Each step in the gain table is 1/2 dB. 284 * txpower is reached. Each step in the gain table is 1/2 dB.
285 * 285 *
286 * For example, if factory measured txpower is 16 dBm, and target txpower 286 * For example, if factory measured txpower is 16 dBm, and target txpower
287 * is 13 dBm, add 6 steps to the factory gain index to reduce txpower 287 * is 13 dBm, add 6 steps to the factory gain idx to reduce txpower
288 * by 3 dB. 288 * by 3 dB.
289 * 289 *
290 * 290 *
@@ -294,7 +294,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
294 * "4965 temperature calculation". 294 * "4965 temperature calculation".
295 * 295 *
296 * If current temperature is higher than factory temperature, driver must 296 * If current temperature is higher than factory temperature, driver must
297 * increase gain (lower gain table index), and vice verse. 297 * increase gain (lower gain table idx), and vice verse.
298 * 298 *
299 * Temperature affects gain differently for different channels: 299 * Temperature affects gain differently for different channels:
300 * 300 *
@@ -313,16 +313,16 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
313 * indicator (EEPROM). 313 * indicator (EEPROM).
314 * 314 *
315 * If the current voltage is higher (indicator is lower) than factory 315 * If the current voltage is higher (indicator is lower) than factory
316 * voltage, gain should be reduced (gain table index increased) by: 316 * voltage, gain should be reduced (gain table idx increased) by:
317 * 317 *
318 * (eeprom - current) / 7 318 * (eeprom - current) / 7
319 * 319 *
320 * If the current voltage is lower (indicator is higher) than factory 320 * If the current voltage is lower (indicator is higher) than factory
321 * voltage, gain should be increased (gain table index decreased) by: 321 * voltage, gain should be increased (gain table idx decreased) by:
322 * 322 *
323 * 2 * (current - eeprom) / 7 323 * 2 * (current - eeprom) / 7
324 * 324 *
325 * If number of index steps in either direction turns out to be > 2, 325 * If number of idx steps in either direction turns out to be > 2,
326 * something is wrong ... just use 0. 326 * something is wrong ... just use 0.
327 * 327 *
328 * NOTE: Voltage compensation is independent of band/channel. 328 * NOTE: Voltage compensation is independent of band/channel.
@@ -333,7 +333,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
333 * may be calculated once and used until the next uCode bootload. 333 * may be calculated once and used until the next uCode bootload.
334 * 334 *
335 * 335 *
336 * 8) If setting up txpowers for MIMO rates (rate indexes 8-15, 24-31), 336 * 8) If setting up txpowers for MIMO rates (rate idxes 8-15, 24-31),
337 * adjust txpower for each transmitter chain, so txpower is balanced 337 * adjust txpower for each transmitter chain, so txpower is balanced
338 * between the two chains. There are 5 pairs of tx_atten[group][chain] 338 * between the two chains. There are 5 pairs of tx_atten[group][chain]
339 * values in "initialize alive", one pair for each of 5 channel ranges: 339 * values in "initialize alive", one pair for each of 5 channel ranges:
@@ -344,7 +344,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
344 * Group 3: 5 GHz channel 125-200 344 * Group 3: 5 GHz channel 125-200
345 * Group 4: 2.4 GHz all channels 345 * Group 4: 2.4 GHz all channels
346 * 346 *
347 * Add the tx_atten[group][chain] value to the index for the target chain. 347 * Add the tx_atten[group][chain] value to the idx for the target chain.
348 * The values are signed, but are in pairs of 0 and a non-negative number, 348 * The values are signed, but are in pairs of 0 and a non-negative number,
349 * so as to reduce gain (if necessary) of the "hotter" channel. This 349 * so as to reduce gain (if necessary) of the "hotter" channel. This
350 * avoids any need to double-check for regulatory compliance after 350 * avoids any need to double-check for regulatory compliance after
@@ -352,7 +352,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
352 * 352 *
353 * 353 *
354 * 9) If setting up for a CCK rate, lower the gain by adding a CCK compensation 354 * 9) If setting up for a CCK rate, lower the gain by adding a CCK compensation
355 * value to the index: 355 * value to the idx:
356 * 356 *
357 * Hardware rev B: 9 steps (4.5 dB) 357 * Hardware rev B: 9 steps (4.5 dB)
358 * Hardware rev C: 5 steps (2.5 dB) 358 * Hardware rev C: 5 steps (2.5 dB)
@@ -366,7 +366,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
366 * 366 *
367 * 10) Select the gain table, based on band (2.4 vs 5 GHz). 367 * 10) Select the gain table, based on band (2.4 vs 5 GHz).
368 * 368 *
369 * Limit the adjusted index to stay within the table! 369 * Limit the adjusted idx to stay within the table!
370 * 370 *
371 * 371 *
372 * 11) Read gain table entries for DSP and radio gain, place into appropriate 372 * 11) Read gain table entries for DSP and radio gain, place into appropriate
@@ -389,7 +389,7 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
389 * 389 *
390 * When calculating txpowers for CCK, after making sure that the target power 390 * When calculating txpowers for CCK, after making sure that the target power
391 * is within regulatory and saturation limits, driver must additionally 391 * is within regulatory and saturation limits, driver must additionally
392 * back off gain by adding these values to the gain table index. 392 * back off gain by adding these values to the gain table idx.
393 * 393 *
394 * Hardware rev for 4965 can be determined by reading CSR_HW_REV_WA_REG, 394 * Hardware rev for 4965 can be determined by reading CSR_HW_REV_WA_REG,
395 * bits [3:2], 1 = B, 2 = C. 395 * bits [3:2], 1 = B, 2 = C.
@@ -428,9 +428,9 @@ static inline int il4965_hw_valid_rtc_data_addr(u32 addr)
428 * driver work with the same table). 428 * driver work with the same table).
429 * 429 *
430 * There are separate tables for 2.4 GHz and 5 GHz bands. The 5 GHz table 430 * There are separate tables for 2.4 GHz and 5 GHz bands. The 5 GHz table
431 * has an extension (into negative indexes), in case the driver needs to 431 * has an extension (into negative idxes), in case the driver needs to
432 * boost power setting for high device temperatures (higher than would be 432 * boost power setting for high device temperatures (higher than would be
433 * present during factory calibration). A 5 Ghz EEPROM index of "40" 433 * present during factory calibration). A 5 Ghz EEPROM idx of "40"
434 * corresponds to the 49th entry in the table used by the driver. 434 * corresponds to the 49th entry in the table used by the driver.
435 */ 435 */
436#define MIN_TX_GAIN_IDX (0) /* highest gain, lowest idx, 2.4 */ 436#define MIN_TX_GAIN_IDX (0) /* highest gain, lowest idx, 2.4 */
@@ -778,8 +778,8 @@ enum {
778 * 778 *
779 * When driver sets up a new TFD, it must also enter the total byte count 779 * When driver sets up a new TFD, it must also enter the total byte count
780 * of the frame to be transmitted into the corresponding entry in the byte 780 * of the frame to be transmitted into the corresponding entry in the byte
781 * count table for the chosen Tx queue. If the TFD index is 0-63, the driver 781 * count table for the chosen Tx queue. If the TFD idx is 0-63, the driver
782 * must duplicate the byte count entry in corresponding index 256-319. 782 * must duplicate the byte count entry in corresponding idx 256-319.
783 * 783 *
784 * padding puts each byte count table on a 1024-byte boundary; 784 * padding puts each byte count table on a 1024-byte boundary;
785 * 4965 assumes tables are separated by 1024 bytes. 785 * 4965 assumes tables are separated by 1024 bytes.
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
index ee04977c0113..bbec6bd550d3 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
@@ -105,7 +105,7 @@ int il4965_rx_init(struct il_priv *il, struct il_rx_queue *rxq)
105 /* Stop Rx DMA */ 105 /* Stop Rx DMA */
106 il_wr(il, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); 106 il_wr(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 idx */
109 il_wr(il, FH_RSCSR_CHNL0_RBDCB_WPTR_REG, 0); 109 il_wr(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 */
@@ -222,7 +222,7 @@ static inline __le32 il4965_dma_addr2rbd_ptr(struct il_priv *il,
222 * and we have free pre-allocated buffers, fill the ranks as much 222 * and we have free pre-allocated buffers, fill the ranks as much
223 * as we can, pulling from rx_free. 223 * as we can, pulling from rx_free.
224 * 224 *
225 * This moves the 'write' index forward to catch up with 'processed', and 225 * This moves the 'write' idx forward to catch up with 'processed', and
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 */
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
index 7478e9167e73..b8f80641f788 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
@@ -151,10 +151,10 @@ static void il4965_rs_stay_in_table(struct il_lq_sta *lq_sta,
151 151
152#ifdef CONFIG_MAC80211_DEBUGFS 152#ifdef CONFIG_MAC80211_DEBUGFS
153static void il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta, 153static void il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta,
154 u32 *rate_n_flags, int index); 154 u32 *rate_n_flags, int idx);
155#else 155#else
156static void il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta, 156static void il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta,
157 u32 *rate_n_flags, int index) 157 u32 *rate_n_flags, int idx)
158{} 158{}
159#endif 159#endif
160 160
@@ -271,7 +271,7 @@ static u8 il4965_rs_tl_add_packet(struct il_lq_sta *lq_data,
271{ 271{
272 u32 curr_time = jiffies_to_msecs(jiffies); 272 u32 curr_time = jiffies_to_msecs(jiffies);
273 u32 time_diff; 273 u32 time_diff;
274 s32 index; 274 s32 idx;
275 struct il_traffic_load *tl = NULL; 275 struct il_traffic_load *tl = NULL;
276 u8 tid; 276 u8 tid;
277 277
@@ -299,19 +299,19 @@ static u8 il4965_rs_tl_add_packet(struct il_lq_sta *lq_data,
299 } 299 }
300 300
301 time_diff = TIME_WRAP_AROUND(tl->time_stamp, curr_time); 301 time_diff = TIME_WRAP_AROUND(tl->time_stamp, curr_time);
302 index = time_diff / TID_QUEUE_CELL_SPACING; 302 idx = time_diff / TID_QUEUE_CELL_SPACING;
303 303
304 /* The history is too long: remove data that is older than */ 304 /* The history is too long: remove data that is older than */
305 /* TID_MAX_TIME_DIFF */ 305 /* TID_MAX_TIME_DIFF */
306 if (index >= TID_QUEUE_MAX_SIZE) 306 if (idx >= TID_QUEUE_MAX_SIZE)
307 il4965_rs_tl_rm_old_stats(tl, curr_time); 307 il4965_rs_tl_rm_old_stats(tl, curr_time);
308 308
309 index = (tl->head + index) % TID_QUEUE_MAX_SIZE; 309 idx = (tl->head + idx) % TID_QUEUE_MAX_SIZE;
310 tl->packet_count[index] = tl->packet_count[index] + 1; 310 tl->packet_count[idx] = tl->packet_count[idx] + 1;
311 tl->total = tl->total + 1; 311 tl->total = tl->total + 1;
312 312
313 if ((index + 1) > tl->queue_count) 313 if ((idx + 1) > tl->queue_count)
314 tl->queue_count = index + 1; 314 tl->queue_count = idx + 1;
315 315
316 return tid; 316 return tid;
317} 317}
@@ -323,7 +323,7 @@ static u32 il4965_rs_tl_get_load(struct il_lq_sta *lq_data, u8 tid)
323{ 323{
324 u32 curr_time = jiffies_to_msecs(jiffies); 324 u32 curr_time = jiffies_to_msecs(jiffies);
325 u32 time_diff; 325 u32 time_diff;
326 s32 index; 326 s32 idx;
327 struct il_traffic_load *tl = NULL; 327 struct il_traffic_load *tl = NULL;
328 328
329 if (tid >= TID_MAX_LOAD_COUNT) 329 if (tid >= TID_MAX_LOAD_COUNT)
@@ -337,11 +337,11 @@ static u32 il4965_rs_tl_get_load(struct il_lq_sta *lq_data, u8 tid)
337 return 0; 337 return 0;
338 338
339 time_diff = TIME_WRAP_AROUND(tl->time_stamp, curr_time); 339 time_diff = TIME_WRAP_AROUND(tl->time_stamp, curr_time);
340 index = time_diff / TID_QUEUE_CELL_SPACING; 340 idx = time_diff / TID_QUEUE_CELL_SPACING;
341 341
342 /* The history is too long: remove data that is older than */ 342 /* The history is too long: remove data that is older than */
343 /* TID_MAX_TIME_DIFF */ 343 /* TID_MAX_TIME_DIFF */
344 if (index >= TID_QUEUE_MAX_SIZE) 344 if (idx >= TID_QUEUE_MAX_SIZE)
345 il4965_rs_tl_rm_old_stats(tl, curr_time); 345 il4965_rs_tl_rm_old_stats(tl, curr_time);
346 346
347 return tl->total; 347 return tl->total;
@@ -400,10 +400,10 @@ static inline int il4965_get_il4965_num_of_ant_from_rate(u32 rate_n_flags)
400 * that wraps a NULL pointer check 400 * that wraps a NULL pointer check
401 */ 401 */
402static s32 402static s32
403il4965_get_expected_tpt(struct il_scale_tbl_info *tbl, int rs_index) 403il4965_get_expected_tpt(struct il_scale_tbl_info *tbl, int rs_idx)
404{ 404{
405 if (tbl->expected_tpt) 405 if (tbl->expected_tpt)
406 return tbl->expected_tpt[rs_index]; 406 return tbl->expected_tpt[rs_idx];
407 return 0; 407 return 0;
408} 408}
409 409
@@ -415,20 +415,20 @@ il4965_get_expected_tpt(struct il_scale_tbl_info *tbl, int rs_index)
415 * packets. 415 * packets.
416 */ 416 */
417static int il4965_rs_collect_tx_data(struct il_scale_tbl_info *tbl, 417static int il4965_rs_collect_tx_data(struct il_scale_tbl_info *tbl,
418 int scale_index, int attempts, int successes) 418 int scale_idx, int attempts, int successes)
419{ 419{
420 struct il_rate_scale_data *win = NULL; 420 struct il_rate_scale_data *win = NULL;
421 static const u64 mask = (((u64)1) << (RATE_MAX_WINDOW - 1)); 421 static const u64 mask = (((u64)1) << (RATE_MAX_WINDOW - 1));
422 s32 fail_count, tpt; 422 s32 fail_count, tpt;
423 423
424 if (scale_index < 0 || scale_index >= RATE_COUNT) 424 if (scale_idx < 0 || scale_idx >= RATE_COUNT)
425 return -EINVAL; 425 return -EINVAL;
426 426
427 /* Select win for current tx bit rate */ 427 /* Select win for current tx bit rate */
428 win = &(tbl->win[scale_index]); 428 win = &(tbl->win[scale_idx]);
429 429
430 /* Get expected throughput */ 430 /* Get expected throughput */
431 tpt = il4965_get_expected_tpt(tbl, scale_index); 431 tpt = il4965_get_expected_tpt(tbl, scale_idx);
432 432
433 /* 433 /*
434 * Keep track of only the latest 62 tx frame attempts in this rate's 434 * Keep track of only the latest 62 tx frame attempts in this rate's
@@ -493,26 +493,26 @@ static int il4965_rs_collect_tx_data(struct il_scale_tbl_info *tbl,
493 */ 493 */
494static u32 il4965_rate_n_flags_from_tbl(struct il_priv *il, 494static u32 il4965_rate_n_flags_from_tbl(struct il_priv *il,
495 struct il_scale_tbl_info *tbl, 495 struct il_scale_tbl_info *tbl,
496 int index, u8 use_green) 496 int idx, u8 use_green)
497{ 497{
498 u32 rate_n_flags = 0; 498 u32 rate_n_flags = 0;
499 499
500 if (is_legacy(tbl->lq_type)) { 500 if (is_legacy(tbl->lq_type)) {
501 rate_n_flags = il_rates[index].plcp; 501 rate_n_flags = il_rates[idx].plcp;
502 if (index >= IL_FIRST_CCK_RATE && index <= IL_LAST_CCK_RATE) 502 if (idx >= IL_FIRST_CCK_RATE && idx <= IL_LAST_CCK_RATE)
503 rate_n_flags |= RATE_MCS_CCK_MSK; 503 rate_n_flags |= RATE_MCS_CCK_MSK;
504 504
505 } else if (is_Ht(tbl->lq_type)) { 505 } else if (is_Ht(tbl->lq_type)) {
506 if (index > IL_LAST_OFDM_RATE) { 506 if (idx > IL_LAST_OFDM_RATE) {
507 IL_ERR("Invalid HT rate index %d\n", index); 507 IL_ERR("Invalid HT rate idx %d\n", idx);
508 index = IL_LAST_OFDM_RATE; 508 idx = IL_LAST_OFDM_RATE;
509 } 509 }
510 rate_n_flags = RATE_MCS_HT_MSK; 510 rate_n_flags = RATE_MCS_HT_MSK;
511 511
512 if (is_siso(tbl->lq_type)) 512 if (is_siso(tbl->lq_type))
513 rate_n_flags |= il_rates[index].plcp_siso; 513 rate_n_flags |= il_rates[idx].plcp_siso;
514 else 514 else
515 rate_n_flags |= il_rates[index].plcp_mimo2; 515 rate_n_flags |= il_rates[idx].plcp_mimo2;
516 } else { 516 } else {
517 IL_ERR("Invalid tbl->lq_type %d\n", tbl->lq_type); 517 IL_ERR("Invalid tbl->lq_type %d\n", tbl->lq_type);
518 } 518 }
@@ -666,7 +666,7 @@ static u16 il4965_rs_get_supported_rates(struct il_lq_sta *lq_sta,
666} 666}
667 667
668static u16 668static u16
669il4965_rs_get_adjacent_rate(struct il_priv *il, u8 index, u16 rate_mask, 669il4965_rs_get_adjacent_rate(struct il_priv *il, u8 idx, u16 rate_mask,
670 int rate_type) 670 int rate_type)
671{ 671{
672 u8 high = RATE_INVALID; 672 u8 high = RATE_INVALID;
@@ -679,7 +679,7 @@ il4965_rs_get_adjacent_rate(struct il_priv *il, u8 index, u16 rate_mask,
679 u32 mask; 679 u32 mask;
680 680
681 /* Find the previous rate that is in the rate mask */ 681 /* Find the previous rate that is in the rate mask */
682 i = index - 1; 682 i = idx - 1;
683 for (mask = (1 << i); i >= 0; i--, mask >>= 1) { 683 for (mask = (1 << i); i >= 0; i--, mask >>= 1) {
684 if (rate_mask & mask) { 684 if (rate_mask & mask) {
685 low = i; 685 low = i;
@@ -688,7 +688,7 @@ il4965_rs_get_adjacent_rate(struct il_priv *il, u8 index, u16 rate_mask,
688 } 688 }
689 689
690 /* Find the next rate that is in the rate mask */ 690 /* Find the next rate that is in the rate mask */
691 i = index + 1; 691 i = idx + 1;
692 for (mask = (1 << i); i < RATE_COUNT; i++, mask <<= 1) { 692 for (mask = (1 << i); i < RATE_COUNT; i++, mask <<= 1) {
693 if (rate_mask & mask) { 693 if (rate_mask & mask) {
694 high = i; 694 high = i;
@@ -699,7 +699,7 @@ il4965_rs_get_adjacent_rate(struct il_priv *il, u8 index, u16 rate_mask,
699 return (high << 8) | low; 699 return (high << 8) | low;
700 } 700 }
701 701
702 low = index; 702 low = idx;
703 while (low != RATE_INVALID) { 703 while (low != RATE_INVALID) {
704 low = il_rates[low].prev_rs; 704 low = il_rates[low].prev_rs;
705 if (low == RATE_INVALID) 705 if (low == RATE_INVALID)
@@ -709,7 +709,7 @@ il4965_rs_get_adjacent_rate(struct il_priv *il, u8 index, u16 rate_mask,
709 D_RATE("Skipping masked lower rate: %d\n", low); 709 D_RATE("Skipping masked lower rate: %d\n", low);
710 } 710 }
711 711
712 high = index; 712 high = idx;
713 while (high != RATE_INVALID) { 713 while (high != RATE_INVALID) {
714 high = il_rates[high].next_rs; 714 high = il_rates[high].next_rs;
715 if (high == RATE_INVALID) 715 if (high == RATE_INVALID)
@@ -724,7 +724,7 @@ il4965_rs_get_adjacent_rate(struct il_priv *il, u8 index, u16 rate_mask,
724 724
725static u32 il4965_rs_get_lower_rate(struct il_lq_sta *lq_sta, 725static u32 il4965_rs_get_lower_rate(struct il_lq_sta *lq_sta,
726 struct il_scale_tbl_info *tbl, 726 struct il_scale_tbl_info *tbl,
727 u8 scale_index, u8 ht_possible) 727 u8 scale_idx, u8 ht_possible)
728{ 728{
729 s32 low; 729 s32 low;
730 u16 rate_mask; 730 u16 rate_mask;
@@ -736,9 +736,9 @@ static u32 il4965_rs_get_lower_rate(struct il_lq_sta *lq_sta,
736 /* check if we need to switch from HT to legacy rates. 736 /* check if we need to switch from HT to legacy rates.
737 * assumption is that mandatory rates (1Mbps or 6Mbps) 737 * assumption is that mandatory rates (1Mbps or 6Mbps)
738 * are always supported (spec demand) */ 738 * are always supported (spec demand) */
739 if (!is_legacy(tbl->lq_type) && (!ht_possible || !scale_index)) { 739 if (!is_legacy(tbl->lq_type) && (!ht_possible || !scale_idx)) {
740 switch_to_legacy = 1; 740 switch_to_legacy = 1;
741 scale_index = rs_ht_to_legacy[scale_index]; 741 scale_idx = rs_ht_to_legacy[scale_idx];
742 if (lq_sta->band == IEEE80211_BAND_5GHZ) 742 if (lq_sta->band == IEEE80211_BAND_5GHZ)
743 tbl->lq_type = LQ_A; 743 tbl->lq_type = LQ_A;
744 else 744 else
@@ -766,18 +766,18 @@ static u32 il4965_rs_get_lower_rate(struct il_lq_sta *lq_sta,
766 } 766 }
767 767
768 /* If we switched from HT to legacy, check current rate */ 768 /* If we switched from HT to legacy, check current rate */
769 if (switch_to_legacy && (rate_mask & (1 << scale_index))) { 769 if (switch_to_legacy && (rate_mask & (1 << scale_idx))) {
770 low = scale_index; 770 low = scale_idx;
771 goto out; 771 goto out;
772 } 772 }
773 773
774 high_low = il4965_rs_get_adjacent_rate(lq_sta->drv, 774 high_low = il4965_rs_get_adjacent_rate(lq_sta->drv,
775 scale_index, rate_mask, 775 scale_idx, rate_mask,
776 tbl->lq_type); 776 tbl->lq_type);
777 low = high_low & 0xff; 777 low = high_low & 0xff;
778 778
779 if (low == RATE_INVALID) 779 if (low == RATE_INVALID)
780 low = scale_index; 780 low = scale_idx;
781 781
782out: 782out:
783 return il4965_rate_n_flags_from_tbl(lq_sta->drv, tbl, low, is_green); 783 return il4965_rate_n_flags_from_tbl(lq_sta->drv, tbl, low, is_green);
@@ -803,7 +803,7 @@ il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband,
803{ 803{
804 int legacy_success; 804 int legacy_success;
805 int retries; 805 int retries;
806 int rs_index, mac_index, i; 806 int rs_idx, mac_idx, i;
807 struct il_lq_sta *lq_sta = il_sta; 807 struct il_lq_sta *lq_sta = il_sta;
808 struct il_link_quality_cmd *table; 808 struct il_link_quality_cmd *table;
809 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 809 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
@@ -848,35 +848,35 @@ il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband,
848 table = &lq_sta->lq; 848 table = &lq_sta->lq;
849 tx_rate = le32_to_cpu(table->rs_table[0].rate_n_flags); 849 tx_rate = le32_to_cpu(table->rs_table[0].rate_n_flags);
850 il4965_rs_get_tbl_info_from_mcs(tx_rate, 850 il4965_rs_get_tbl_info_from_mcs(tx_rate,
851 il->band, &tbl_type, &rs_index); 851 il->band, &tbl_type, &rs_idx);
852 if (il->band == IEEE80211_BAND_5GHZ) 852 if (il->band == IEEE80211_BAND_5GHZ)
853 rs_index -= IL_FIRST_OFDM_RATE; 853 rs_idx -= IL_FIRST_OFDM_RATE;
854 mac_flags = info->status.rates[0].flags; 854 mac_flags = info->status.rates[0].flags;
855 mac_index = info->status.rates[0].idx; 855 mac_idx = info->status.rates[0].idx;
856 /* For HT packets, map MCS to PLCP */ 856 /* For HT packets, map MCS to PLCP */
857 if (mac_flags & IEEE80211_TX_RC_MCS) { 857 if (mac_flags & IEEE80211_TX_RC_MCS) {
858 mac_index &= RATE_MCS_CODE_MSK; /* Remove # of streams */ 858 mac_idx &= RATE_MCS_CODE_MSK; /* Remove # of streams */
859 if (mac_index >= (RATE_9M_IDX - IL_FIRST_OFDM_RATE)) 859 if (mac_idx >= (RATE_9M_IDX - IL_FIRST_OFDM_RATE))
860 mac_index++; 860 mac_idx++;
861 /* 861 /*
862 * mac80211 HT index is always zero-indexed; we need to move 862 * mac80211 HT idx is always zero-idxed; we need to move
863 * HT OFDM rates after CCK rates in 2.4 GHz band 863 * HT OFDM rates after CCK rates in 2.4 GHz band
864 */ 864 */
865 if (il->band == IEEE80211_BAND_2GHZ) 865 if (il->band == IEEE80211_BAND_2GHZ)
866 mac_index += IL_FIRST_OFDM_RATE; 866 mac_idx += IL_FIRST_OFDM_RATE;
867 } 867 }
868 /* Here we actually compare this rate to the latest LQ command */ 868 /* Here we actually compare this rate to the latest LQ command */
869 if (mac_index < 0 || 869 if (mac_idx < 0 ||
870 tbl_type.is_SGI != !!(mac_flags & IEEE80211_TX_RC_SHORT_GI) || 870 tbl_type.is_SGI != !!(mac_flags & IEEE80211_TX_RC_SHORT_GI) ||
871 tbl_type.is_ht40 != !!(mac_flags & IEEE80211_TX_RC_40_MHZ_WIDTH) || 871 tbl_type.is_ht40 != !!(mac_flags & IEEE80211_TX_RC_40_MHZ_WIDTH) ||
872 tbl_type.is_dup != !!(mac_flags & IEEE80211_TX_RC_DUP_DATA) || 872 tbl_type.is_dup != !!(mac_flags & IEEE80211_TX_RC_DUP_DATA) ||
873 tbl_type.ant_type != info->antenna_sel_tx || 873 tbl_type.ant_type != info->antenna_sel_tx ||
874 !!(tx_rate & RATE_MCS_HT_MSK) != !!(mac_flags & IEEE80211_TX_RC_MCS) || 874 !!(tx_rate & RATE_MCS_HT_MSK) != !!(mac_flags & IEEE80211_TX_RC_MCS) ||
875 !!(tx_rate & RATE_MCS_GF_MSK) != !!(mac_flags & IEEE80211_TX_RC_GREEN_FIELD) || 875 !!(tx_rate & RATE_MCS_GF_MSK) != !!(mac_flags & IEEE80211_TX_RC_GREEN_FIELD) ||
876 rs_index != mac_index) { 876 rs_idx != mac_idx) {
877 D_RATE( 877 D_RATE(
878 "initial rate %d does not match %d (0x%x)\n", 878 "initial rate %d does not match %d (0x%x)\n",
879 mac_index, rs_index, tx_rate); 879 mac_idx, rs_idx, tx_rate);
880 /* 880 /*
881 * Since rates mis-match, the last LQ command may have failed. 881 * Since rates mis-match, the last LQ command may have failed.
882 * After IL_MISSED_RATE_MAX mis-matches, resync the uCode with 882 * After IL_MISSED_RATE_MAX mis-matches, resync the uCode with
@@ -927,13 +927,13 @@ il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband,
927 * aggregated. 927 * aggregated.
928 * 928 *
929 * For aggregation, all packets were transmitted at the same rate, the 929 * For aggregation, all packets were transmitted at the same rate, the
930 * first index into rate scale table. 930 * first idx into rate scale table.
931 */ 931 */
932 if (info->flags & IEEE80211_TX_STAT_AMPDU) { 932 if (info->flags & IEEE80211_TX_STAT_AMPDU) {
933 tx_rate = le32_to_cpu(table->rs_table[0].rate_n_flags); 933 tx_rate = le32_to_cpu(table->rs_table[0].rate_n_flags);
934 il4965_rs_get_tbl_info_from_mcs(tx_rate, il->band, &tbl_type, 934 il4965_rs_get_tbl_info_from_mcs(tx_rate, il->band, &tbl_type,
935 &rs_index); 935 &rs_idx);
936 il4965_rs_collect_tx_data(curr_tbl, rs_index, 936 il4965_rs_collect_tx_data(curr_tbl, rs_idx,
937 info->status.ampdu_len, 937 info->status.ampdu_len,
938 info->status.ampdu_ack_len); 938 info->status.ampdu_ack_len);
939 939
@@ -957,7 +957,7 @@ il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband,
957 for (i = 0; i <= retries; ++i) { 957 for (i = 0; i <= retries; ++i) {
958 tx_rate = le32_to_cpu(table->rs_table[i].rate_n_flags); 958 tx_rate = le32_to_cpu(table->rs_table[i].rate_n_flags);
959 il4965_rs_get_tbl_info_from_mcs(tx_rate, il->band, 959 il4965_rs_get_tbl_info_from_mcs(tx_rate, il->band,
960 &tbl_type, &rs_index); 960 &tbl_type, &rs_idx);
961 /* 961 /*
962 * Only collect stats if retried rate is in the same RS 962 * Only collect stats if retried rate is in the same RS
963 * table as active/search. 963 * table as active/search.
@@ -969,7 +969,7 @@ il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband,
969 tmp_tbl = other_tbl; 969 tmp_tbl = other_tbl;
970 else 970 else
971 continue; 971 continue;
972 il4965_rs_collect_tx_data(tmp_tbl, rs_index, 1, 972 il4965_rs_collect_tx_data(tmp_tbl, rs_idx, 1,
973 i < retries ? 0 : legacy_success); 973 i < retries ? 0 : legacy_success);
974 } 974 }
975 975
@@ -1074,20 +1074,20 @@ static void il4965_rs_set_expected_tpt_table(struct il_lq_sta *lq_sta,
1074static s32 il4965_rs_get_best_rate(struct il_priv *il, 1074static s32 il4965_rs_get_best_rate(struct il_priv *il,
1075 struct il_lq_sta *lq_sta, 1075 struct il_lq_sta *lq_sta,
1076 struct il_scale_tbl_info *tbl, /* "search" */ 1076 struct il_scale_tbl_info *tbl, /* "search" */
1077 u16 rate_mask, s8 index) 1077 u16 rate_mask, s8 idx)
1078{ 1078{
1079 /* "active" values */ 1079 /* "active" values */
1080 struct il_scale_tbl_info *active_tbl = 1080 struct il_scale_tbl_info *active_tbl =
1081 &(lq_sta->lq_info[lq_sta->active_tbl]); 1081 &(lq_sta->lq_info[lq_sta->active_tbl]);
1082 s32 active_sr = active_tbl->win[index].success_ratio; 1082 s32 active_sr = active_tbl->win[idx].success_ratio;
1083 s32 active_tpt = active_tbl->expected_tpt[index]; 1083 s32 active_tpt = active_tbl->expected_tpt[idx];
1084 1084
1085 /* expected "search" throughput */ 1085 /* expected "search" throughput */
1086 s32 *tpt_tbl = tbl->expected_tpt; 1086 s32 *tpt_tbl = tbl->expected_tpt;
1087 1087
1088 s32 new_rate, high, low, start_hi; 1088 s32 new_rate, high, low, start_hi;
1089 u16 high_low; 1089 u16 high_low;
1090 s8 rate = index; 1090 s8 rate = idx;
1091 1091
1092 new_rate = high = low = start_hi = RATE_INVALID; 1092 new_rate = high = low = start_hi = RATE_INVALID;
1093 1093
@@ -1169,7 +1169,7 @@ static int il4965_rs_switch_to_mimo2(struct il_priv *il,
1169 struct il_lq_sta *lq_sta, 1169 struct il_lq_sta *lq_sta,
1170 struct ieee80211_conf *conf, 1170 struct ieee80211_conf *conf,
1171 struct ieee80211_sta *sta, 1171 struct ieee80211_sta *sta,
1172 struct il_scale_tbl_info *tbl, int index) 1172 struct il_scale_tbl_info *tbl, int idx)
1173{ 1173{
1174 u16 rate_mask; 1174 u16 rate_mask;
1175 s32 rate; 1175 s32 rate;
@@ -1203,20 +1203,20 @@ static int il4965_rs_switch_to_mimo2(struct il_priv *il,
1203 1203
1204 il4965_rs_set_expected_tpt_table(lq_sta, tbl); 1204 il4965_rs_set_expected_tpt_table(lq_sta, tbl);
1205 1205
1206 rate = il4965_rs_get_best_rate(il, lq_sta, tbl, rate_mask, index); 1206 rate = il4965_rs_get_best_rate(il, lq_sta, tbl, rate_mask, idx);
1207 1207
1208 D_RATE("LQ: MIMO2 best rate %d mask %X\n", 1208 D_RATE("LQ: MIMO2 best rate %d mask %X\n",
1209 rate, rate_mask); 1209 rate, rate_mask);
1210 if (rate == RATE_INVALID || !((1 << rate) & rate_mask)) { 1210 if (rate == RATE_INVALID || !((1 << rate) & rate_mask)) {
1211 D_RATE( 1211 D_RATE(
1212 "Can't switch with index %d rate mask %x\n", 1212 "Can't switch with idx %d rate mask %x\n",
1213 rate, rate_mask); 1213 rate, rate_mask);
1214 return -1; 1214 return -1;
1215 } 1215 }
1216 tbl->current_rate = il4965_rate_n_flags_from_tbl(il, 1216 tbl->current_rate = il4965_rate_n_flags_from_tbl(il,
1217 tbl, rate, is_green); 1217 tbl, rate, is_green);
1218 1218
1219 D_RATE("LQ: Switch to new mcs %X index is green %X\n", 1219 D_RATE("LQ: Switch to new mcs %X idx is green %X\n",
1220 tbl->current_rate, is_green); 1220 tbl->current_rate, is_green);
1221 return 0; 1221 return 0;
1222} 1222}
@@ -1228,7 +1228,7 @@ static int il4965_rs_switch_to_siso(struct il_priv *il,
1228 struct il_lq_sta *lq_sta, 1228 struct il_lq_sta *lq_sta,
1229 struct ieee80211_conf *conf, 1229 struct ieee80211_conf *conf,
1230 struct ieee80211_sta *sta, 1230 struct ieee80211_sta *sta,
1231 struct il_scale_tbl_info *tbl, int index) 1231 struct il_scale_tbl_info *tbl, int idx)
1232{ 1232{
1233 u16 rate_mask; 1233 u16 rate_mask;
1234 u8 is_green = lq_sta->is_green; 1234 u8 is_green = lq_sta->is_green;
@@ -1256,18 +1256,18 @@ static int il4965_rs_switch_to_siso(struct il_priv *il,
1256 tbl->is_SGI = 0; /*11n spec: no SGI in SISO+Greenfield*/ 1256 tbl->is_SGI = 0; /*11n spec: no SGI in SISO+Greenfield*/
1257 1257
1258 il4965_rs_set_expected_tpt_table(lq_sta, tbl); 1258 il4965_rs_set_expected_tpt_table(lq_sta, tbl);
1259 rate = il4965_rs_get_best_rate(il, lq_sta, tbl, rate_mask, index); 1259 rate = il4965_rs_get_best_rate(il, lq_sta, tbl, rate_mask, idx);
1260 1260
1261 D_RATE("LQ: get best rate %d mask %X\n", rate, rate_mask); 1261 D_RATE("LQ: get best rate %d mask %X\n", rate, rate_mask);
1262 if (rate == RATE_INVALID || !((1 << rate) & rate_mask)) { 1262 if (rate == RATE_INVALID || !((1 << rate) & rate_mask)) {
1263 D_RATE( 1263 D_RATE(
1264 "can not switch with index %d rate mask %x\n", 1264 "can not switch with idx %d rate mask %x\n",
1265 rate, rate_mask); 1265 rate, rate_mask);
1266 return -1; 1266 return -1;
1267 } 1267 }
1268 tbl->current_rate = il4965_rate_n_flags_from_tbl(il, 1268 tbl->current_rate = il4965_rate_n_flags_from_tbl(il,
1269 tbl, rate, is_green); 1269 tbl, rate, is_green);
1270 D_RATE("LQ: Switch to new mcs %X index is green %X\n", 1270 D_RATE("LQ: Switch to new mcs %X idx is green %X\n",
1271 tbl->current_rate, is_green); 1271 tbl->current_rate, is_green);
1272 return 0; 1272 return 0;
1273} 1273}
@@ -1279,12 +1279,12 @@ static int il4965_rs_move_legacy_other(struct il_priv *il,
1279 struct il_lq_sta *lq_sta, 1279 struct il_lq_sta *lq_sta,
1280 struct ieee80211_conf *conf, 1280 struct ieee80211_conf *conf,
1281 struct ieee80211_sta *sta, 1281 struct ieee80211_sta *sta,
1282 int index) 1282 int idx)
1283{ 1283{
1284 struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1284 struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
1285 struct il_scale_tbl_info *search_tbl = 1285 struct il_scale_tbl_info *search_tbl =
1286 &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 1286 &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
1287 struct il_rate_scale_data *win = &(tbl->win[index]); 1287 struct il_rate_scale_data *win = &(tbl->win[idx]);
1288 u32 sz = (sizeof(struct il_scale_tbl_info) - 1288 u32 sz = (sizeof(struct il_scale_tbl_info) -
1289 (sizeof(struct il_rate_scale_data) * RATE_COUNT)); 1289 (sizeof(struct il_rate_scale_data) * RATE_COUNT));
1290 u8 start_action; 1290 u8 start_action;
@@ -1331,7 +1331,7 @@ static int il4965_rs_move_legacy_other(struct il_priv *il,
1331 memcpy(search_tbl, tbl, sz); 1331 memcpy(search_tbl, tbl, sz);
1332 search_tbl->is_SGI = 0; 1332 search_tbl->is_SGI = 0;
1333 ret = il4965_rs_switch_to_siso(il, lq_sta, conf, sta, 1333 ret = il4965_rs_switch_to_siso(il, lq_sta, conf, sta,
1334 search_tbl, index); 1334 search_tbl, idx);
1335 if (!ret) { 1335 if (!ret) {
1336 lq_sta->action_counter = 0; 1336 lq_sta->action_counter = 0;
1337 goto out; 1337 goto out;
@@ -1360,7 +1360,7 @@ static int il4965_rs_move_legacy_other(struct il_priv *il,
1360 1360
1361 ret = il4965_rs_switch_to_mimo2(il, lq_sta, 1361 ret = il4965_rs_switch_to_mimo2(il, lq_sta,
1362 conf, sta, 1362 conf, sta,
1363 search_tbl, index); 1363 search_tbl, idx);
1364 if (!ret) { 1364 if (!ret) {
1365 lq_sta->action_counter = 0; 1365 lq_sta->action_counter = 0;
1366 goto out; 1366 goto out;
@@ -1395,13 +1395,13 @@ out:
1395static int il4965_rs_move_siso_to_other(struct il_priv *il, 1395static int il4965_rs_move_siso_to_other(struct il_priv *il,
1396 struct il_lq_sta *lq_sta, 1396 struct il_lq_sta *lq_sta,
1397 struct ieee80211_conf *conf, 1397 struct ieee80211_conf *conf,
1398 struct ieee80211_sta *sta, int index) 1398 struct ieee80211_sta *sta, int idx)
1399{ 1399{
1400 u8 is_green = lq_sta->is_green; 1400 u8 is_green = lq_sta->is_green;
1401 struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1401 struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
1402 struct il_scale_tbl_info *search_tbl = 1402 struct il_scale_tbl_info *search_tbl =
1403 &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 1403 &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
1404 struct il_rate_scale_data *win = &(tbl->win[index]); 1404 struct il_rate_scale_data *win = &(tbl->win[idx]);
1405 struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; 1405 struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap;
1406 u32 sz = (sizeof(struct il_scale_tbl_info) - 1406 u32 sz = (sizeof(struct il_scale_tbl_info) -
1407 (sizeof(struct il_rate_scale_data) * RATE_COUNT)); 1407 (sizeof(struct il_rate_scale_data) * RATE_COUNT));
@@ -1455,7 +1455,7 @@ static int il4965_rs_move_siso_to_other(struct il_priv *il,
1455 1455
1456 ret = il4965_rs_switch_to_mimo2(il, lq_sta, 1456 ret = il4965_rs_switch_to_mimo2(il, lq_sta,
1457 conf, sta, 1457 conf, sta,
1458 search_tbl, index); 1458 search_tbl, idx);
1459 if (!ret) 1459 if (!ret)
1460 goto out; 1460 goto out;
1461 break; 1461 break;
@@ -1481,12 +1481,12 @@ static int il4965_rs_move_siso_to_other(struct il_priv *il,
1481 il4965_rs_set_expected_tpt_table(lq_sta, search_tbl); 1481 il4965_rs_set_expected_tpt_table(lq_sta, search_tbl);
1482 if (tbl->is_SGI) { 1482 if (tbl->is_SGI) {
1483 s32 tpt = lq_sta->last_tpt / 100; 1483 s32 tpt = lq_sta->last_tpt / 100;
1484 if (tpt >= search_tbl->expected_tpt[index]) 1484 if (tpt >= search_tbl->expected_tpt[idx])
1485 break; 1485 break;
1486 } 1486 }
1487 search_tbl->current_rate = 1487 search_tbl->current_rate =
1488 il4965_rate_n_flags_from_tbl(il, search_tbl, 1488 il4965_rate_n_flags_from_tbl(il, search_tbl,
1489 index, is_green); 1489 idx, is_green);
1490 update_search_tbl_counter = 1; 1490 update_search_tbl_counter = 1;
1491 goto out; 1491 goto out;
1492 } 1492 }
@@ -1517,13 +1517,13 @@ static int il4965_rs_move_siso_to_other(struct il_priv *il,
1517static int il4965_rs_move_mimo2_to_other(struct il_priv *il, 1517static int il4965_rs_move_mimo2_to_other(struct il_priv *il,
1518 struct il_lq_sta *lq_sta, 1518 struct il_lq_sta *lq_sta,
1519 struct ieee80211_conf *conf, 1519 struct ieee80211_conf *conf,
1520 struct ieee80211_sta *sta, int index) 1520 struct ieee80211_sta *sta, int idx)
1521{ 1521{
1522 s8 is_green = lq_sta->is_green; 1522 s8 is_green = lq_sta->is_green;
1523 struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1523 struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
1524 struct il_scale_tbl_info *search_tbl = 1524 struct il_scale_tbl_info *search_tbl =
1525 &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 1525 &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
1526 struct il_rate_scale_data *win = &(tbl->win[index]); 1526 struct il_rate_scale_data *win = &(tbl->win[idx]);
1527 struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; 1527 struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap;
1528 u32 sz = (sizeof(struct il_scale_tbl_info) - 1528 u32 sz = (sizeof(struct il_scale_tbl_info) -
1529 (sizeof(struct il_rate_scale_data) * RATE_COUNT)); 1529 (sizeof(struct il_rate_scale_data) * RATE_COUNT));
@@ -1575,7 +1575,7 @@ static int il4965_rs_move_mimo2_to_other(struct il_priv *il,
1575 1575
1576 ret = il4965_rs_switch_to_siso(il, lq_sta, 1576 ret = il4965_rs_switch_to_siso(il, lq_sta,
1577 conf, sta, 1577 conf, sta,
1578 search_tbl, index); 1578 search_tbl, idx);
1579 if (!ret) 1579 if (!ret)
1580 goto out; 1580 goto out;
1581 1581
@@ -1603,12 +1603,12 @@ static int il4965_rs_move_mimo2_to_other(struct il_priv *il,
1603 */ 1603 */
1604 if (tbl->is_SGI) { 1604 if (tbl->is_SGI) {
1605 s32 tpt = lq_sta->last_tpt / 100; 1605 s32 tpt = lq_sta->last_tpt / 100;
1606 if (tpt >= search_tbl->expected_tpt[index]) 1606 if (tpt >= search_tbl->expected_tpt[idx])
1607 break; 1607 break;
1608 } 1608 }
1609 search_tbl->current_rate = 1609 search_tbl->current_rate =
1610 il4965_rate_n_flags_from_tbl(il, search_tbl, 1610 il4965_rate_n_flags_from_tbl(il, search_tbl,
1611 index, is_green); 1611 idx, is_green);
1612 update_search_tbl_counter = 1; 1612 update_search_tbl_counter = 1;
1613 goto out; 1613 goto out;
1614 1614
@@ -1728,12 +1728,12 @@ static u32 il4965_rs_update_rate_tbl(struct il_priv *il,
1728 struct il_rxon_context *ctx, 1728 struct il_rxon_context *ctx,
1729 struct il_lq_sta *lq_sta, 1729 struct il_lq_sta *lq_sta,
1730 struct il_scale_tbl_info *tbl, 1730 struct il_scale_tbl_info *tbl,
1731 int index, u8 is_green) 1731 int idx, u8 is_green)
1732{ 1732{
1733 u32 rate; 1733 u32 rate;
1734 1734
1735 /* Update uCode's rate table. */ 1735 /* Update uCode's rate table. */
1736 rate = il4965_rate_n_flags_from_tbl(il, tbl, index, is_green); 1736 rate = il4965_rate_n_flags_from_tbl(il, tbl, idx, is_green);
1737 il4965_rs_fill_link_cmd(il, lq_sta, rate); 1737 il4965_rs_fill_link_cmd(il, lq_sta, rate);
1738 il_send_lq_cmd(il, ctx, &lq_sta->lq, CMD_ASYNC, false); 1738 il_send_lq_cmd(il, ctx, &lq_sta->lq, CMD_ASYNC, false);
1739 1739
@@ -1754,7 +1754,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
1754 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 1754 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
1755 int low = RATE_INVALID; 1755 int low = RATE_INVALID;
1756 int high = RATE_INVALID; 1756 int high = RATE_INVALID;
1757 int index; 1757 int idx;
1758 int i; 1758 int i;
1759 struct il_rate_scale_data *win = NULL; 1759 struct il_rate_scale_data *win = NULL;
1760 int current_tpt = IL_INVALID_VALUE; 1760 int current_tpt = IL_INVALID_VALUE;
@@ -1765,7 +1765,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
1765 u16 rate_mask; 1765 u16 rate_mask;
1766 u8 update_lq = 0; 1766 u8 update_lq = 0;
1767 struct il_scale_tbl_info *tbl, *tbl1; 1767 struct il_scale_tbl_info *tbl, *tbl1;
1768 u16 rate_scale_index_msk = 0; 1768 u16 rate_scale_idx_msk = 0;
1769 u32 rate; 1769 u32 rate;
1770 u8 is_green = 0; 1770 u8 is_green = 0;
1771 u8 active_tbl = 0; 1771 u8 active_tbl = 0;
@@ -1818,9 +1818,9 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
1818 is_green = lq_sta->is_green; 1818 is_green = lq_sta->is_green;
1819 1819
1820 /* current tx rate */ 1820 /* current tx rate */
1821 index = lq_sta->last_txrate_idx; 1821 idx = lq_sta->last_txrate_idx;
1822 1822
1823 D_RATE("Rate scale index %d for type %d\n", index, 1823 D_RATE("Rate scale idx %d for type %d\n", idx,
1824 tbl->lq_type); 1824 tbl->lq_type);
1825 1825
1826 /* rates available for this association, and for modulation mode */ 1826 /* rates available for this association, and for modulation mode */
@@ -1832,19 +1832,19 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
1832 if (is_legacy(tbl->lq_type)) { 1832 if (is_legacy(tbl->lq_type)) {
1833 if (lq_sta->band == IEEE80211_BAND_5GHZ) 1833 if (lq_sta->band == IEEE80211_BAND_5GHZ)
1834 /* supp_rates has no CCK bits in A mode */ 1834 /* supp_rates has no CCK bits in A mode */
1835 rate_scale_index_msk = (u16) (rate_mask & 1835 rate_scale_idx_msk = (u16) (rate_mask &
1836 (lq_sta->supp_rates << IL_FIRST_OFDM_RATE)); 1836 (lq_sta->supp_rates << IL_FIRST_OFDM_RATE));
1837 else 1837 else
1838 rate_scale_index_msk = (u16) (rate_mask & 1838 rate_scale_idx_msk = (u16) (rate_mask &
1839 lq_sta->supp_rates); 1839 lq_sta->supp_rates);
1840 1840
1841 } else 1841 } else
1842 rate_scale_index_msk = rate_mask; 1842 rate_scale_idx_msk = rate_mask;
1843 1843
1844 if (!rate_scale_index_msk) 1844 if (!rate_scale_idx_msk)
1845 rate_scale_index_msk = rate_mask; 1845 rate_scale_idx_msk = rate_mask;
1846 1846
1847 if (!((1 << index) & rate_scale_index_msk)) { 1847 if (!((1 << idx) & rate_scale_idx_msk)) {
1848 IL_ERR("Current Rate is not valid\n"); 1848 IL_ERR("Current Rate is not valid\n");
1849 if (lq_sta->search_better_tbl) { 1849 if (lq_sta->search_better_tbl) {
1850 /* revert to active table if search table is not valid*/ 1850 /* revert to active table if search table is not valid*/
@@ -1852,9 +1852,9 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
1852 lq_sta->search_better_tbl = 0; 1852 lq_sta->search_better_tbl = 0;
1853 tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1853 tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
1854 /* get "active" rate info */ 1854 /* get "active" rate info */
1855 index = il4965_hwrate_to_plcp_idx(tbl->current_rate); 1855 idx = il4965_hwrate_to_plcp_idx(tbl->current_rate);
1856 rate = il4965_rs_update_rate_tbl(il, ctx, lq_sta, 1856 rate = il4965_rs_update_rate_tbl(il, ctx, lq_sta,
1857 tbl, index, is_green); 1857 tbl, idx, is_green);
1858 } 1858 }
1859 return; 1859 return;
1860 } 1860 }
@@ -1867,14 +1867,14 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
1867 1867
1868 /* force user max rate if set by user */ 1868 /* force user max rate if set by user */
1869 if (lq_sta->max_rate_idx != -1 && 1869 if (lq_sta->max_rate_idx != -1 &&
1870 lq_sta->max_rate_idx < index) { 1870 lq_sta->max_rate_idx < idx) {
1871 index = lq_sta->max_rate_idx; 1871 idx = lq_sta->max_rate_idx;
1872 update_lq = 1; 1872 update_lq = 1;
1873 win = &(tbl->win[index]); 1873 win = &(tbl->win[idx]);
1874 goto lq_update; 1874 goto lq_update;
1875 } 1875 }
1876 1876
1877 win = &(tbl->win[index]); 1877 win = &(tbl->win[idx]);
1878 1878
1879 /* 1879 /*
1880 * If there is not enough history to calculate actual average 1880 * If there is not enough history to calculate actual average
@@ -1887,8 +1887,8 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
1887 if (fail_count < RATE_MIN_FAILURE_TH && 1887 if (fail_count < RATE_MIN_FAILURE_TH &&
1888 win->success_counter < RATE_MIN_SUCCESS_TH) { 1888 win->success_counter < RATE_MIN_SUCCESS_TH) {
1889 D_RATE("LQ: still below TH. succ=%d total=%d " 1889 D_RATE("LQ: still below TH. succ=%d total=%d "
1890 "for index %d\n", 1890 "for idx %d\n",
1891 win->success_counter, win->counter, index); 1891 win->success_counter, win->counter, idx);
1892 1892
1893 /* Can't calculate this yet; not enough history */ 1893 /* Can't calculate this yet; not enough history */
1894 win->average_tpt = IL_INVALID_VALUE; 1894 win->average_tpt = IL_INVALID_VALUE;
@@ -1902,11 +1902,11 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
1902 /* Else we have enough samples; calculate estimate of 1902 /* Else we have enough samples; calculate estimate of
1903 * actual average throughput */ 1903 * actual average throughput */
1904 if (win->average_tpt != ((win->success_ratio * 1904 if (win->average_tpt != ((win->success_ratio *
1905 tbl->expected_tpt[index] + 64) / 128)) { 1905 tbl->expected_tpt[idx] + 64) / 128)) {
1906 IL_ERR( 1906 IL_ERR(
1907 "expected_tpt should have been calculated by now\n"); 1907 "expected_tpt should have been calculated by now\n");
1908 win->average_tpt = ((win->success_ratio * 1908 win->average_tpt = ((win->success_ratio *
1909 tbl->expected_tpt[index] + 64) / 128); 1909 tbl->expected_tpt[idx] + 64) / 128);
1910 } 1910 }
1911 1911
1912 /* If we are searching for better modulation mode, check success. */ 1912 /* If we are searching for better modulation mode, check success. */
@@ -1946,7 +1946,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
1946 tbl = &(lq_sta->lq_info[active_tbl]); 1946 tbl = &(lq_sta->lq_info[active_tbl]);
1947 1947
1948 /* Revert to "active" rate and throughput info */ 1948 /* Revert to "active" rate and throughput info */
1949 index = il4965_hwrate_to_plcp_idx(tbl->current_rate); 1949 idx = il4965_hwrate_to_plcp_idx(tbl->current_rate);
1950 current_tpt = lq_sta->last_tpt; 1950 current_tpt = lq_sta->last_tpt;
1951 1951
1952 /* Need to set up a new rate table in uCode */ 1952 /* Need to set up a new rate table in uCode */
@@ -1962,8 +1962,8 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
1962 1962
1963 /* (Else) not in search of better modulation mode, try for better 1963 /* (Else) not in search of better modulation mode, try for better
1964 * starting rate, while staying in this mode. */ 1964 * starting rate, while staying in this mode. */
1965 high_low = il4965_rs_get_adjacent_rate(il, index, 1965 high_low = il4965_rs_get_adjacent_rate(il, idx,
1966 rate_scale_index_msk, 1966 rate_scale_idx_msk,
1967 tbl->lq_type); 1967 tbl->lq_type);
1968 low = high_low & 0xff; 1968 low = high_low & 0xff;
1969 high = (high_low >> 8) & 0xff; 1969 high = (high_low >> 8) & 0xff;
@@ -2043,7 +2043,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
2043 /* Decrease starting rate, update uCode's rate table */ 2043 /* Decrease starting rate, update uCode's rate table */
2044 if (low != RATE_INVALID) { 2044 if (low != RATE_INVALID) {
2045 update_lq = 1; 2045 update_lq = 1;
2046 index = low; 2046 idx = low;
2047 } 2047 }
2048 2048
2049 break; 2049 break;
@@ -2051,7 +2051,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
2051 /* Increase starting rate, update uCode's rate table */ 2051 /* Increase starting rate, update uCode's rate table */
2052 if (high != RATE_INVALID) { 2052 if (high != RATE_INVALID) {
2053 update_lq = 1; 2053 update_lq = 1;
2054 index = high; 2054 idx = high;
2055 } 2055 }
2056 2056
2057 break; 2057 break;
@@ -2061,15 +2061,15 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
2061 break; 2061 break;
2062 } 2062 }
2063 2063
2064 D_RATE("choose rate scale index %d action %d low %d " 2064 D_RATE("choose rate scale idx %d action %d low %d "
2065 "high %d type %d\n", 2065 "high %d type %d\n",
2066 index, scale_action, low, high, tbl->lq_type); 2066 idx, scale_action, low, high, tbl->lq_type);
2067 2067
2068lq_update: 2068lq_update:
2069 /* Replace uCode's rate table for the destination station. */ 2069 /* Replace uCode's rate table for the destination station. */
2070 if (update_lq) 2070 if (update_lq)
2071 rate = il4965_rs_update_rate_tbl(il, ctx, lq_sta, 2071 rate = il4965_rs_update_rate_tbl(il, ctx, lq_sta,
2072 tbl, index, is_green); 2072 tbl, idx, is_green);
2073 2073
2074 /* Should we stay with this modulation mode, 2074 /* Should we stay with this modulation mode,
2075 * or search for a new one? */ 2075 * or search for a new one? */
@@ -2090,13 +2090,13 @@ lq_update:
2090 * If one is found, set up the new "search" table. */ 2090 * If one is found, set up the new "search" table. */
2091 if (is_legacy(tbl->lq_type)) 2091 if (is_legacy(tbl->lq_type))
2092 il4965_rs_move_legacy_other(il, lq_sta, 2092 il4965_rs_move_legacy_other(il, lq_sta,
2093 conf, sta, index); 2093 conf, sta, idx);
2094 else if (is_siso(tbl->lq_type)) 2094 else if (is_siso(tbl->lq_type))
2095 il4965_rs_move_siso_to_other(il, lq_sta, 2095 il4965_rs_move_siso_to_other(il, lq_sta,
2096 conf, sta, index); 2096 conf, sta, idx);
2097 else /* (is_mimo2(tbl->lq_type)) */ 2097 else /* (is_mimo2(tbl->lq_type)) */
2098 il4965_rs_move_mimo2_to_other(il, lq_sta, 2098 il4965_rs_move_mimo2_to_other(il, lq_sta,
2099 conf, sta, index); 2099 conf, sta, idx);
2100 2100
2101 /* If new "search" mode was selected, set up in uCode table */ 2101 /* If new "search" mode was selected, set up in uCode table */
2102 if (lq_sta->search_better_tbl) { 2102 if (lq_sta->search_better_tbl) {
@@ -2107,11 +2107,11 @@ lq_update:
2107 &(tbl->win[i])); 2107 &(tbl->win[i]));
2108 2108
2109 /* Use new "search" start rate */ 2109 /* Use new "search" start rate */
2110 index = il4965_hwrate_to_plcp_idx(tbl->current_rate); 2110 idx = il4965_hwrate_to_plcp_idx(tbl->current_rate);
2111 2111
2112 D_RATE( 2112 D_RATE(
2113 "Switch current mcs: %X index: %d\n", 2113 "Switch current mcs: %X idx: %d\n",
2114 tbl->current_rate, index); 2114 tbl->current_rate, idx);
2115 il4965_rs_fill_link_cmd(il, lq_sta, 2115 il4965_rs_fill_link_cmd(il, lq_sta,
2116 tbl->current_rate); 2116 tbl->current_rate);
2117 il_send_lq_cmd(il, ctx, 2117 il_send_lq_cmd(il, ctx,
@@ -2157,8 +2157,8 @@ lq_update:
2157 2157
2158out: 2158out:
2159 tbl->current_rate = il4965_rate_n_flags_from_tbl(il, tbl, 2159 tbl->current_rate = il4965_rate_n_flags_from_tbl(il, tbl,
2160 index, is_green); 2160 idx, is_green);
2161 i = index; 2161 i = idx;
2162 lq_sta->last_txrate_idx = i; 2162 lq_sta->last_txrate_idx = i;
2163} 2163}
2164 2164
@@ -2272,7 +2272,7 @@ il4965_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
2272 2272
2273 if (lq_sta->last_rate_n_flags & RATE_MCS_HT_MSK) { 2273 if (lq_sta->last_rate_n_flags & RATE_MCS_HT_MSK) {
2274 rate_idx -= IL_FIRST_OFDM_RATE; 2274 rate_idx -= IL_FIRST_OFDM_RATE;
2275 /* 6M and 9M shared same MCS index */ 2275 /* 6M and 9M shared same MCS idx */
2276 rate_idx = (rate_idx > 0) ? (rate_idx - 1) : 0; 2276 rate_idx = (rate_idx > 0) ? (rate_idx - 1) : 0;
2277 if (il4965_rs_extract_rate(lq_sta->last_rate_n_flags) >= 2277 if (il4965_rs_extract_rate(lq_sta->last_rate_n_flags) >=
2278 RATE_MIMO2_6M_PLCP) 2278 RATE_MIMO2_6M_PLCP)
@@ -2296,7 +2296,7 @@ il4965_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
2296 (sband->band == IEEE80211_BAND_5GHZ && 2296 (sband->band == IEEE80211_BAND_5GHZ &&
2297 rate_idx < IL_FIRST_OFDM_RATE)) 2297 rate_idx < IL_FIRST_OFDM_RATE))
2298 rate_idx = rate_lowest_index(sband, sta); 2298 rate_idx = rate_lowest_index(sband, sta);
2299 /* On valid 5 GHz rate, adjust index */ 2299 /* On valid 5 GHz rate, adjust idx */
2300 else if (sband->band == IEEE80211_BAND_5GHZ) 2300 else if (sband->band == IEEE80211_BAND_5GHZ)
2301 rate_idx -= IL_FIRST_OFDM_RATE; 2301 rate_idx -= IL_FIRST_OFDM_RATE;
2302 info->control.rates[0].flags = 0; 2302 info->control.rates[0].flags = 0;
@@ -2419,7 +2419,7 @@ static void il4965_rs_fill_link_cmd(struct il_priv *il,
2419 struct il_lq_sta *lq_sta, u32 new_rate) 2419 struct il_lq_sta *lq_sta, u32 new_rate)
2420{ 2420{
2421 struct il_scale_tbl_info tbl_type; 2421 struct il_scale_tbl_info tbl_type;
2422 int index = 0; 2422 int idx = 0;
2423 int rate_idx; 2423 int rate_idx;
2424 int repeat_rate = 0; 2424 int repeat_rate = 0;
2425 u8 ant_toggle_cnt = 0; 2425 u8 ant_toggle_cnt = 0;
@@ -2427,8 +2427,8 @@ static void il4965_rs_fill_link_cmd(struct il_priv *il,
2427 u8 valid_tx_ant = 0; 2427 u8 valid_tx_ant = 0;
2428 struct il_link_quality_cmd *lq_cmd = &lq_sta->lq; 2428 struct il_link_quality_cmd *lq_cmd = &lq_sta->lq;
2429 2429
2430 /* Override starting rate (index 0) if needed for debug purposes */ 2430 /* Override starting rate (idx 0) if needed for debug purposes */
2431 il4965_rs_dbgfs_set_mcs(lq_sta, &new_rate, index); 2431 il4965_rs_dbgfs_set_mcs(lq_sta, &new_rate, idx);
2432 2432
2433 /* Interpret new_rate (rate_n_flags) */ 2433 /* Interpret new_rate (rate_n_flags) */
2434 il4965_rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, 2434 il4965_rs_get_tbl_info_from_mcs(new_rate, lq_sta->band,
@@ -2445,8 +2445,8 @@ static void il4965_rs_fill_link_cmd(struct il_priv *il,
2445 lq_cmd->general_params.mimo_delimiter = 2445 lq_cmd->general_params.mimo_delimiter =
2446 is_mimo(tbl_type.lq_type) ? 1 : 0; 2446 is_mimo(tbl_type.lq_type) ? 1 : 0;
2447 2447
2448 /* Fill 1st table entry (index 0) */ 2448 /* Fill 1st table entry (idx 0) */
2449 lq_cmd->rs_table[index].rate_n_flags = cpu_to_le32(new_rate); 2449 lq_cmd->rs_table[idx].rate_n_flags = cpu_to_le32(new_rate);
2450 2450
2451 if (il4965_num_of_ant(tbl_type.ant_type) == 1) { 2451 if (il4965_num_of_ant(tbl_type.ant_type) == 1) {
2452 lq_cmd->general_params.single_stream_ant_msk = 2452 lq_cmd->general_params.single_stream_ant_msk =
@@ -2456,17 +2456,17 @@ static void il4965_rs_fill_link_cmd(struct il_priv *il,
2456 tbl_type.ant_type; 2456 tbl_type.ant_type;
2457 } /* otherwise we don't modify the existing value */ 2457 } /* otherwise we don't modify the existing value */
2458 2458
2459 index++; 2459 idx++;
2460 repeat_rate--; 2460 repeat_rate--;
2461 if (il) 2461 if (il)
2462 valid_tx_ant = il->hw_params.valid_tx_ant; 2462 valid_tx_ant = il->hw_params.valid_tx_ant;
2463 2463
2464 /* Fill rest of rate table */ 2464 /* Fill rest of rate table */
2465 while (index < LINK_QUAL_MAX_RETRY_NUM) { 2465 while (idx < LINK_QUAL_MAX_RETRY_NUM) {
2466 /* Repeat initial/next rate. 2466 /* Repeat initial/next rate.
2467 * For legacy IL_NUMBER_TRY == 1, this loop will not execute. 2467 * For legacy IL_NUMBER_TRY == 1, this loop will not execute.
2468 * For HT IL_HT_NUMBER_TRY == 3, this executes twice. */ 2468 * For HT IL_HT_NUMBER_TRY == 3, this executes twice. */
2469 while (repeat_rate > 0 && index < LINK_QUAL_MAX_RETRY_NUM) { 2469 while (repeat_rate > 0 && idx < LINK_QUAL_MAX_RETRY_NUM) {
2470 if (is_legacy(tbl_type.lq_type)) { 2470 if (is_legacy(tbl_type.lq_type)) {
2471 if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) 2471 if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE)
2472 ant_toggle_cnt++; 2472 ant_toggle_cnt++;
@@ -2477,13 +2477,13 @@ static void il4965_rs_fill_link_cmd(struct il_priv *il,
2477 } 2477 }
2478 2478
2479 /* Override next rate if needed for debug purposes */ 2479 /* Override next rate if needed for debug purposes */
2480 il4965_rs_dbgfs_set_mcs(lq_sta, &new_rate, index); 2480 il4965_rs_dbgfs_set_mcs(lq_sta, &new_rate, idx);
2481 2481
2482 /* Fill next table entry */ 2482 /* Fill next table entry */
2483 lq_cmd->rs_table[index].rate_n_flags = 2483 lq_cmd->rs_table[idx].rate_n_flags =
2484 cpu_to_le32(new_rate); 2484 cpu_to_le32(new_rate);
2485 repeat_rate--; 2485 repeat_rate--;
2486 index++; 2486 idx++;
2487 } 2487 }
2488 2488
2489 il4965_rs_get_tbl_info_from_mcs(new_rate, 2489 il4965_rs_get_tbl_info_from_mcs(new_rate,
@@ -2494,7 +2494,7 @@ static void il4965_rs_fill_link_cmd(struct il_priv *il,
2494 * If initial rate was MIMO, this will finally end up 2494 * If initial rate was MIMO, this will finally end up
2495 * as (IL_HT_NUMBER_TRY * 2), after 2nd pass, otherwise 0. */ 2495 * as (IL_HT_NUMBER_TRY * 2), after 2nd pass, otherwise 0. */
2496 if (is_mimo(tbl_type.lq_type)) 2496 if (is_mimo(tbl_type.lq_type))
2497 lq_cmd->general_params.mimo_delimiter = index; 2497 lq_cmd->general_params.mimo_delimiter = idx;
2498 2498
2499 /* Get next rate */ 2499 /* Get next rate */
2500 new_rate = il4965_rs_get_lower_rate(lq_sta, 2500 new_rate = il4965_rs_get_lower_rate(lq_sta,
@@ -2520,12 +2520,12 @@ static void il4965_rs_fill_link_cmd(struct il_priv *il,
2520 use_ht_possible = 0; 2520 use_ht_possible = 0;
2521 2521
2522 /* Override next rate if needed for debug purposes */ 2522 /* Override next rate if needed for debug purposes */
2523 il4965_rs_dbgfs_set_mcs(lq_sta, &new_rate, index); 2523 il4965_rs_dbgfs_set_mcs(lq_sta, &new_rate, idx);
2524 2524
2525 /* Fill next table entry */ 2525 /* Fill next table entry */
2526 lq_cmd->rs_table[index].rate_n_flags = cpu_to_le32(new_rate); 2526 lq_cmd->rs_table[idx].rate_n_flags = cpu_to_le32(new_rate);
2527 2527
2528 index++; 2528 idx++;
2529 repeat_rate--; 2529 repeat_rate--;
2530 } 2530 }
2531 2531
@@ -2564,7 +2564,7 @@ static int il4965_open_file_generic(struct inode *inode, struct file *file)
2564 return 0; 2564 return 0;
2565} 2565}
2566static void il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta, 2566static void il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta,
2567 u32 *rate_n_flags, int index) 2567 u32 *rate_n_flags, int idx)
2568{ 2568{
2569 struct il_priv *il; 2569 struct il_priv *il;
2570 u8 valid_tx_ant; 2570 u8 valid_tx_ant;
@@ -2636,7 +2636,7 @@ static ssize_t il4965_rs_sta_dbgfs_scale_table_read(struct file *file,
2636 char *buff; 2636 char *buff;
2637 int desc = 0; 2637 int desc = 0;
2638 int i = 0; 2638 int i = 0;
2639 int index = 0; 2639 int idx = 0;
2640 ssize_t ret; 2640 ssize_t ret;
2641 2641
2642 struct il_lq_sta *lq_sta = file->private_data; 2642 struct il_lq_sta *lq_sta = file->private_data;
@@ -2687,25 +2687,25 @@ static ssize_t il4965_rs_sta_dbgfs_scale_table_read(struct file *file,
2687 2687
2688 desc += sprintf(buff+desc, 2688 desc += sprintf(buff+desc,
2689 "Start idx [0]=0x%x [1]=0x%x [2]=0x%x [3]=0x%x\n", 2689 "Start idx [0]=0x%x [1]=0x%x [2]=0x%x [3]=0x%x\n",
2690 lq_sta->lq.general_params.start_rate_index[0], 2690 lq_sta->lq.general_params.start_rate_idx[0],
2691 lq_sta->lq.general_params.start_rate_index[1], 2691 lq_sta->lq.general_params.start_rate_idx[1],
2692 lq_sta->lq.general_params.start_rate_index[2], 2692 lq_sta->lq.general_params.start_rate_idx[2],
2693 lq_sta->lq.general_params.start_rate_index[3]); 2693 lq_sta->lq.general_params.start_rate_idx[3]);
2694 2694
2695 for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { 2695 for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) {
2696 index = il4965_hwrate_to_plcp_idx( 2696 idx = il4965_hwrate_to_plcp_idx(
2697 le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags)); 2697 le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags));
2698 if (is_legacy(tbl->lq_type)) { 2698 if (is_legacy(tbl->lq_type)) {
2699 desc += sprintf(buff+desc, " rate[%d] 0x%X %smbps\n", 2699 desc += sprintf(buff+desc, " rate[%d] 0x%X %smbps\n",
2700 i, 2700 i,
2701 le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags), 2701 le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags),
2702 il_rate_mcs[index].mbps); 2702 il_rate_mcs[idx].mbps);
2703 } else { 2703 } else {
2704 desc += sprintf(buff+desc, 2704 desc += sprintf(buff+desc,
2705 " rate[%d] 0x%X %smbps (%s)\n", 2705 " rate[%d] 0x%X %smbps (%s)\n",
2706 i, 2706 i,
2707 le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags), 2707 le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags),
2708 il_rate_mcs[index].mbps, il_rate_mcs[index].mcs); 2708 il_rate_mcs[idx].mbps, il_rate_mcs[idx].mcs);
2709 } 2709 }
2710 } 2710 }
2711 2711
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-sta.c b/drivers/net/wireless/iwlegacy/iwl-4965-sta.c
index c50d63918773..4cda277418f6 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-sta.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-sta.c
@@ -157,7 +157,7 @@ static int il4965_static_wepkey_cmd(struct il_priv *il,
157 (sizeof(struct il_wep_key) * WEP_KEYS_MAX)); 157 (sizeof(struct il_wep_key) * WEP_KEYS_MAX));
158 158
159 for (i = 0; i < WEP_KEYS_MAX ; i++) { 159 for (i = 0; i < WEP_KEYS_MAX ; i++) {
160 wep_cmd->key[i].key_index = i; 160 wep_cmd->key[i].key_idx = i;
161 if (ctx->wep_keys[i].key_size) { 161 if (ctx->wep_keys[i].key_size) {
162 wep_cmd->key[i].key_offset = i; 162 wep_cmd->key[i].key_offset = i;
163 not_empty = 1; 163 not_empty = 1;
@@ -283,7 +283,7 @@ static int il4965_set_wep_dynamic_key_info(struct il_priv *il,
283 if ((il->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 il->stations[sta_id].sta.key.key_offset = 285 il->stations[sta_id].sta.key.key_offset =
286 il_get_free_ucode_key_index(il); 286 il_get_free_ucode_key_idx(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
@@ -334,7 +334,7 @@ static int il4965_set_ccmp_dynamic_key_info(struct il_priv *il,
334 if ((il->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 il->stations[sta_id].sta.key.key_offset = 336 il->stations[sta_id].sta.key.key_offset =
337 il_get_free_ucode_key_index(il); 337 il_get_free_ucode_key_idx(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
@@ -379,7 +379,7 @@ static int il4965_set_tkip_dynamic_key_info(struct il_priv *il,
379 if ((il->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 il->stations[sta_id].sta.key.key_offset = 381 il->stations[sta_id].sta.key.key_offset =
382 il_get_free_ucode_key_index(il); 382 il_get_free_ucode_key_idx(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
@@ -457,9 +457,9 @@ int il4965_remove_dynamic_key(struct il_priv *il,
457 keyconf->keyidx, sta_id); 457 keyconf->keyidx, sta_id);
458 458
459 if (keyconf->keyidx != keyidx) { 459 if (keyconf->keyidx != keyidx) {
460 /* We need to remove a key with index different that the one 460 /* We need to remove a key with idx different that the one
461 * in the uCode. This means that the key we need to remove has 461 * in the uCode. This means that the key we need to remove has
462 * been replaced by another one with different index. 462 * been replaced by another one with different idx.
463 * Don't do anything and return ok 463 * Don't do anything and return ok
464 */ 464 */
465 spin_unlock_irqrestore(&il->sta_lock, flags); 465 spin_unlock_irqrestore(&il->sta_lock, flags);
@@ -475,7 +475,7 @@ int il4965_remove_dynamic_key(struct il_priv *il,
475 475
476 if (!test_and_clear_bit(il->stations[sta_id].sta.key.key_offset, 476 if (!test_and_clear_bit(il->stations[sta_id].sta.key.key_offset,
477 &il->ucode_key_table)) 477 &il->ucode_key_table))
478 IL_ERR("index %d not used in uCode key table.\n", 478 IL_ERR("idx %d not used in uCode key table.\n",
479 il->stations[sta_id].sta.key.key_offset); 479 il->stations[sta_id].sta.key.key_offset);
480 memset(&il->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));
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
index 8f18d36f08ad..a6fa1c2296ac 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
@@ -183,7 +183,7 @@ static void il4965_tx_cmd_build_rate(struct il_priv *il,
183 /* DATA packets will use the uCode station table for rate/antenna 183 /* DATA packets will use the uCode station table for rate/antenna
184 * selection */ 184 * selection */
185 if (ieee80211_is_data(fc)) { 185 if (ieee80211_is_data(fc)) {
186 tx_cmd->initial_rate_index = 0; 186 tx_cmd->initial_rate_idx = 0;
187 tx_cmd->tx_flags |= TX_CMD_FLG_STA_RATE_MSK; 187 tx_cmd->tx_flags |= TX_CMD_FLG_STA_RATE_MSK;
188 return; 188 return;
189 } 189 }
@@ -192,7 +192,7 @@ static void il4965_tx_cmd_build_rate(struct il_priv *il,
192 * If the current TX rate stored in mac80211 has the MCS bit set, it's 192 * If the current TX rate stored in mac80211 has the MCS bit set, it's
193 * not really a TX rate. Thus, we use the lowest supported rate for 193 * not really a TX rate. Thus, we use the lowest supported rate for
194 * this band. Also use the lowest supported rate if the stored rate 194 * this band. Also use the lowest supported rate if the stored rate
195 * index is invalid. 195 * idx is invalid.
196 */ 196 */
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) ||
@@ -319,7 +319,7 @@ int il4965_tx_skb(struct il_priv *il, struct sk_buff *skb)
319 if (!ieee80211_is_data(fc)) 319 if (!ieee80211_is_data(fc))
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 idx into station table for destination station */
323 sta_id = il_sta_id_or_broadcast(il, 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) {
@@ -417,7 +417,7 @@ int il4965_tx_skb(struct il_priv *il, struct sk_buff *skb)
417 417
418 /* 418 /*
419 * Set up the Tx-command (not MAC!) header. 419 * Set up the Tx-command (not MAC!) header.
420 * Store the chosen Tx queue and TFD index within the sequence field; 420 * Store the chosen Tx queue and TFD idx within the sequence field;
421 * after Tx, uCode's Tx response will return this value so driver can 421 * after Tx, uCode's Tx response will return this value so driver can
422 * locate the frame within the tx queue and do post-tx processing. 422 * locate the frame within the tx queue and do post-tx processing.
423 */ 423 */
@@ -513,7 +513,7 @@ int il4965_tx_skb(struct il_priv *il, struct sk_buff *skb)
513 pci_dma_sync_single_for_device(il->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 idx *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(il, txq); 518 il_txq_update_write_ptr(il, txq);
519 spin_unlock_irqrestore(&il->lock, flags); 519 spin_unlock_irqrestore(&il->lock, flags);
@@ -828,7 +828,7 @@ static int il4965_txq_agg_enable(struct il_priv *il, int txq_id,
828 /* Set this queue as a chain-building queue */ 828 /* Set this queue as a chain-building queue */
829 il_set_bits_prph(il, IL49_SCD_QUEUECHAIN_SEL, (1 << txq_id)); 829 il_set_bits_prph(il, IL49_SCD_QUEUECHAIN_SEL, (1 << txq_id));
830 830
831 /* Place first TFD at index corresponding to start sequence number. 831 /* Place first TFD at idx corresponding to start sequence number.
832 * Assumes that ssn_idx is valid (!= 0xFFF) */ 832 * Assumes that ssn_idx is valid (!= 0xFFF) */
833 il->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); 833 il->txq[txq_id].q.read_ptr = (ssn_idx & 0xff);
834 il->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); 834 il->txq[txq_id].q.write_ptr = (ssn_idx & 0xff);
@@ -1105,7 +1105,7 @@ il4965_tx_status(struct il_priv *il, struct il_tx_info *tx_info,
1105 ieee80211_tx_status_irqsafe(il->hw, tx_info->skb); 1105 ieee80211_tx_status_irqsafe(il->hw, tx_info->skb);
1106} 1106}
1107 1107
1108int il4965_tx_queue_reclaim(struct il_priv *il, int txq_id, int index) 1108int il4965_tx_queue_reclaim(struct il_priv *il, int txq_id, int idx)
1109{ 1109{
1110 struct il_tx_queue *txq = &il->txq[txq_id]; 1110 struct il_tx_queue *txq = &il->txq[txq_id];
1111 struct il_queue *q = &txq->q; 1111 struct il_queue *q = &txq->q;
@@ -1113,15 +1113,15 @@ int il4965_tx_queue_reclaim(struct il_priv *il, int txq_id, int index)
1113 int nfreed = 0; 1113 int nfreed = 0;
1114 struct ieee80211_hdr *hdr; 1114 struct ieee80211_hdr *hdr;
1115 1115
1116 if (index >= q->n_bd || il_queue_used(q, index) == 0) { 1116 if (idx >= q->n_bd || il_queue_used(q, idx) == 0) {
1117 IL_ERR("Read index for DMA queue txq id (%d), index %d, " 1117 IL_ERR("Read idx for DMA queue txq id (%d), idx %d, "
1118 "is out of range [0-%d] %d %d.\n", txq_id, 1118 "is out of range [0-%d] %d %d.\n", txq_id,
1119 index, q->n_bd, q->write_ptr, q->read_ptr); 1119 idx, q->n_bd, q->write_ptr, q->read_ptr);
1120 return 0; 1120 return 0;
1121 } 1121 }
1122 1122
1123 for (index = il_queue_inc_wrap(index, q->n_bd); 1123 for (idx = il_queue_inc_wrap(idx, q->n_bd);
1124 q->read_ptr != index; 1124 q->read_ptr != idx;
1125 q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd)) { 1125 q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd)) {
1126 1126
1127 tx_info = &txq->txb[txq->q.read_ptr]; 1127 tx_info = &txq->txb[txq->q.read_ptr];
@@ -1252,7 +1252,7 @@ void il4965_rx_reply_compressed_ba(struct il_priv *il,
1252 struct il_compressed_ba_resp *ba_resp = &pkt->u.compressed_ba; 1252 struct il_compressed_ba_resp *ba_resp = &pkt->u.compressed_ba;
1253 struct il_tx_queue *txq = NULL; 1253 struct il_tx_queue *txq = NULL;
1254 struct il_ht_agg *agg; 1254 struct il_ht_agg *agg;
1255 int index; 1255 int idx;
1256 int sta_id; 1256 int sta_id;
1257 int tid; 1257 int tid;
1258 unsigned long flags; 1258 unsigned long flags;
@@ -1260,7 +1260,7 @@ void il4965_rx_reply_compressed_ba(struct il_priv *il,
1260 /* "flow" corresponds to Tx queue */ 1260 /* "flow" corresponds to Tx queue */
1261 u16 scd_flow = le16_to_cpu(ba_resp->scd_flow); 1261 u16 scd_flow = le16_to_cpu(ba_resp->scd_flow);
1262 1262
1263 /* "ssn" is start of block-ack Tx win, corresponds to index 1263 /* "ssn" is start of block-ack Tx win, corresponds to idx
1264 * (in Tx queue's circular buffer) of first TFD/frame in win */ 1264 * (in Tx queue's circular buffer) of first TFD/frame in win */
1265 u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn); 1265 u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn);
1266 1266
@@ -1287,8 +1287,8 @@ void il4965_rx_reply_compressed_ba(struct il_priv *il,
1287 return; 1287 return;
1288 } 1288 }
1289 1289
1290 /* Find index just before block-ack win */ 1290 /* Find idx just before block-ack win */
1291 index = il_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd); 1291 idx = il_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd);
1292 1292
1293 spin_lock_irqsave(&il->sta_lock, flags); 1293 spin_lock_irqsave(&il->sta_lock, flags);
1294 1294
@@ -1317,7 +1317,7 @@ void il4965_rx_reply_compressed_ba(struct il_priv *il,
1317 * transmitted ... if not, it's too late anyway). */ 1317 * transmitted ... if not, it's too late anyway). */
1318 if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) { 1318 if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) {
1319 /* calculate mac80211 ampdu sw queue to wake */ 1319 /* calculate mac80211 ampdu sw queue to wake */
1320 int freed = il4965_tx_queue_reclaim(il, scd_flow, index); 1320 int freed = il4965_tx_queue_reclaim(il, scd_flow, idx);
1321 il4965_free_tfds_in_queue(il, sta_id, tid, freed); 1321 il4965_free_tfds_in_queue(il, sta_id, tid, freed);
1322 1322
1323 if (il_queue_space(&txq->q) > txq->q.low_mark && 1323 if (il_queue_space(&txq->q) > txq->q.low_mark &&
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.c b/drivers/net/wireless/iwlegacy/iwl-4965.c
index 58bdf9302987..8fd383ea58b8 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965.c
@@ -446,12 +446,12 @@ static s32 il4965_math_div_round(s32 num, s32 denom, s32 *res)
446 * il4965_get_voltage_compensation - Power supply voltage comp for txpower 446 * il4965_get_voltage_compensation - Power supply voltage comp for txpower
447 * 447 *
448 * Determines power supply voltage compensation for txpower calculations. 448 * Determines power supply voltage compensation for txpower calculations.
449 * Returns number of 1/2-dB steps to subtract from gain table index, 449 * Returns number of 1/2-dB steps to subtract from gain table idx,
450 * to compensate for difference between power supply voltage during 450 * to compensate for difference between power supply voltage during
451 * factory measurements, vs. current power supply voltage. 451 * factory measurements, vs. current power supply voltage.
452 * 452 *
453 * Voltage indication is higher for lower voltage. 453 * Voltage indication is higher for lower voltage.
454 * Lower voltage requires more gain (lower gain table index). 454 * Lower voltage requires more gain (lower gain table idx).
455 */ 455 */
456static s32 il4965_get_voltage_compensation(s32 eeprom_voltage, 456static s32 il4965_get_voltage_compensation(s32 eeprom_voltage,
457 s32 current_voltage) 457 s32 current_voltage)
@@ -628,10 +628,10 @@ static struct il4965_txpower_comp_entry {
628 {3, 1} /* group 4 2.4, ch all */ 628 {3, 1} /* group 4 2.4, ch all */
629}; 629};
630 630
631static s32 get_min_power_index(s32 rate_power_index, u32 band) 631static s32 get_min_power_idx(s32 rate_power_idx, u32 band)
632{ 632{
633 if (!band) { 633 if (!band) {
634 if ((rate_power_index & 7) <= 4) 634 if ((rate_power_idx & 7) <= 4)
635 return MIN_TX_GAIN_IDX_52GHZ_EXT; 635 return MIN_TX_GAIN_IDX_52GHZ_EXT;
636 } 636 }
637 return MIN_TX_GAIN_IDX; 637 return MIN_TX_GAIN_IDX;
@@ -643,7 +643,7 @@ struct gain_entry {
643}; 643};
644 644
645static const struct gain_entry gain_table[2][108] = { 645static const struct gain_entry gain_table[2][108] = {
646 /* 5.2GHz power gain index table */ 646 /* 5.2GHz power gain idx table */
647 { 647 {
648 {123, 0x3F}, /* highest txpower */ 648 {123, 0x3F}, /* highest txpower */
649 {117, 0x3F}, 649 {117, 0x3F},
@@ -754,7 +754,7 @@ static const struct gain_entry gain_table[2][108] = {
754 {83, 0x00}, 754 {83, 0x00},
755 {78, 0x00}, 755 {78, 0x00},
756 }, 756 },
757 /* 2.4GHz power gain index table */ 757 /* 2.4GHz power gain idx table */
758 { 758 {
759 {110, 0x3f}, /* highest txpower */ 759 {110, 0x3f}, /* highest txpower */
760 {104, 0x3f}, 760 {104, 0x3f},
@@ -891,12 +891,12 @@ static int il4965_fill_txpower_tbl(struct il_priv *il, u8 band, u16 channel,
891 s32 degrees_per_05db_denom; 891 s32 degrees_per_05db_denom;
892 s32 factory_temp; 892 s32 factory_temp;
893 s32 temperature_comp[2]; 893 s32 temperature_comp[2];
894 s32 factory_gain_index[2]; 894 s32 factory_gain_idx[2];
895 s32 factory_actual_pwr[2]; 895 s32 factory_actual_pwr[2];
896 s32 power_index; 896 s32 power_idx;
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 idxing into txpower table) */
900 user_target_power = 2 * il->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 */
@@ -995,7 +995,7 @@ static int il4965_fill_txpower_tbl(struct il_priv *il, u8 band, u16 channel,
995 degrees_per_05db_num, 995 degrees_per_05db_num,
996 &temperature_comp[c]); 996 &temperature_comp[c]);
997 997
998 factory_gain_index[c] = measurement->gain_idx; 998 factory_gain_idx[c] = measurement->gain_idx;
999 factory_actual_pwr[c] = measurement->actual_pow; 999 factory_actual_pwr[c] = measurement->actual_pow;
1000 1000
1001 D_TXPOWER("chain = %d\n", c); 1001 D_TXPOWER("chain = %d\n", c);
@@ -1005,7 +1005,7 @@ static int il4965_fill_txpower_tbl(struct il_priv *il, u8 band, u16 channel,
1005 temperature_comp[c]); 1005 temperature_comp[c]);
1006 1006
1007 D_TXPOWER("fctry idx %d, fctry pwr %d\n", 1007 D_TXPOWER("fctry idx %d, fctry pwr %d\n",
1008 factory_gain_index[c], 1008 factory_gain_idx[c],
1009 factory_actual_pwr[c]); 1009 factory_actual_pwr[c]);
1010 } 1010 }
1011 1011
@@ -1053,50 +1053,50 @@ static int il4965_fill_txpower_tbl(struct il_priv *il, u8 band, u16 channel,
1053 else 1053 else
1054 atten_value = 0; 1054 atten_value = 0;
1055 1055
1056 /* calculate index; higher index means lower txpower */ 1056 /* calculate idx; higher idx means lower txpower */
1057 power_index = (u8) (factory_gain_index[c] - 1057 power_idx = (u8) (factory_gain_idx[c] -
1058 (target_power - 1058 (target_power -
1059 factory_actual_pwr[c]) - 1059 factory_actual_pwr[c]) -
1060 temperature_comp[c] - 1060 temperature_comp[c] -
1061 voltage_compensation + 1061 voltage_compensation +
1062 atten_value); 1062 atten_value);
1063 1063
1064/* D_TXPOWER("calculated txpower index %d\n", 1064/* D_TXPOWER("calculated txpower idx %d\n",
1065 power_index); */ 1065 power_idx); */
1066 1066
1067 if (power_index < get_min_power_index(i, band)) 1067 if (power_idx < get_min_power_idx(i, band))
1068 power_index = get_min_power_index(i, band); 1068 power_idx = get_min_power_idx(i, band);
1069 1069
1070 /* adjust 5 GHz index to support negative indexes */ 1070 /* adjust 5 GHz idx to support negative idxes */
1071 if (!band) 1071 if (!band)
1072 power_index += 9; 1072 power_idx += 9;
1073 1073
1074 /* CCK, rate 32, reduce txpower for CCK */ 1074 /* CCK, rate 32, reduce txpower for CCK */
1075 if (i == POWER_TABLE_CCK_ENTRY) 1075 if (i == POWER_TABLE_CCK_ENTRY)
1076 power_index += 1076 power_idx +=
1077 IL_TX_POWER_CCK_COMPENSATION_C_STEP; 1077 IL_TX_POWER_CCK_COMPENSATION_C_STEP;
1078 1078
1079 /* stay within the table! */ 1079 /* stay within the table! */
1080 if (power_index > 107) { 1080 if (power_idx > 107) {
1081 IL_WARN("txpower index %d > 107\n", 1081 IL_WARN("txpower idx %d > 107\n",
1082 power_index); 1082 power_idx);
1083 power_index = 107; 1083 power_idx = 107;
1084 } 1084 }
1085 if (power_index < 0) { 1085 if (power_idx < 0) {
1086 IL_WARN("txpower index %d < 0\n", 1086 IL_WARN("txpower idx %d < 0\n",
1087 power_index); 1087 power_idx);
1088 power_index = 0; 1088 power_idx = 0;
1089 } 1089 }
1090 1090
1091 /* fill txpower command for this rate/chain */ 1091 /* fill txpower command for this rate/chain */
1092 tx_power.s.radio_tx_gain[c] = 1092 tx_power.s.radio_tx_gain[c] =
1093 gain_table[band][power_index].radio; 1093 gain_table[band][power_idx].radio;
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_idx].dsp;
1096 1096
1097 D_TXPOWER("chain %d mimo %d index %d " 1097 D_TXPOWER("chain %d mimo %d idx %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_idx,
1100 tx_power.s.radio_tx_gain[c], 1100 tx_power.s.radio_tx_gain[c],
1101 tx_power.s.dsp_predis_atten[c]); 1101 tx_power.s.dsp_predis_atten[c]);
1102 } /* for each chain */ 1102 } /* for each chain */
@@ -1777,7 +1777,7 @@ static void il4965_rx_reply_tx(struct il_priv *il,
1777 struct il_rx_pkt *pkt = rxb_addr(rxb); 1777 struct il_rx_pkt *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_IDX(sequence); 1780 int idx = SEQ_TO_IDX(sequence);
1781 struct il_tx_queue *txq = &il->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;
@@ -1789,10 +1789,10 @@ static void il4965_rx_reply_tx(struct il_priv *il,
1789 u8 *qc = NULL; 1789 u8 *qc = NULL;
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 (idx >= txq->q.n_bd || il_queue_used(&txq->q, idx) == 0) {
1793 IL_ERR("Read index for DMA queue txq_id (%d) index %d " 1793 IL_ERR("Read idx for DMA queue txq_id (%d) idx %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 idx, txq->q.n_bd, txq->q.write_ptr,
1796 txq->q.read_ptr); 1796 txq->q.read_ptr);
1797 return; 1797 return;
1798 } 1798 }
@@ -1801,7 +1801,7 @@ static void il4965_rx_reply_tx(struct il_priv *il,
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(il, txq_id, index); 1804 hdr = il_tx_queue_get_hdr(il, txq_id, idx);
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;
@@ -1821,18 +1821,18 @@ static void il4965_rx_reply_tx(struct il_priv *il,
1821 1821
1822 agg = &il->stations[sta_id].tid[tid].agg; 1822 agg = &il->stations[sta_id].tid[tid].agg;
1823 1823
1824 il4965_tx_status_reply_tx(il, agg, tx_resp, txq_id, index); 1824 il4965_tx_status_reply_tx(il, agg, tx_resp, txq_id, idx);
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))
1828 info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; 1828 info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
1829 1829
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 idx = il_queue_dec_wrap(scd_ssn & 0xff,
1832 txq->q.n_bd); 1832 txq->q.n_bd);
1833 D_TX_REPLY("Retry scheduler reclaim scd_ssn " 1833 D_TX_REPLY("Retry scheduler reclaim scd_ssn "
1834 "%d index %d\n", scd_ssn , index); 1834 "%d idx %d\n", scd_ssn , idx);
1835 freed = il4965_tx_queue_reclaim(il, txq_id, index); 1835 freed = il4965_tx_queue_reclaim(il, txq_id, idx);
1836 if (qc) 1836 if (qc)
1837 il4965_free_tfds_in_queue(il, sta_id, 1837 il4965_free_tfds_in_queue(il, sta_id,
1838 tid, freed); 1838 tid, freed);
@@ -1856,7 +1856,7 @@ static void il4965_rx_reply_tx(struct il_priv *il,
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(il, txq_id, index); 1859 freed = il4965_tx_queue_reclaim(il, txq_id, idx);
1860 if (qc && likely(sta_id != IL_INVALID_STATION)) 1860 if (qc && likely(sta_id != IL_INVALID_STATION))
1861 il4965_free_tfds_in_queue(il, 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)
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.h b/drivers/net/wireless/iwlegacy/iwl-4965.h
index a75b62cd61f7..8076bbe28cff 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965.h
+++ b/drivers/net/wireless/iwlegacy/iwl-4965.h
@@ -123,7 +123,7 @@ 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);
124void il4965_rx_reply_compressed_ba(struct il_priv *il, 124void il4965_rx_reply_compressed_ba(struct il_priv *il,
125 struct il_rx_buf *rxb); 125 struct il_rx_buf *rxb);
126int il4965_tx_queue_reclaim(struct il_priv *il, int txq_id, int index); 126int il4965_tx_queue_reclaim(struct il_priv *il, int txq_id, int idx);
127void il4965_hw_txq_ctx_free(struct il_priv *il); 127void il4965_hw_txq_ctx_free(struct il_priv *il);
128int il4965_txq_ctx_alloc(struct il_priv *il); 128int il4965_txq_ctx_alloc(struct il_priv *il);
129void il4965_txq_ctx_reset(struct il_priv *il); 129void il4965_txq_ctx_reset(struct il_priv *il);
@@ -133,7 +133,7 @@ void il4965_txq_set_sched(struct il_priv *il, u32 mask);
133/* 133/*
134 * Acquire il->lock before calling this function ! 134 * Acquire il->lock before calling this function !
135 */ 135 */
136void il4965_set_wr_ptrs(struct il_priv *il, int txq_id, u32 index); 136void il4965_set_wr_ptrs(struct il_priv *il, int txq_id, u32 idx);
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
diff --git a/drivers/net/wireless/iwlegacy/iwl-commands.h b/drivers/net/wireless/iwlegacy/iwl-commands.h
index 002f1d7f475b..408391295fbd 100644
--- a/drivers/net/wireless/iwlegacy/iwl-commands.h
+++ b/drivers/net/wireless/iwlegacy/iwl-commands.h
@@ -197,7 +197,7 @@ struct il_cmd_header {
197 * 197 *
198 * The Linux driver uses the following format: 198 * The Linux driver uses the following format:
199 * 199 *
200 * 0:7 tfd index - position within TX queue 200 * 0:7 tfd idx - position within TX queue
201 * 8:12 TX queue id 201 * 8:12 TX queue id
202 * 13 reserved 202 * 13 reserved
203 * 14 huge - driver sets this to indicate command is in the 203 * 14 huge - driver sets this to indicate command is in the
@@ -454,7 +454,7 @@ struct il_init_alive_resp {
454 * __le32 log_size; log capacity (in number of entries) 454 * __le32 log_size; log capacity (in number of entries)
455 * __le32 type; (1) timestamp with each entry, (0) no timestamp 455 * __le32 type; (1) timestamp with each entry, (0) no timestamp
456 * __le32 wraps; # times uCode has wrapped to top of circular buffer 456 * __le32 wraps; # times uCode has wrapped to top of circular buffer
457 * __le32 write_index; next circular buffer entry that uCode would fill 457 * __le32 write_idx; next circular buffer entry that uCode would fill
458 * 458 *
459 * The header is followed by the circular buffer of log entries. Entries 459 * The header is followed by the circular buffer of log entries. Entries
460 * with timestamps have the following format: 460 * with timestamps have the following format:
@@ -901,7 +901,7 @@ struct il_qosparam_cmd {
901#define STA_MODIFY_DELBA_TID_MSK 0x10 901#define STA_MODIFY_DELBA_TID_MSK 0x10
902#define STA_MODIFY_SLEEP_TX_COUNT_MSK 0x20 902#define STA_MODIFY_SLEEP_TX_COUNT_MSK 0x20
903 903
904/* Receiver address (actually, Rx station's index into station table), 904/* Receiver address (actually, Rx station's idx into station table),
905 * combined with Traffic ID (QOS priority), in format used by Tx Scheduler */ 905 * combined with Traffic ID (QOS priority), in format used by Tx Scheduler */
906#define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid)) 906#define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid))
907 907
@@ -918,12 +918,12 @@ struct il4965_keyinfo {
918/** 918/**
919 * struct sta_id_modify 919 * struct sta_id_modify
920 * @addr[ETH_ALEN]: station's MAC address 920 * @addr[ETH_ALEN]: station's MAC address
921 * @sta_id: index of station in uCode's station table 921 * @sta_id: idx of station in uCode's station table
922 * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change 922 * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change
923 * 923 *
924 * Driver selects unused table index when adding new station, 924 * Driver selects unused table idx when adding new station,
925 * or the index to a pre-existing station entry when modifying that station. 925 * or the idx to a pre-existing station entry when modifying that station.
926 * Some indexes have special purposes (IL_AP_ID, index 0, is for AP). 926 * Some idxes have special purposes (IL_AP_ID, idx 0, is for AP).
927 * 927 *
928 * modify_mask flags select which parameters to modify vs. leave alone. 928 * modify_mask flags select which parameters to modify vs. leave alone.
929 */ 929 */
@@ -959,7 +959,7 @@ struct sta_id_modify {
959 * in the IL_AP_ID entry (1st entry in the table). BROADCAST and AP 959 * in the IL_AP_ID entry (1st entry in the table). BROADCAST and AP
960 * are all that are needed for a BSS client station. If the device is 960 * are all that are needed for a BSS client station. If the device is
961 * used as AP, or in an IBSS network, driver must set up station table 961 * used as AP, or in an IBSS network, driver must set up station table
962 * entries for all STAs in network, starting with index IL_STA_ID. 962 * entries for all STAs in network, starting with idx IL_STA_ID.
963 */ 963 */
964 964
965struct il3945_addsta_cmd { 965struct il3945_addsta_cmd {
@@ -1109,7 +1109,7 @@ struct il_rem_sta_cmd {
1109 * REPLY_WEP_KEY = 0x20 1109 * REPLY_WEP_KEY = 0x20
1110 */ 1110 */
1111struct il_wep_key { 1111struct il_wep_key {
1112 u8 key_index; 1112 u8 key_idx;
1113 u8 key_offset; 1113 u8 key_offset;
1114 u8 reserved1[2]; 1114 u8 reserved1[2];
1115 u8 key_size; 1115 u8 key_size;
@@ -1297,7 +1297,7 @@ struct il_rx_mpdu_res_start {
1297 1297
1298/* For 4965 devices: 1298/* For 4965 devices:
1299 * 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD). 1299 * 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD).
1300 * Tx command's initial_rate_index indicates first rate to try; 1300 * Tx command's initial_rate_idx indicates first rate to try;
1301 * uCode walks through table for additional Tx attempts. 1301 * uCode walks through table for additional Tx attempts.
1302 * 0: Use Tx rate/MCS from Tx command's rate_n_flags field. 1302 * 0: Use Tx rate/MCS from Tx command's rate_n_flags field.
1303 * This rate will be used for all Tx attempts; it will not be scaled. */ 1303 * This rate will be used for all Tx attempts; it will not be scaled. */
@@ -1499,7 +1499,7 @@ struct il_tx_cmd {
1499 * rate (via non-0 value) for special frames (e.g. management), while 1499 * rate (via non-0 value) for special frames (e.g. management), while
1500 * still supporting rate scaling for all frames. 1500 * still supporting rate scaling for all frames.
1501 */ 1501 */
1502 u8 initial_rate_index; 1502 u8 initial_rate_idx;
1503 u8 reserved; 1503 u8 reserved;
1504 u8 key[16]; 1504 u8 key[16];
1505 __le16 next_frame_flags; 1505 __le16 next_frame_flags;
@@ -1792,7 +1792,7 @@ struct il4965_txpowertable_cmd {
1792struct il3945_rate_scaling_info { 1792struct il3945_rate_scaling_info {
1793 __le16 rate_n_flags; 1793 __le16 rate_n_flags;
1794 u8 try_cnt; 1794 u8 try_cnt;
1795 u8 next_rate_index; 1795 u8 next_rate_idx;
1796} __packed; 1796} __packed;
1797 1797
1798struct il3945_rate_scaling_cmd { 1798struct il3945_rate_scaling_cmd {
@@ -1825,7 +1825,7 @@ struct il3945_rate_scaling_cmd {
1825struct il_link_qual_general_params { 1825struct il_link_qual_general_params {
1826 u8 flags; 1826 u8 flags;
1827 1827
1828 /* No entries at or above this (driver chosen) index contain MIMO */ 1828 /* No entries at or above this (driver chosen) idx contain MIMO */
1829 u8 mimo_delimiter; 1829 u8 mimo_delimiter;
1830 1830
1831 /* Best single antenna to use for single stream (legacy, SISO). */ 1831 /* Best single antenna to use for single stream (legacy, SISO). */
@@ -1837,7 +1837,7 @@ struct il_link_qual_general_params {
1837 /* 1837 /*
1838 * If driver needs to use different initial rates for different 1838 * If driver needs to use different initial rates for different
1839 * EDCA QOS access categories (as implemented by tx fifos 0-3), 1839 * EDCA QOS access categories (as implemented by tx fifos 0-3),
1840 * this table will set that up, by indicating the indexes in the 1840 * this table will set that up, by indicating the idxes in the
1841 * rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table at which to start. 1841 * rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table at which to start.
1842 * Otherwise, driver should set all entries to 0. 1842 * Otherwise, driver should set all entries to 0.
1843 * 1843 *
@@ -1845,7 +1845,7 @@ struct il_link_qual_general_params {
1845 * 0 = Background, 1 = Best Effort (normal), 2 = Video, 3 = Voice 1845 * 0 = Background, 1 = Best Effort (normal), 2 = Video, 3 = Voice
1846 * TX FIFOs above 3 use same value (typically 0) as TX FIFO 3. 1846 * TX FIFOs above 3 use same value (typically 0) as TX FIFO 3.
1847 */ 1847 */
1848 u8 start_rate_index[LINK_QUAL_AC_NUM]; 1848 u8 start_rate_idx[LINK_QUAL_AC_NUM];
1849} __packed; 1849} __packed;
1850 1850
1851#define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */ 1851#define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */
@@ -2089,8 +2089,8 @@ struct il_link_quality_cmd {
2089 struct il_link_qual_agg_params agg_params; 2089 struct il_link_qual_agg_params agg_params;
2090 2090
2091 /* 2091 /*
2092 * Rate info; when using rate-scaling, Tx command's initial_rate_index 2092 * Rate info; when using rate-scaling, Tx command's initial_rate_idx
2093 * specifies 1st Tx rate attempted, via index into this table. 2093 * specifies 1st Tx rate attempted, via idx into this table.
2094 * 4965 devices works its way through table when retrying Tx. 2094 * 4965 devices works its way through table when retrying Tx.
2095 */ 2095 */
2096 struct { 2096 struct {
@@ -2233,7 +2233,7 @@ enum il_measure_type {
2233struct il_spectrum_notification { 2233struct il_spectrum_notification {
2234 u8 id; /* measurement id -- 0 or 1 */ 2234 u8 id; /* measurement id -- 0 or 1 */
2235 u8 token; 2235 u8 token;
2236 u8 channel_index; /* index in measurement channel list */ 2236 u8 channel_idx; /* idx in measurement channel list */
2237 u8 state; /* 0 - start, 1 - stop */ 2237 u8 state; /* 0 - start, 1 - stop */
2238 __le32 start_time; /* lower 32-bits of TSF */ 2238 __le32 start_time; /* lower 32-bits of TSF */
2239 u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */ 2239 u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */
@@ -3220,7 +3220,7 @@ struct il_missed_beacon_notif {
3220 * Table entries in SENSITIVITY_CMD (struct il_sensitivity_cmd) 3220 * Table entries in SENSITIVITY_CMD (struct il_sensitivity_cmd)
3221 */ 3221 */
3222#define HD_TABLE_SIZE (11) /* number of entries */ 3222#define HD_TABLE_SIZE (11) /* number of entries */
3223#define HD_MIN_ENERGY_CCK_DET_IDX (0) /* table indexes */ 3223#define HD_MIN_ENERGY_CCK_DET_IDX (0) /* table idxes */
3224#define HD_MIN_ENERGY_OFDM_DET_IDX (1) 3224#define HD_MIN_ENERGY_OFDM_DET_IDX (1)
3225#define HD_AUTO_CORR32_X1_TH_ADD_MIN_IDX (2) 3225#define HD_AUTO_CORR32_X1_TH_ADD_MIN_IDX (2)
3226#define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_IDX (3) 3226#define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_IDX (3)
@@ -3239,13 +3239,13 @@ struct il_missed_beacon_notif {
3239/** 3239/**
3240 * struct il_sensitivity_cmd 3240 * struct il_sensitivity_cmd
3241 * @control: (1) updates working table, (0) updates default table 3241 * @control: (1) updates working table, (0) updates default table
3242 * @table: energy threshold values, use HD_* as index into table 3242 * @table: energy threshold values, use HD_* as idx into table
3243 * 3243 *
3244 * Always use "1" in "control" to update uCode's working table and DSP. 3244 * Always use "1" in "control" to update uCode's working table and DSP.
3245 */ 3245 */
3246struct il_sensitivity_cmd { 3246struct il_sensitivity_cmd {
3247 __le16 control; /* always use "1" */ 3247 __le16 control; /* always use "1" */
3248 __le16 table[HD_TABLE_SIZE]; /* use HD_* as index */ 3248 __le16 table[HD_TABLE_SIZE]; /* use HD_* as idx */
3249} __packed; 3249} __packed;
3250 3250
3251 3251
diff --git a/drivers/net/wireless/iwlegacy/iwl-csr.h b/drivers/net/wireless/iwlegacy/iwl-csr.h
index c00ec353f556..34edec329367 100644
--- a/drivers/net/wireless/iwlegacy/iwl-csr.h
+++ b/drivers/net/wireless/iwlegacy/iwl-csr.h
@@ -411,10 +411,10 @@
411#define HBUS_TARG_PRPH_RDAT (HBUS_BASE+0x050) 411#define HBUS_TARG_PRPH_RDAT (HBUS_BASE+0x050)
412 412
413/* 413/*
414 * Per-Tx-queue write pointer (index, really!) 414 * Per-Tx-queue write pointer (idx, really!)
415 * Indicates index to next TFD that driver will fill (1 past latest filled). 415 * Indicates idx to next TFD that driver will fill (1 past latest filled).
416 * Bit usage: 416 * Bit usage:
417 * 0-7: queue write index 417 * 0-7: queue write idx
418 * 11-8: queue selector 418 * 11-8: queue selector
419 */ 419 */
420#define HBUS_TARG_WRPTR (HBUS_BASE+0x060) 420#define HBUS_TARG_WRPTR (HBUS_BASE+0x060)
diff --git a/drivers/net/wireless/iwlegacy/iwl-dev.h b/drivers/net/wireless/iwlegacy/iwl-dev.h
index 18dd253b43f7..2555f9fe9be2 100644
--- a/drivers/net/wireless/iwlegacy/iwl-dev.h
+++ b/drivers/net/wireless/iwlegacy/iwl-dev.h
@@ -125,8 +125,8 @@ struct il_cmd_meta {
125 */ 125 */
126struct il_queue { 126struct il_queue {
127 int n_bd; /* number of BDs in this queue */ 127 int n_bd; /* number of BDs in this queue */
128 int write_ptr; /* 1-st empty entry (index) host_w*/ 128 int write_ptr; /* 1-st empty entry (idx) host_w*/
129 int read_ptr; /* last used entry (index) host_r*/ 129 int read_ptr; /* last used entry (idx) host_r*/
130 /* use for monitoring and recovering the stuck queue */ 130 /* use for monitoring and recovering the stuck queue */
131 dma_addr_t dma_addr; /* physical addr for BD's */ 131 dma_addr_t dma_addr; /* physical addr for BD's */
132 int n_win; /* safe queue win */ 132 int n_win; /* safe queue win */
@@ -152,7 +152,7 @@ struct il_tx_info {
152 * @dma_addr_cmd: physical address of cmd/tx buffer array 152 * @dma_addr_cmd: physical address of cmd/tx buffer array
153 * @txb: array of per-TFD driver data 153 * @txb: array of per-TFD driver data
154 * @time_stamp: time (in jiffies) of last read_ptr change 154 * @time_stamp: time (in jiffies) of last read_ptr change
155 * @need_update: indicates need to update read/write index 155 * @need_update: indicates need to update read/write idx
156 * @sched_retry: indicates queue is high-throughput aggregation (HT AGG) enabled 156 * @sched_retry: indicates queue is high-throughput aggregation (HT AGG) enabled
157 * 157 *
158 * A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame 158 * A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame
@@ -199,11 +199,11 @@ struct il3945_clip_group {
199 * -- hardware capabilities (clip-powers) 199 * -- hardware capabilities (clip-powers)
200 * -- spectrum management 200 * -- spectrum management
201 * -- user preference (e.g. iwconfig) 201 * -- user preference (e.g. iwconfig)
202 * when requested power is set, base power index must also be set. */ 202 * when requested power is set, base power idx must also be set. */
203struct il3945_channel_power_info { 203struct il3945_channel_power_info {
204 struct il3945_tx_power tpc; /* actual radio and DSP gain settings */ 204 struct il3945_tx_power tpc; /* actual radio and DSP gain settings */
205 s8 power_table_index; /* actual (compenst'd) index into gain table */ 205 s8 power_table_idx; /* actual (compenst'd) idx into gain table */
206 s8 base_power_index; /* gain index for power at factory temp. */ 206 s8 base_power_idx; /* gain idx for power at factory temp. */
207 s8 requested_power; /* power (dBm) requested for this chnl/rate */ 207 s8 requested_power; /* power (dBm) requested for this chnl/rate */
208}; 208};
209 209
@@ -211,7 +211,7 @@ struct il3945_channel_power_info {
211 * channel. */ 211 * channel. */
212struct il3945_scan_power_info { 212struct il3945_scan_power_info {
213 struct il3945_tx_power tpc; /* actual radio and DSP gain settings */ 213 struct il3945_tx_power tpc; /* actual radio and DSP gain settings */
214 s8 power_table_index; /* actual (compenst'd) index into gain table */ 214 s8 power_table_idx; /* actual (compenst'd) idx into gain table */
215 s8 requested_power; /* scan pwr (dBm) requested for chnl/rate */ 215 s8 requested_power; /* scan pwr (dBm) requested for chnl/rate */
216}; 216};
217 217
@@ -234,8 +234,8 @@ struct il_channel_info {
234 s8 min_power; /* always 0 */ 234 s8 min_power; /* always 0 */
235 s8 scan_power; /* (dBm) regul. eeprom, direct scans, any rate */ 235 s8 scan_power; /* (dBm) regul. eeprom, direct scans, any rate */
236 236
237 u8 group_index; /* 0-4, maps channel to group1/2/3/4/5 */ 237 u8 group_idx; /* 0-4, maps channel to group1/2/3/4/5 */
238 u8 band_index; /* 0-4, maps channel to band1/2/3/4/5 */ 238 u8 band_idx; /* 0-4, maps channel to band1/2/3/4/5 */
239 enum ieee80211_band band; 239 enum ieee80211_band band;
240 240
241 /* HT40 channel info */ 241 /* HT40 channel info */
@@ -245,7 +245,7 @@ struct il_channel_info {
245 245
246 /* Radio/DSP gain settings for each "normal" data Tx rate. 246 /* Radio/DSP gain settings for each "normal" data Tx rate.
247 * These include, in addition to RF and DSP gain, a few fields for 247 * These include, in addition to RF and DSP gain, a few fields for
248 * remembering/modifying gain settings (indexes). */ 248 * remembering/modifying gain settings (idxes). */
249 struct il3945_channel_power_info power_info[IL4965_MAX_RATE]; 249 struct il3945_channel_power_info power_info[IL4965_MAX_RATE];
250 250
251 /* Radio/DSP gain settings for each scan rate, for directed scans. */ 251 /* Radio/DSP gain settings for each scan rate, for directed scans. */
@@ -337,12 +337,12 @@ struct il_host_cmd {
337 * struct il_rx_queue - Rx queue 337 * struct il_rx_queue - Rx queue
338 * @bd: driver's pointer to buffer of receive buffer descriptors (rbd) 338 * @bd: driver's pointer to buffer of receive buffer descriptors (rbd)
339 * @bd_dma: bus address of buffer of receive buffer descriptors (rbd) 339 * @bd_dma: bus address of buffer of receive buffer descriptors (rbd)
340 * @read: Shared index to newest available Rx buffer 340 * @read: Shared idx to newest available Rx buffer
341 * @write: Shared index to oldest written Rx packet 341 * @write: Shared idx to oldest written Rx packet
342 * @free_count: Number of pre-allocated buffers in rx_free 342 * @free_count: Number of pre-allocated buffers in rx_free
343 * @rx_free: list of free SKBs for use 343 * @rx_free: list of free SKBs for use
344 * @rx_used: List of Rx buffers with no SKB 344 * @rx_used: List of Rx buffers with no SKB
345 * @need_update: flag to indicate we need to update read/write index 345 * @need_update: flag to indicate we need to update read/write idx
346 * @rb_stts: driver's pointer to receive buffer status 346 * @rb_stts: driver's pointer to receive buffer status
347 * @rb_stts_dma: bus address of receive buffer status 347 * @rb_stts_dma: bus address of receive buffer status
348 * 348 *
@@ -636,7 +636,7 @@ static inline int il_queue_used(const struct il_queue *q, int i)
636} 636}
637 637
638 638
639static inline u8 il_get_cmd_index(struct il_queue *q, u32 index, 639static inline u8 il_get_cmd_idx(struct il_queue *q, u32 idx,
640 int is_huge) 640 int is_huge)
641{ 641{
642 /* 642 /*
@@ -648,7 +648,7 @@ static inline u8 il_get_cmd_index(struct il_queue *q, u32 index,
648 return q->n_win; /* must be power of 2 */ 648 return q->n_win; /* must be power of 2 */
649 649
650 /* Otherwise, use normal size buffers */ 650 /* Otherwise, use normal size buffers */
651 return index & (q->n_win - 1); 651 return idx & (q->n_win - 1);
652} 652}
653 653
654 654
@@ -987,7 +987,7 @@ struct il_priv {
987 struct il_force_reset force_reset; 987 struct il_force_reset force_reset;
988 988
989 /* we allocate array of il_channel_info for NIC's valid channels. 989 /* we allocate array of il_channel_info for NIC's valid channels.
990 * Access via channel # using indirect index array */ 990 * Access via channel # using indirect idx array */
991 struct il_channel_info *channel_info; /* channel info array */ 991 struct il_channel_info *channel_info; /* channel info array */
992 u8 channel_count; /* # of channels */ 992 u8 channel_count; /* # of channels */
993 993
@@ -1033,7 +1033,7 @@ struct il_priv {
1033 struct mac_address addresses[1]; 1033 struct mac_address addresses[1];
1034 1034
1035 /* uCode images, save to reload in case of failure */ 1035 /* uCode images, save to reload in case of failure */
1036 int fw_index; /* firmware we're trying to load */ 1036 int fw_idx; /* firmware we're trying to load */
1037 u32 ucode_ver; /* version of ucode, copy of 1037 u32 ucode_ver; /* version of ucode, copy of
1038 il_ucode.ver */ 1038 il_ucode.ver */
1039 struct fw_desc ucode_code; /* runtime inst */ 1039 struct fw_desc ucode_code; /* runtime inst */
diff --git a/drivers/net/wireless/iwlegacy/iwl-eeprom.c b/drivers/net/wireless/iwlegacy/iwl-eeprom.c
index 5786abd7c0bb..ee5ad69a534b 100644
--- a/drivers/net/wireless/iwlegacy/iwl-eeprom.c
+++ b/drivers/net/wireless/iwlegacy/iwl-eeprom.c
@@ -89,7 +89,7 @@
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 il->channel_info_24/52 and il->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 idx 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
94 * overlap with the 2.4GHz and 5.2GHz spectrum as seen in band_1 and 94 * overlap with the 2.4GHz and 5.2GHz spectrum as seen in band_1 and
95 * band_2 95 * band_2
@@ -267,7 +267,7 @@ EXPORT_SYMBOL(il_eeprom_free);
267static void il_init_band_reference(const struct il_priv *il, 267static 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_idx)
271{ 271{
272 u32 offset = il->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];
@@ -276,43 +276,43 @@ static void il_init_band_reference(const struct il_priv *il,
276 *eeprom_ch_count = ARRAY_SIZE(il_eeprom_band_1); 276 *eeprom_ch_count = ARRAY_SIZE(il_eeprom_band_1);
277 *eeprom_ch_info = (struct il_eeprom_channel *) 277 *eeprom_ch_info = (struct il_eeprom_channel *)
278 il_eeprom_query_addr(il, offset); 278 il_eeprom_query_addr(il, offset);
279 *eeprom_ch_index = il_eeprom_band_1; 279 *eeprom_ch_idx = il_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(il_eeprom_band_2); 282 *eeprom_ch_count = ARRAY_SIZE(il_eeprom_band_2);
283 *eeprom_ch_info = (struct il_eeprom_channel *) 283 *eeprom_ch_info = (struct il_eeprom_channel *)
284 il_eeprom_query_addr(il, offset); 284 il_eeprom_query_addr(il, offset);
285 *eeprom_ch_index = il_eeprom_band_2; 285 *eeprom_ch_idx = il_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(il_eeprom_band_3); 288 *eeprom_ch_count = ARRAY_SIZE(il_eeprom_band_3);
289 *eeprom_ch_info = (struct il_eeprom_channel *) 289 *eeprom_ch_info = (struct il_eeprom_channel *)
290 il_eeprom_query_addr(il, offset); 290 il_eeprom_query_addr(il, offset);
291 *eeprom_ch_index = il_eeprom_band_3; 291 *eeprom_ch_idx = il_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(il_eeprom_band_4); 294 *eeprom_ch_count = ARRAY_SIZE(il_eeprom_band_4);
295 *eeprom_ch_info = (struct il_eeprom_channel *) 295 *eeprom_ch_info = (struct il_eeprom_channel *)
296 il_eeprom_query_addr(il, offset); 296 il_eeprom_query_addr(il, offset);
297 *eeprom_ch_index = il_eeprom_band_4; 297 *eeprom_ch_idx = il_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(il_eeprom_band_5); 300 *eeprom_ch_count = ARRAY_SIZE(il_eeprom_band_5);
301 *eeprom_ch_info = (struct il_eeprom_channel *) 301 *eeprom_ch_info = (struct il_eeprom_channel *)
302 il_eeprom_query_addr(il, offset); 302 il_eeprom_query_addr(il, offset);
303 *eeprom_ch_index = il_eeprom_band_5; 303 *eeprom_ch_idx = il_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(il_eeprom_band_6); 306 *eeprom_ch_count = ARRAY_SIZE(il_eeprom_band_6);
307 *eeprom_ch_info = (struct il_eeprom_channel *) 307 *eeprom_ch_info = (struct il_eeprom_channel *)
308 il_eeprom_query_addr(il, offset); 308 il_eeprom_query_addr(il, offset);
309 *eeprom_ch_index = il_eeprom_band_6; 309 *eeprom_ch_idx = il_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(il_eeprom_band_7); 312 *eeprom_ch_count = ARRAY_SIZE(il_eeprom_band_7);
313 *eeprom_ch_info = (struct il_eeprom_channel *) 313 *eeprom_ch_info = (struct il_eeprom_channel *)
314 il_eeprom_query_addr(il, offset); 314 il_eeprom_query_addr(il, offset);
315 *eeprom_ch_index = il_eeprom_band_7; 315 *eeprom_ch_idx = il_eeprom_band_7;
316 break; 316 break;
317 default: 317 default:
318 BUG(); 318 BUG();
@@ -374,7 +374,7 @@ static int il_mod_ht40_chan_info(struct il_priv *il,
374int il_init_channel_map(struct il_priv *il) 374int 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_idx = NULL;
378 const struct il_eeprom_channel *eeprom_ch_info = NULL; 378 const struct il_eeprom_channel *eeprom_ch_info = NULL;
379 int band, ch; 379 int band, ch;
380 struct il_channel_info *ch_info; 380 struct il_channel_info *ch_info;
@@ -412,11 +412,11 @@ int il_init_channel_map(struct il_priv *il)
412 for (band = 1; band <= 5; band++) { 412 for (band = 1; band <= 5; band++) {
413 413
414 il_init_band_reference(il, 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_idx);
416 416
417 /* Loop through each band adding each of the channels */ 417 /* Loop through each band adding each of the channels */
418 for (ch = 0; ch < eeprom_ch_count; ch++) { 418 for (ch = 0; ch < eeprom_ch_count; ch++) {
419 ch_info->channel = eeprom_ch_index[ch]; 419 ch_info->channel = eeprom_ch_idx[ch];
420 ch_info->band = (band == 1) ? IEEE80211_BAND_2GHZ : 420 ch_info->band = (band == 1) ? IEEE80211_BAND_2GHZ :
421 IEEE80211_BAND_5GHZ; 421 IEEE80211_BAND_5GHZ;
422 422
@@ -486,7 +486,7 @@ int il_init_channel_map(struct il_priv *il)
486 enum ieee80211_band ieeeband; 486 enum ieee80211_band ieeeband;
487 487
488 il_init_band_reference(il, 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_idx);
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 */
492 ieeeband = 492 ieeeband =
@@ -496,13 +496,13 @@ int il_init_channel_map(struct il_priv *il)
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(il, ieeeband, 498 il_mod_ht40_chan_info(il, ieeeband,
499 eeprom_ch_index[ch], 499 eeprom_ch_idx[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(il, ieeeband, 504 il_mod_ht40_chan_info(il, ieeeband,
505 eeprom_ch_index[ch] + 4, 505 eeprom_ch_idx[ch] + 4,
506 &eeprom_ch_info[ch], 506 &eeprom_ch_info[ch],
507 IEEE80211_CHAN_NO_HT40MINUS); 507 IEEE80211_CHAN_NO_HT40MINUS);
508 } 508 }
diff --git a/drivers/net/wireless/iwlegacy/iwl-eeprom.h b/drivers/net/wireless/iwlegacy/iwl-eeprom.h
index b97c83735c76..eb868c0e6559 100644
--- a/drivers/net/wireless/iwlegacy/iwl-eeprom.h
+++ b/drivers/net/wireless/iwlegacy/iwl-eeprom.h
@@ -153,7 +153,7 @@ extern const u8 il_eeprom_band_1[14];
153 * 153 *
154 * 1) Temperature (degrees Celsius) of device when measurement was made. 154 * 1) Temperature (degrees Celsius) of device when measurement was made.
155 * 155 *
156 * 2) Gain table index used to achieve the target measurement power. 156 * 2) Gain table idx used to achieve the target measurement power.
157 * This refers to the "well-known" gain tables (see iwl-4965-hw.h). 157 * This refers to the "well-known" gain tables (see iwl-4965-hw.h).
158 * 158 *
159 * 3) Actual measured output power, in half-dBm ("34" = 17 dBm). 159 * 3) Actual measured output power, in half-dBm ("34" = 17 dBm).
diff --git a/drivers/net/wireless/iwlegacy/iwl-fh.h b/drivers/net/wireless/iwlegacy/iwl-fh.h
index e993e3ea5b33..f53f1b87d8e9 100644
--- a/drivers/net/wireless/iwlegacy/iwl-fh.h
+++ b/drivers/net/wireless/iwlegacy/iwl-fh.h
@@ -141,7 +141,7 @@
141 * into FH_RSCSR_CHNL0_RBDCB_BASE_REG [27:0]. 141 * into FH_RSCSR_CHNL0_RBDCB_BASE_REG [27:0].
142 * 142 *
143 * 2) Rx status buffer, 8 bytes, in which 4965 indicates which Rx Buffers 143 * 2) Rx status buffer, 8 bytes, in which 4965 indicates which Rx Buffers
144 * (RBs) have been filled, via a "write pointer", actually the index of 144 * (RBs) have been filled, via a "write pointer", actually the idx of
145 * the RB's corresponding RBD within the circular buffer. Driver sets 145 * the RB's corresponding RBD within the circular buffer. Driver sets
146 * physical address [35:4] into FH_RSCSR_CHNL0_STTS_WPTR_REG [31:0]. 146 * physical address [35:4] into FH_RSCSR_CHNL0_STTS_WPTR_REG [31:0].
147 * 147 *
@@ -153,33 +153,33 @@
153 * 153 *
154 * As the driver prepares Receive Buffers (RBs) for 4965 to fill, driver must 154 * As the driver prepares Receive Buffers (RBs) for 4965 to fill, driver must
155 * enter pointers to these RBs into contiguous RBD circular buffer entries, 155 * enter pointers to these RBs into contiguous RBD circular buffer entries,
156 * and update the 4965's "write" index register, 156 * and update the 4965's "write" idx register,
157 * FH_RSCSR_CHNL0_RBDCB_WPTR_REG. 157 * FH_RSCSR_CHNL0_RBDCB_WPTR_REG.
158 * 158 *
159 * This "write" index corresponds to the *next* RBD that the driver will make 159 * This "write" idx corresponds to the *next* RBD that the driver will make
160 * available, i.e. one RBD past the tail of the ready-to-fill RBDs within 160 * available, i.e. one RBD past the tail of the ready-to-fill RBDs within
161 * the circular buffer. This value should initially be 0 (before preparing any 161 * the circular buffer. This value should initially be 0 (before preparing any
162 * RBs), should be 8 after preparing the first 8 RBs (for example), and must 162 * RBs), should be 8 after preparing the first 8 RBs (for example), and must
163 * wrap back to 0 at the end of the circular buffer (but don't wrap before 163 * wrap back to 0 at the end of the circular buffer (but don't wrap before
164 * "read" index has advanced past 1! See below). 164 * "read" idx has advanced past 1! See below).
165 * NOTE: 4965 EXPECTS THE WRITE IDX TO BE INCREMENTED IN MULTIPLES OF 8. 165 * NOTE: 4965 EXPECTS THE WRITE IDX TO BE INCREMENTED IN MULTIPLES OF 8.
166 * 166 *
167 * As the 4965 fills RBs (referenced from contiguous RBDs within the circular 167 * As the 4965 fills RBs (referenced from contiguous RBDs within the circular
168 * buffer), it updates the Rx status buffer in host DRAM, 2) described above, 168 * buffer), it updates the Rx status buffer in host DRAM, 2) described above,
169 * to tell the driver the index of the latest filled RBD. The driver must 169 * to tell the driver the idx of the latest filled RBD. The driver must
170 * read this "read" index from DRAM after receiving an Rx interrupt from 4965. 170 * read this "read" idx from DRAM after receiving an Rx interrupt from 4965.
171 * 171 *
172 * The driver must also internally keep track of a third index, which is the 172 * The driver must also internally keep track of a third idx, which is the
173 * next RBD to process. When receiving an Rx interrupt, driver should process 173 * next RBD to process. When receiving an Rx interrupt, driver should process
174 * all filled but unprocessed RBs up to, but not including, the RB 174 * all filled but unprocessed RBs up to, but not including, the RB
175 * corresponding to the "read" index. For example, if "read" index becomes "1", 175 * corresponding to the "read" idx. For example, if "read" idx becomes "1",
176 * driver may process the RB pointed to by RBD 0. Depending on volume of 176 * driver may process the RB pointed to by RBD 0. Depending on volume of
177 * traffic, there may be many RBs to process. 177 * traffic, there may be many RBs to process.
178 * 178 *
179 * If read index == write index, 4965 thinks there is no room to put new data. 179 * If read idx == write idx, 4965 thinks there is no room to put new data.
180 * Due to this, the maximum number of filled RBs is 255, instead of 256. To 180 * Due to this, the maximum number of filled RBs is 255, instead of 256. To
181 * be safe, make sure that there is a gap of at least 2 RBDs between "write" 181 * be safe, make sure that there is a gap of at least 2 RBDs between "write"
182 * and "read" indexes; that is, make sure that there are no more than 254 182 * and "read" idxes; that is, make sure that there are no more than 254
183 * buffers waiting to be filled. 183 * buffers waiting to be filled.
184 */ 184 */
185#define FH_MEM_RSCSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xBC0) 185#define FH_MEM_RSCSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xBC0)
@@ -201,7 +201,7 @@
201#define FH_RSCSR_CHNL0_RBDCB_BASE_REG (FH_MEM_RSCSR_CHNL0 + 0x004) 201#define FH_RSCSR_CHNL0_RBDCB_BASE_REG (FH_MEM_RSCSR_CHNL0 + 0x004)
202 202
203/** 203/**
204 * Rx write pointer (index, really!). 204 * Rx write pointer (idx, really!).
205 * Bit fields: 205 * Bit fields:
206 * 11-0: Index of driver's most recent prepared-to-be-filled RBD, + 1. 206 * 11-0: Index of driver's most recent prepared-to-be-filled RBD, + 1.
207 * NOTE: For 256-entry circular buffer, use only bits [7:0]. 207 * NOTE: For 256-entry circular buffer, use only bits [7:0].
@@ -431,11 +431,11 @@
431/** 431/**
432 * struct il_rb_status - reseve buffer status 432 * struct il_rb_status - reseve buffer status
433 * host memory mapped FH registers 433 * host memory mapped FH registers
434 * @closed_rb_num [0:11] - Indicates the index of the RB which was closed 434 * @closed_rb_num [0:11] - Indicates the idx of the RB which was closed
435 * @closed_fr_num [0:11] - Indicates the index of the RX Frame which was closed 435 * @closed_fr_num [0:11] - Indicates the idx of the RX Frame which was closed
436 * @finished_rb_num [0:11] - Indicates the index of the current RB 436 * @finished_rb_num [0:11] - Indicates the idx of the current RB
437 * in which the last frame was written to 437 * in which the last frame was written to
438 * @finished_fr_num [0:11] - Indicates the index of the RX Frame 438 * @finished_fr_num [0:11] - Indicates the idx of the RX Frame
439 * which was transferred 439 * which was transferred
440 */ 440 */
441struct il_rb_status { 441struct il_rb_status {
diff --git a/drivers/net/wireless/iwlegacy/iwl-helpers.h b/drivers/net/wireless/iwlegacy/iwl-helpers.h
index a9d87023e69f..5fcb23e8f5a6 100644
--- a/drivers/net/wireless/iwlegacy/iwl-helpers.h
+++ b/drivers/net/wireless/iwlegacy/iwl-helpers.h
@@ -45,23 +45,23 @@ static inline struct ieee80211_conf *il_ieee80211_get_hw_conf(
45} 45}
46 46
47/** 47/**
48 * il_queue_inc_wrap - increment queue index, wrap back to beginning 48 * il_queue_inc_wrap - increment queue idx, wrap back to beginning
49 * @index -- current index 49 * @idx -- current idx
50 * @n_bd -- total number of entries in queue (must be power of 2) 50 * @n_bd -- total number of entries in queue (must be power of 2)
51 */ 51 */
52static inline int il_queue_inc_wrap(int index, int n_bd) 52static inline int il_queue_inc_wrap(int idx, int n_bd)
53{ 53{
54 return ++index & (n_bd - 1); 54 return ++idx & (n_bd - 1);
55} 55}
56 56
57/** 57/**
58 * il_queue_dec_wrap - decrement queue index, wrap back to end 58 * il_queue_dec_wrap - decrement queue idx, wrap back to end
59 * @index -- current index 59 * @idx -- current idx
60 * @n_bd -- total number of entries in queue (must be power of 2) 60 * @n_bd -- total number of entries in queue (must be power of 2)
61 */ 61 */
62static inline int il_queue_dec_wrap(int index, int n_bd) 62static inline int il_queue_dec_wrap(int idx, int n_bd)
63{ 63{
64 return --index & (n_bd - 1); 64 return --idx & (n_bd - 1);
65} 65}
66 66
67/* TODO: Move fw_desc functions to iwl-pci.ko */ 67/* TODO: Move fw_desc functions to iwl-pci.ko */
diff --git a/drivers/net/wireless/iwlegacy/iwl-led.c b/drivers/net/wireless/iwlegacy/iwl-led.c
index a283804da10d..3652cdc1770e 100644
--- a/drivers/net/wireless/iwlegacy/iwl-led.c
+++ b/drivers/net/wireless/iwlegacy/iwl-led.c
@@ -41,7 +41,7 @@
41#include "iwl-core.h" 41#include "iwl-core.h"
42#include "iwl-io.h" 42#include "iwl-io.h"
43 43
44/* default: IL_LED_BLINK(0) using blinking index table */ 44/* default: IL_LED_BLINK(0) using blinking idx table */
45static int led_mode; 45static int led_mode;
46module_param(led_mode, int, S_IRUGO); 46module_param(led_mode, int, S_IRUGO);
47MODULE_PARM_DESC(led_mode, "0=system default, " 47MODULE_PARM_DESC(led_mode, "0=system default, "
diff --git a/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h b/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
index f3ee0dd67f57..bc09a5dc6d89 100644
--- a/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
+++ b/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
@@ -49,13 +49,13 @@ struct il3945_rate_info {
49 u8 next_rs; /* next rate used in rs algo */ 49 u8 next_rs; /* next rate used in rs algo */
50 u8 prev_rs_tgg; /* previous rate used in TGG rs algo */ 50 u8 prev_rs_tgg; /* previous rate used in TGG rs algo */
51 u8 next_rs_tgg; /* next rate used in TGG rs algo */ 51 u8 next_rs_tgg; /* next rate used in TGG rs algo */
52 u8 table_rs_index; /* index in rate scale table cmd */ 52 u8 table_rs_idx; /* idx in rate scale table cmd */
53 u8 prev_table_rs; /* prev in rate table cmd */ 53 u8 prev_table_rs; /* prev in rate table cmd */
54}; 54};
55 55
56 56
57/* 57/*
58 * These serve as indexes into 58 * These serve as idxes into
59 * struct il_rate_info il_rates[RATE_COUNT]; 59 * struct il_rate_info il_rates[RATE_COUNT];
60 */ 60 */
61enum { 61enum {
@@ -351,7 +351,7 @@ struct il_traffic_load {
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 */
353struct il_lq_sta { 353struct il_lq_sta {
354 u8 active_tbl; /* index of active table, range 0-1 */ 354 u8 active_tbl; /* idx of active table, range 0-1 */
355 u8 enable_counter; /* indicates HT mode */ 355 u8 enable_counter; /* indicates HT mode */
356 u8 stay_in_tbl; /* 1: disallow, 0: allow search for new mode */ 356 u8 stay_in_tbl; /* 1: disallow, 0: allow search for new mode */
357 u8 search_better_tbl; /* 1: currently trying alternate mode */ 357 u8 search_better_tbl; /* 1: currently trying alternate mode */
diff --git a/drivers/net/wireless/iwlegacy/iwl-prph.h b/drivers/net/wireless/iwlegacy/iwl-prph.h
index 200f2955ab54..8128c87262e9 100644
--- a/drivers/net/wireless/iwlegacy/iwl-prph.h
+++ b/drivers/net/wireless/iwlegacy/iwl-prph.h
@@ -336,7 +336,7 @@
336 336
337/* 337/*
338 * Driver may need to update queue-empty bits after changing queue's 338 * Driver may need to update queue-empty bits after changing queue's
339 * write and read pointers (indexes) during (re-)initialization (i.e. when 339 * write and read pointers (idxes) during (re-)initialization (i.e. when
340 * scheduler is not tracking what's happening). 340 * scheduler is not tracking what's happening).
341 * Bit fields: 341 * Bit fields:
342 * 31-16: Write mask -- 1: update empty bit, 0: don't change empty bit 342 * 31-16: Write mask -- 1: update empty bit, 0: don't change empty bit
@@ -351,7 +351,7 @@
351 * This register points to BC CB for queue 0, must be on 1024-byte boundary. 351 * This register points to BC CB for queue 0, must be on 1024-byte boundary.
352 * Others are spaced by 1024 bytes. 352 * Others are spaced by 1024 bytes.
353 * Each BC CB is 2 bytes * (256 + 64) = 740 bytes, followed by 384 bytes pad. 353 * Each BC CB is 2 bytes * (256 + 64) = 740 bytes, followed by 384 bytes pad.
354 * (Index into a queue's BC CB) = (index into queue's TFD CB) = (SSN & 0xff). 354 * (Index into a queue's BC CB) = (idx into queue's TFD CB) = (SSN & 0xff).
355 * Bit fields: 355 * Bit fields:
356 * 25-00: Byte Count CB physical address [35:10], must be 1024-byte aligned. 356 * 25-00: Byte Count CB physical address [35:10], must be 1024-byte aligned.
357 */ 357 */
@@ -366,18 +366,18 @@
366 */ 366 */
367#define IL49_SCD_TXFACT (IL49_SCD_START_OFFSET + 0x1c) 367#define IL49_SCD_TXFACT (IL49_SCD_START_OFFSET + 0x1c)
368/* 368/*
369 * Queue (x) Write Pointers (indexes, really!), one for each Tx queue. 369 * Queue (x) Write Pointers (idxes, really!), one for each Tx queue.
370 * Initialized and updated by driver as new TFDs are added to queue. 370 * Initialized and updated by driver as new TFDs are added to queue.
371 * NOTE: If using Block Ack, index must correspond to frame's 371 * NOTE: If using Block Ack, idx must correspond to frame's
372 * Start Sequence Number; index = (SSN & 0xff) 372 * Start Sequence Number; idx = (SSN & 0xff)
373 * NOTE: Alternative to HBUS_TARG_WRPTR, which is what Linux driver uses? 373 * NOTE: Alternative to HBUS_TARG_WRPTR, which is what Linux driver uses?
374 */ 374 */
375#define IL49_SCD_QUEUE_WRPTR(x) (IL49_SCD_START_OFFSET + 0x24 + (x) * 4) 375#define IL49_SCD_QUEUE_WRPTR(x) (IL49_SCD_START_OFFSET + 0x24 + (x) * 4)
376 376
377/* 377/*
378 * Queue (x) Read Pointers (indexes, really!), one for each Tx queue. 378 * Queue (x) Read Pointers (idxes, really!), one for each Tx queue.
379 * For FIFO mode, index indicates next frame to transmit. 379 * For FIFO mode, idx indicates next frame to transmit.
380 * For Scheduler-ACK mode, index indicates first frame in Tx win. 380 * For Scheduler-ACK mode, idx indicates first frame in Tx win.
381 * Initialized by driver, updated by scheduler. 381 * Initialized by driver, updated by scheduler.
382 */ 382 */
383#define IL49_SCD_QUEUE_RDPTR(x) (IL49_SCD_START_OFFSET + 0x64 + (x) * 4) 383#define IL49_SCD_QUEUE_RDPTR(x) (IL49_SCD_START_OFFSET + 0x64 + (x) * 4)
@@ -395,7 +395,7 @@
395 395
396/* 396/*
397 * Select which queues interrupt driver when scheduler increments 397 * Select which queues interrupt driver when scheduler increments
398 * a queue's read pointer (index). 398 * a queue's read pointer (idx).
399 * Bit fields: 399 * Bit fields:
400 * 31-16: Reserved 400 * 31-16: Reserved
401 * 15-00: Interrupt enable, one bit for each queue -- 1: enabled, 0: disabled 401 * 15-00: Interrupt enable, one bit for each queue -- 1: enabled, 0: disabled
diff --git a/drivers/net/wireless/iwlegacy/iwl-rx.c b/drivers/net/wireless/iwlegacy/iwl-rx.c
index 5c0d1317d149..58d19c155a3d 100644
--- a/drivers/net/wireless/iwlegacy/iwl-rx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-rx.c
@@ -45,17 +45,17 @@
45 * each of which point to Receive Buffers to be filled by the NIC. These get 45 * each of which point to Receive Buffers to be filled by the NIC. These get
46 * used not only for Rx frames, but for any command response or notification 46 * used not only for Rx frames, but for any command response or notification
47 * from the NIC. The driver and NIC manage the Rx buffers by means 47 * from the NIC. The driver and NIC manage the Rx buffers by means
48 * of indexes into the circular buffer. 48 * of idxes into the circular buffer.
49 * 49 *
50 * Rx Queue Indexes 50 * Rx Queue Indexes
51 * The host/firmware share two index registers for managing the Rx buffers. 51 * The host/firmware share two idx registers for managing the Rx buffers.
52 * 52 *
53 * The READ index maps to the first position that the firmware may be writing 53 * The READ idx maps to the first position that the firmware may be writing
54 * to -- the driver can read up to (but not including) this position and get 54 * to -- the driver can read up to (but not including) this position and get
55 * good data. 55 * good data.
56 * The READ index is managed by the firmware once the card is enabled. 56 * The READ idx is managed by the firmware once the card is enabled.
57 * 57 *
58 * The WRITE index maps to the last position the driver has read from -- the 58 * The WRITE idx maps to the last position the driver has read from -- the
59 * position preceding WRITE is the last slot the firmware can place a packet. 59 * position preceding WRITE is the last slot the firmware can place a packet.
60 * 60 *
61 * The queue is empty (no good data) if WRITE = READ - 1, and is full if 61 * The queue is empty (no good data) if WRITE = READ - 1, and is full if
@@ -64,9 +64,9 @@
64 * During initialization, the host sets up the READ queue position to the first 64 * During initialization, the host sets up the READ queue position to the first
65 * IDX position, and WRITE to the last (READ - 1 wrapped) 65 * IDX position, and WRITE to the last (READ - 1 wrapped)
66 * 66 *
67 * When the firmware places a packet in a buffer, it will advance the READ index 67 * When the firmware places a packet in a buffer, it will advance the READ idx
68 * and fire the RX interrupt. The driver can then query the READ index and 68 * and fire the RX interrupt. The driver can then query the READ idx and
69 * process as many packets as possible, moving the WRITE index forward as it 69 * process as many packets as possible, moving the WRITE idx forward as it
70 * resets the Rx queue buffers with new memory. 70 * resets the Rx queue buffers with new memory.
71 * 71 *
72 * The management in the driver is as follows: 72 * The management in the driver is as follows:
@@ -75,9 +75,9 @@
75 * to replenish the iwl->rxq->rx_free. 75 * to replenish the iwl->rxq->rx_free.
76 * + In il_rx_replenish (scheduled) if 'processed' != 'read' then the 76 * + In il_rx_replenish (scheduled) if 'processed' != 'read' then the
77 * iwl->rxq is replenished and the READ IDX is updated (updating the 77 * iwl->rxq is replenished and the READ IDX is updated (updating the
78 * 'processed' and 'read' driver indexes as well) 78 * 'processed' and 'read' driver idxes as well)
79 * + A received packet is processed and handed to the kernel network stack, 79 * + A received packet is processed and handed to the kernel network stack,
80 * detached from the iwl->rxq. The driver 'processed' index is updated. 80 * detached from the iwl->rxq. The driver 'processed' idx is updated.
81 * + The Host/Firmware iwl->rxq is replenished at tasklet time from the rx_free 81 * + The Host/Firmware iwl->rxq is replenished at tasklet time from the rx_free
82 * list. If there are no allocated buffers in iwl->rxq->rx_free, the READ 82 * list. If there are no allocated buffers in iwl->rxq->rx_free, the READ
83 * IDX is not incremented and iwl->status(RX_STALLED) is set. If there 83 * IDX is not incremented and iwl->status(RX_STALLED) is set. If there
@@ -91,7 +91,7 @@
91 * il_rx_queue_restock 91 * il_rx_queue_restock
92 * il_rx_queue_restock() Moves available buffers from rx_free into Rx 92 * il_rx_queue_restock() Moves available buffers from rx_free into Rx
93 * queue, updates firmware pointers, and updates 93 * queue, updates firmware pointers, and updates
94 * the WRITE index. If insufficient rx_free buffers 94 * the WRITE idx. If insufficient rx_free buffers
95 * are available, schedules il_rx_replenish 95 * are available, schedules il_rx_replenish
96 * 96 *
97 * -- enable interrupts -- 97 * -- enable interrupts --
diff --git a/drivers/net/wireless/iwlegacy/iwl-sta.c b/drivers/net/wireless/iwlegacy/iwl-sta.c
index dcaa3fb62743..a7fe9ea80aa5 100644
--- a/drivers/net/wireless/iwlegacy/iwl-sta.c
+++ b/drivers/net/wireless/iwlegacy/iwl-sta.c
@@ -174,7 +174,7 @@ int il_send_add_sta(struct il_priv *il,
174} 174}
175EXPORT_SYMBOL(il_send_add_sta); 175EXPORT_SYMBOL(il_send_add_sta);
176 176
177static void il_set_ht_add_station(struct il_priv *il, u8 index, 177static void il_set_ht_add_station(struct il_priv *il, u8 idx,
178 struct ieee80211_sta *sta, 178 struct ieee80211_sta *sta,
179 struct il_rxon_context *ctx) 179 struct il_rxon_context *ctx)
180{ 180{
@@ -192,7 +192,7 @@ static void il_set_ht_add_station(struct il_priv *il, u8 index,
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 = il->stations[index].sta.station_flags; 195 sta_flags = il->stations[idx].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
@@ -221,7 +221,7 @@ static void il_set_ht_add_station(struct il_priv *il, u8 index,
221 else 221 else
222 sta_flags &= ~STA_FLG_HT40_EN_MSK; 222 sta_flags &= ~STA_FLG_HT40_EN_MSK;
223 223
224 il->stations[index].sta.station_flags = sta_flags; 224 il->stations[idx].sta.station_flags = sta_flags;
225 done: 225 done:
226 return; 226 return;
227} 227}
@@ -649,7 +649,7 @@ il_restore_stations(struct il_priv *il, struct il_rxon_context *ctx)
649} 649}
650EXPORT_SYMBOL(il_restore_stations); 650EXPORT_SYMBOL(il_restore_stations);
651 651
652int il_get_free_ucode_key_index(struct il_priv *il) 652int il_get_free_ucode_key_idx(struct il_priv *il)
653{ 653{
654 int i; 654 int i;
655 655
@@ -659,7 +659,7 @@ int il_get_free_ucode_key_index(struct il_priv *il)
659 659
660 return WEP_INVALID_OFFSET; 660 return WEP_INVALID_OFFSET;
661} 661}
662EXPORT_SYMBOL(il_get_free_ucode_key_index); 662EXPORT_SYMBOL(il_get_free_ucode_key_idx);
663 663
664void il_dealloc_bcast_stations(struct il_priv *il) 664void il_dealloc_bcast_stations(struct il_priv *il)
665{ 665{
@@ -692,7 +692,7 @@ static void il_dump_lq_cmd(struct il_priv *il,
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 D_RATE("lq index %d 0x%X\n", 695 D_RATE("lq idx %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
@@ -728,7 +728,7 @@ static bool il_is_lq_table_valid(struct il_priv *il,
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 D_INFO( 730 D_INFO(
731 "index %d of LQ expects HT channel\n", 731 "idx %d of LQ expects HT channel\n",
732 i); 732 i);
733 return false; 733 return false;
734 } 734 }
diff --git a/drivers/net/wireless/iwlegacy/iwl-sta.h b/drivers/net/wireless/iwlegacy/iwl-sta.h
index 77cdfd4a6674..f07cd7f7b8ae 100644
--- a/drivers/net/wireless/iwlegacy/iwl-sta.h
+++ b/drivers/net/wireless/iwlegacy/iwl-sta.h
@@ -48,7 +48,7 @@ void il_restore_stations(struct il_priv *il,
48void il_clear_ucode_stations(struct il_priv *il, 48void il_clear_ucode_stations(struct il_priv *il,
49 struct il_rxon_context *ctx); 49 struct il_rxon_context *ctx);
50void il_dealloc_bcast_stations(struct il_priv *il); 50void il_dealloc_bcast_stations(struct il_priv *il);
51int il_get_free_ucode_key_index(struct il_priv *il); 51int il_get_free_ucode_key_idx(struct il_priv *il);
52int il_send_add_sta(struct il_priv *il, 52int il_send_add_sta(struct il_priv *il,
53 struct il_addsta_cmd *sta, u8 flags); 53 struct il_addsta_cmd *sta, u8 flags);
54int il_add_station_common(struct il_priv *il, 54int il_add_station_common(struct il_priv *il,
diff --git a/drivers/net/wireless/iwlegacy/iwl-tx.c b/drivers/net/wireless/iwlegacy/iwl-tx.c
index 45114b495b3e..10a0914709b3 100644
--- a/drivers/net/wireless/iwlegacy/iwl-tx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-tx.c
@@ -39,7 +39,7 @@
39#include "iwl-helpers.h" 39#include "iwl-helpers.h"
40 40
41/** 41/**
42 * il_txq_update_write_ptr - Send new write index to hardware 42 * il_txq_update_write_ptr - Send new write idx to hardware
43 */ 43 */
44void 44void
45il_txq_update_write_ptr(struct il_priv *il, struct il_tx_queue *txq) 45il_txq_update_write_ptr(struct il_priv *il, struct il_tx_queue *txq)
@@ -152,7 +152,7 @@ void il_cmd_queue_unmap(struct il_priv *il)
152 return; 152 return;
153 153
154 while (q->read_ptr != q->write_ptr) { 154 while (q->read_ptr != q->write_ptr) {
155 i = il_get_cmd_index(q, q->read_ptr, 0); 155 i = il_get_cmd_idx(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(il->pci_dev, 158 pci_unmap_single(il->pci_dev,
@@ -254,7 +254,7 @@ EXPORT_SYMBOL(il_queue_space);
254 254
255 255
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 idxes
258 */ 258 */
259static int il_queue_init(struct il_priv *il, struct il_queue *q, 259static 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)
@@ -268,7 +268,7 @@ static int il_queue_init(struct il_priv *il, struct il_queue *q,
268 BUG_ON(!is_power_of_2(count)); 268 BUG_ON(!is_power_of_2(count));
269 269
270 /* slots_num must be power-of-two size, otherwise 270 /* slots_num must be power-of-two size, otherwise
271 * il_get_cmd_index is broken. */ 271 * il_get_cmd_idx is broken. */
272 BUG_ON(!is_power_of_2(slots_num)); 272 BUG_ON(!is_power_of_2(slots_num));
273 273
274 q->low_mark = q->n_win / 4; 274 q->low_mark = q->n_win / 4;
@@ -385,7 +385,7 @@ int il_tx_queue_init(struct il_priv *il, struct il_tx_queue *txq,
385 * il_queue_inc_wrap and il_queue_dec_wrap are broken. */ 385 * il_queue_inc_wrap and il_queue_dec_wrap are broken. */
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 idxes */
389 il_queue_init(il, &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
@@ -416,7 +416,7 @@ void il_tx_queue_reset(struct il_priv *il, struct il_tx_queue *txq,
416 416
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 idxes */
420 il_queue_init(il, &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
@@ -433,7 +433,7 @@ EXPORT_SYMBOL(il_tx_queue_reset);
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 idx (> 0) of command in the
437 * command queue. 437 * command queue.
438 */ 438 */
439int il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd) 439int il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd)
@@ -476,7 +476,7 @@ int il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd)
476 return -ENOSPC; 476 return -ENOSPC;
477 } 477 }
478 478
479 idx = il_get_cmd_index(q, q->write_ptr, cmd->flags & CMD_SIZE_HUGE); 479 idx = il_get_cmd_idx(q, q->write_ptr, cmd->flags & CMD_SIZE_HUGE);
480 out_cmd = txq->cmd[idx]; 480 out_cmd = txq->cmd[idx];
481 out_meta = &txq->meta[idx]; 481 out_meta = &txq->meta[idx];
482 482
@@ -543,7 +543,7 @@ int il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd)
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 idx */
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(il, txq); 548 il_txq_update_write_ptr(il, txq);
549 549
@@ -554,7 +554,7 @@ int il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd)
554/** 554/**
555 * il_hcmd_queue_reclaim - Reclaim TX command queue entries already Tx'd 555 * il_hcmd_queue_reclaim - Reclaim TX command queue entries already Tx'd
556 * 556 *
557 * When FW advances 'R' index, all entries between old and new 'R' index 557 * When FW advances 'R' idx, all entries between old and new 'R' idx
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 */
@@ -566,7 +566,7 @@ static void il_hcmd_queue_reclaim(struct il_priv *il, int txq_id,
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("Read index for DMA queue txq id (%d), index %d, " 569 IL_ERR("Read idx for DMA queue txq id (%d), idx %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,7 +576,7 @@ static void il_hcmd_queue_reclaim(struct il_priv *il, 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("HCMD skipped: index (%d) %d %d\n", idx, 579 IL_ERR("HCMD skipped: idx (%d) %d %d\n", idx,
580 q->write_ptr, q->read_ptr); 580 q->write_ptr, q->read_ptr);
581 queue_work(il->workqueue, &il->restart); 581 queue_work(il->workqueue, &il->restart);
582 } 582 }
@@ -598,8 +598,8 @@ il_tx_cmd_complete(struct il_priv *il, struct il_rx_buf *rxb)
598 struct il_rx_pkt *pkt = rxb_addr(rxb); 598 struct il_rx_pkt *pkt = rxb_addr(rxb);
599 u16 sequence = le16_to_cpu(pkt->hdr.sequence); 599 u16 sequence = le16_to_cpu(pkt->hdr.sequence);
600 int txq_id = SEQ_TO_QUEUE(sequence); 600 int txq_id = SEQ_TO_QUEUE(sequence);
601 int index = SEQ_TO_IDX(sequence); 601 int idx = SEQ_TO_IDX(sequence);
602 int cmd_index; 602 int cmd_idx;
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;
@@ -618,9 +618,9 @@ il_tx_cmd_complete(struct il_priv *il, struct il_rx_buf *rxb)
618 return; 618 return;
619 } 619 }
620 620
621 cmd_index = il_get_cmd_index(&txq->q, index, huge); 621 cmd_idx = il_get_cmd_idx(&txq->q, idx, huge);
622 cmd = txq->cmd[cmd_index]; 622 cmd = txq->cmd[cmd_idx];
623 meta = &txq->meta[cmd_index]; 623 meta = &txq->meta[cmd_idx];
624 624
625 txq->time_stamp = jiffies; 625 txq->time_stamp = jiffies;
626 626
@@ -638,7 +638,7 @@ il_tx_cmd_complete(struct il_priv *il, struct il_rx_buf *rxb)
638 638
639 spin_lock_irqsave(&il->hcmd_lock, flags); 639 spin_lock_irqsave(&il->hcmd_lock, flags);
640 640
641 il_hcmd_queue_reclaim(il, txq_id, index, cmd_index); 641 il_hcmd_queue_reclaim(il, txq_id, idx, cmd_idx);
642 642
643 if (!(meta->flags & CMD_ASYNC)) { 643 if (!(meta->flags & CMD_ASYNC)) {
644 clear_bit(STATUS_HCMD_ACTIVE, &il->status); 644 clear_bit(STATUS_HCMD_ACTIVE, &il->status);
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c
index 017b29720423..924420870a2f 100644
--- a/drivers/net/wireless/iwlegacy/iwl3945-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c
@@ -163,7 +163,7 @@ static int il3945_set_ccmp_dynamic_key_info(struct il_priv *il,
163 if ((il->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 il->stations[sta_id].sta.key.key_offset = 165 il->stations[sta_id].sta.key.key_offset =
166 il_get_free_ucode_key_index(il); 166 il_get_free_ucode_key_idx(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
@@ -513,7 +513,7 @@ static int il3945_tx_skb(struct il_priv *il, struct sk_buff *skb)
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 idx into station table for destination station */
517 sta_id = il_sta_id_or_broadcast( 517 sta_id = il_sta_id_or_broadcast(
518 il, &il->ctx, 518 il, &il->ctx,
519 info->control.sta); 519 info->control.sta);
@@ -541,7 +541,7 @@ static int il3945_tx_skb(struct il_priv *il, struct sk_buff *skb)
541 541
542 spin_lock_irqsave(&il->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_idx(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));
@@ -557,7 +557,7 @@ static int il3945_tx_skb(struct il_priv *il, struct sk_buff *skb)
557 557
558 /* 558 /*
559 * Set up the Tx-command (not MAC!) header. 559 * Set up the Tx-command (not MAC!) header.
560 * Store the chosen Tx queue and TFD index within the sequence field; 560 * Store the chosen Tx queue and TFD idx within the sequence field;
561 * after Tx, uCode's Tx response will return this value so driver can 561 * after Tx, uCode's Tx response will return this value so driver can
562 * locate the frame within the tx queue and do post-tx processing. 562 * locate the frame within the tx queue and do post-tx processing.
563 */ 563 */
@@ -641,7 +641,7 @@ static int il3945_tx_skb(struct il_priv *il, struct sk_buff *skb)
641 } 641 }
642 642
643 643
644 /* Tell device the write index *just past* this latest filled TFD */ 644 /* Tell device the write idx *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(il, txq); 646 il_txq_update_write_ptr(il, txq);
647 spin_unlock_irqrestore(&il->lock, flags); 647 spin_unlock_irqrestore(&il->lock, flags);
@@ -889,14 +889,14 @@ static void il3945_setup_rx_handlers(struct il_priv *il)
889 * 0 to 31 889 * 0 to 31
890 * 890 *
891 * Rx Queue Indexes 891 * Rx Queue Indexes
892 * The host/firmware share two index registers for managing the Rx buffers. 892 * The host/firmware share two idx registers for managing the Rx buffers.
893 * 893 *
894 * The READ index maps to the first position that the firmware may be writing 894 * The READ idx maps to the first position that the firmware may be writing
895 * to -- the driver can read up to (but not including) this position and get 895 * to -- the driver can read up to (but not including) this position and get
896 * good data. 896 * good data.
897 * The READ index is managed by the firmware once the card is enabled. 897 * The READ idx is managed by the firmware once the card is enabled.
898 * 898 *
899 * The WRITE index maps to the last position the driver has read from -- the 899 * The WRITE idx maps to the last position the driver has read from -- the
900 * position preceding WRITE is the last slot the firmware can place a packet. 900 * position preceding WRITE is the last slot the firmware can place a packet.
901 * 901 *
902 * The queue is empty (no good data) if WRITE = READ - 1, and is full if 902 * The queue is empty (no good data) if WRITE = READ - 1, and is full if
@@ -905,9 +905,9 @@ static void il3945_setup_rx_handlers(struct il_priv *il)
905 * During initialization, the host sets up the READ queue position to the first 905 * During initialization, the host sets up the READ queue position to the first
906 * IDX position, and WRITE to the last (READ - 1 wrapped) 906 * IDX position, and WRITE to the last (READ - 1 wrapped)
907 * 907 *
908 * When the firmware places a packet in a buffer, it will advance the READ index 908 * When the firmware places a packet in a buffer, it will advance the READ idx
909 * and fire the RX interrupt. The driver can then query the READ index and 909 * and fire the RX interrupt. The driver can then query the READ idx and
910 * process as many packets as possible, moving the WRITE index forward as it 910 * process as many packets as possible, moving the WRITE idx forward as it
911 * resets the Rx queue buffers with new memory. 911 * resets the Rx queue buffers with new memory.
912 * 912 *
913 * The management in the driver is as follows: 913 * The management in the driver is as follows:
@@ -916,9 +916,9 @@ static void il3945_setup_rx_handlers(struct il_priv *il)
916 * to replenish the iwl->rxq->rx_free. 916 * to replenish the iwl->rxq->rx_free.
917 * + In il3945_rx_replenish (scheduled) if 'processed' != 'read' then the 917 * + In il3945_rx_replenish (scheduled) if 'processed' != 'read' then the
918 * iwl->rxq is replenished and the READ IDX is updated (updating the 918 * iwl->rxq is replenished and the READ IDX is updated (updating the
919 * 'processed' and 'read' driver indexes as well) 919 * 'processed' and 'read' driver idxes as well)
920 * + A received packet is processed and handed to the kernel network stack, 920 * + A received packet is processed and handed to the kernel network stack,
921 * detached from the iwl->rxq. The driver 'processed' index is updated. 921 * detached from the iwl->rxq. The driver 'processed' idx is updated.
922 * + The Host/Firmware iwl->rxq is replenished at tasklet time from the rx_free 922 * + The Host/Firmware iwl->rxq is replenished at tasklet time from the rx_free
923 * list. If there are no allocated buffers in iwl->rxq->rx_free, the READ 923 * list. If there are no allocated buffers in iwl->rxq->rx_free, the READ
924 * IDX is not incremented and iwl->status(RX_STALLED) is set. If there 924 * IDX is not incremented and iwl->status(RX_STALLED) is set. If there
@@ -931,7 +931,7 @@ static void il3945_setup_rx_handlers(struct il_priv *il)
931 * il3945_rx_queue_restock 931 * il3945_rx_queue_restock
932 * il3945_rx_queue_restock() Moves available buffers from rx_free into Rx 932 * il3945_rx_queue_restock() Moves available buffers from rx_free into Rx
933 * queue, updates firmware pointers, and updates 933 * queue, updates firmware pointers, and updates
934 * the WRITE index. If insufficient rx_free buffers 934 * the WRITE idx. If insufficient rx_free buffers
935 * are available, schedules il3945_rx_replenish 935 * are available, schedules il3945_rx_replenish
936 * 936 *
937 * -- enable interrupts -- 937 * -- enable interrupts --
@@ -960,7 +960,7 @@ static inline __le32 il3945_dma_addr2rbd_ptr(struct il_priv *il,
960 * and we have free pre-allocated buffers, fill the ranks as much 960 * and we have free pre-allocated buffers, fill the ranks as much
961 * as we can, pulling from rx_free. 961 * as we can, pulling from rx_free.
962 * 962 *
963 * This moves the 'write' index forward to catch up with 'processed', and 963 * This moves the 'write' idx forward to catch up with 'processed', and
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 */
@@ -1211,7 +1211,7 @@ static void il3945_rx_handle(struct il_priv *il)
1211 u32 count = 8; 1211 u32 count = 8;
1212 int total_empty = 0; 1212 int total_empty = 0;
1213 1213
1214 /* uCode's read index (stored in shared DRAM) indicates the last Rx 1214 /* uCode's read idx (stored in shared DRAM) indicates the last Rx
1215 * buffer that the driver may process (last buffer filled by ucode). */ 1215 * buffer that the driver may process (last buffer filled by ucode). */
1216 r = le16_to_cpu(rxq->rb_stts->closed_rb_num) & 0x0FFF; 1216 r = le16_to_cpu(rxq->rb_stts->closed_rb_num) & 0x0FFF;
1217 i = rxq->read; 1217 i = rxq->read;
@@ -1656,7 +1656,7 @@ static void il3945_init_hw_rates(struct il_priv *il,
1656 1656
1657 for (i = 0; i < RATE_COUNT_LEGACY; i++) { 1657 for (i = 0; i < RATE_COUNT_LEGACY; i++) {
1658 rates[i].bitrate = il3945_rates[i].ieee * 5; 1658 rates[i].bitrate = il3945_rates[i].ieee * 5;
1659 rates[i].hw_value = i; /* Rate scaling will work on indexes */ 1659 rates[i].hw_value = i; /* Rate scaling will work on idxes */
1660 rates[i].hw_value_short = i; 1660 rates[i].hw_value_short = i;
1661 rates[i].flags = 0; 1661 rates[i].flags = 0;
1662 if (i > IL39_LAST_OFDM_RATE || i < IL_FIRST_OFDM_RATE) { 1662 if (i > IL39_LAST_OFDM_RATE || i < IL_FIRST_OFDM_RATE) {
@@ -1850,7 +1850,7 @@ IL3945_UCODE_GET(boot_size);
1850static int il3945_read_ucode(struct il_priv *il) 1850static 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, idx;
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 = il->cfg->fw_name_pre; 1856 const char *name_pre = il->cfg->fw_name_pre;
@@ -1863,8 +1863,8 @@ static int il3945_read_ucode(struct il_priv *il)
1863 1863
1864 /* Ask kernel firmware_class module to get the boot firmware off disk. 1864 /* Ask kernel firmware_class module to get the boot firmware off disk.
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 (idx = api_max; idx >= api_min; idx--) {
1867 sprintf(buf, "%s%u%s", name_pre, index, ".ucode"); 1867 sprintf(buf, "%s%u%s", name_pre, idx, ".ucode");
1868 ret = request_firmware(&ucode_raw, buf, &il->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("%s firmware file req failed: %d\n", 1870 IL_ERR("%s firmware file req failed: %d\n",
@@ -1874,7 +1874,7 @@ static int il3945_read_ucode(struct il_priv *il)
1874 else 1874 else
1875 goto error; 1875 goto error;
1876 } else { 1876 } else {
1877 if (index < api_max) 1877 if (idx < api_max)
1878 IL_ERR("Loaded firmware %s, " 1878 IL_ERR("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",
diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c
index bc5a0080b9d3..afdec783333c 100644
--- a/drivers/net/wireless/iwlegacy/iwl4965-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl4965-base.c
@@ -173,7 +173,7 @@ static void il4965_set_beacon_tim(struct il_priv *il,
173 struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)beacon; 173 struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)beacon;
174 174
175 /* 175 /*
176 * The index is relative to frame start but we start looking at the 176 * The idx is relative to frame start but we start looking at the
177 * variable-length part of the beacon. 177 * variable-length part of the beacon.
178 */ 178 */
179 tim_idx = mgmt->u.beacon.variable - beacon; 179 tim_idx = mgmt->u.beacon.variable - beacon;
@@ -318,7 +318,7 @@ static inline u8 il4965_tfd_get_num_tbs(struct il_tfd *tfd)
318 * @il - driver ilate 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 idxes
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 */
324void il4965_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq) 324void il4965_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq)
@@ -326,11 +326,11 @@ void il4965_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq)
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 = il->pci_dev; 328 struct pci_dev *dev = il->pci_dev;
329 int index = txq->q.read_ptr; 329 int idx = txq->q.read_ptr;
330 int i; 330 int i;
331 int num_tbs; 331 int num_tbs;
332 332
333 tfd = &tfd_tmp[index]; 333 tfd = &tfd_tmp[idx];
334 334
335 /* Sanity check on number of chunks */ 335 /* Sanity check on number of chunks */
336 num_tbs = il4965_tfd_get_num_tbs(tfd); 336 num_tbs = il4965_tfd_get_num_tbs(tfd);
@@ -344,8 +344,8 @@ void il4965_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq)
344 /* Unmap tx_cmd */ 344 /* Unmap tx_cmd */
345 if (num_tbs) 345 if (num_tbs)
346 pci_unmap_single(dev, 346 pci_unmap_single(dev,
347 dma_unmap_addr(&txq->meta[index], mapping), 347 dma_unmap_addr(&txq->meta[idx], mapping),
348 dma_unmap_len(&txq->meta[index], len), 348 dma_unmap_len(&txq->meta[idx], len),
349 PCI_DMA_BIDIRECTIONAL); 349 PCI_DMA_BIDIRECTIONAL);
350 350
351 /* Unmap chunks, if any. */ 351 /* Unmap chunks, if any. */
@@ -643,7 +643,7 @@ void il4965_rx_handle(struct il_priv *il)
643 u32 count = 8; 643 u32 count = 8;
644 int total_empty; 644 int total_empty;
645 645
646 /* uCode's read index (stored in shared DRAM) indicates the last Rx 646 /* uCode's read idx (stored in shared DRAM) indicates the last Rx
647 * buffer that the driver may process (last buffer filled by ucode). */ 647 * buffer that the driver may process (last buffer filled by ucode). */
648 r = le16_to_cpu(rxq->rb_stts->closed_rb_num) & 0x0FFF; 648 r = le16_to_cpu(rxq->rb_stts->closed_rb_num) & 0x0FFF;
649 i = rxq->read; 649 i = rxq->read;
@@ -1106,14 +1106,14 @@ static int __must_check il4965_request_firmware(struct il_priv *il, bool first)
1106 char tag[8]; 1106 char tag[8];
1107 1107
1108 if (first) { 1108 if (first) {
1109 il->fw_index = il->cfg->ucode_api_max; 1109 il->fw_idx = il->cfg->ucode_api_max;
1110 sprintf(tag, "%d", il->fw_index); 1110 sprintf(tag, "%d", il->fw_idx);
1111 } else { 1111 } else {
1112 il->fw_index--; 1112 il->fw_idx--;
1113 sprintf(tag, "%d", il->fw_index); 1113 sprintf(tag, "%d", il->fw_idx);
1114 } 1114 }
1115 1115
1116 if (il->fw_index < il->cfg->ucode_api_min) { 1116 if (il->fw_idx < il->cfg->ucode_api_min) {
1117 IL_ERR("no suitable firmware found!\n"); 1117 IL_ERR("no suitable firmware found!\n");
1118 return -ENOENT; 1118 return -ENOENT;
1119 } 1119 }
@@ -1213,7 +1213,7 @@ 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 (il->fw_index <= il->cfg->ucode_api_max) 1216 if (il->fw_idx <= il->cfg->ucode_api_max)
1217 IL_ERR( 1217 IL_ERR(
1218 "request for firmware file '%s' failed.\n", 1218 "request for firmware file '%s' failed.\n",
1219 il->firmware_name); 1219 il->firmware_name);
@@ -1655,7 +1655,7 @@ static int il4965_alive_notify(struct il_priv *il)
1655 /* Initialize each Tx queue (including the command queue) */ 1655 /* Initialize each Tx queue (including the command queue) */
1656 for (i = 0; i < il->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 idxes */
1659 il_wr_prph(il, IL49_SCD_QUEUE_RDPTR(i), 0); 1659 il_wr_prph(il, IL49_SCD_QUEUE_RDPTR(i), 0);
1660 il_wr(il, HBUS_TARG_WRPTR, 0 | (i << 8)); 1660 il_wr(il, HBUS_TARG_WRPTR, 0 | (i << 8));
1661 1661
@@ -2713,7 +2713,7 @@ static void il4965_init_hw_rates(struct il_priv *il,
2713 2713
2714 for (i = 0; i < RATE_COUNT_LEGACY; i++) { 2714 for (i = 0; i < RATE_COUNT_LEGACY; i++) {
2715 rates[i].bitrate = il_rates[i].ieee * 5; 2715 rates[i].bitrate = il_rates[i].ieee * 5;
2716 rates[i].hw_value = i; /* Rate scaling will work on indexes */ 2716 rates[i].hw_value = i; /* Rate scaling will work on idxes */
2717 rates[i].hw_value_short = i; 2717 rates[i].hw_value_short = i;
2718 rates[i].flags = 0; 2718 rates[i].flags = 0;
2719 if ((i >= IL_FIRST_CCK_RATE) && (i <= IL_LAST_CCK_RATE)) { 2719 if ((i >= IL_FIRST_CCK_RATE) && (i <= IL_LAST_CCK_RATE)) {
@@ -2729,11 +2729,11 @@ static void il4965_init_hw_rates(struct il_priv *il,
2729/* 2729/*
2730 * Acquire il->lock before calling this function ! 2730 * Acquire il->lock before calling this function !
2731 */ 2731 */
2732void il4965_set_wr_ptrs(struct il_priv *il, int txq_id, u32 index) 2732void il4965_set_wr_ptrs(struct il_priv *il, int txq_id, u32 idx)
2733{ 2733{
2734 il_wr(il, HBUS_TARG_WRPTR, 2734 il_wr(il, HBUS_TARG_WRPTR,
2735 (index & 0xff) | (txq_id << 8)); 2735 (idx & 0xff) | (txq_id << 8));
2736 il_wr_prph(il, IL49_SCD_QUEUE_RDPTR(txq_id), index); 2736 il_wr_prph(il, IL49_SCD_QUEUE_RDPTR(txq_id), idx);
2737} 2737}
2738 2738
2739void il4965_tx_queue_set_status(struct il_priv *il, 2739void il4965_tx_queue_set_status(struct il_priv *il,