aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2011-08-26 10:07:43 -0400
committerStanislaw Gruszka <sgruszka@redhat.com>2011-11-15 06:26:39 -0500
commit2eb058162ea8b72d5d8965520d05bcdc160010b3 (patch)
treea65548725f3f2c240cdaba4400d6d20a8774b3d8 /drivers
parent6ce1dc45304eece672a36241cda587ba056d2b1f (diff)
iwlegacy: s/IL_RATE/RATE/
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-3945-rs.c160
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-3945.c92
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-3945.h4
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-lib.c8
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-rs.c180
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-sta.c4
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-tx.c2
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-commands.h2
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-core.c16
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-legacy-rs.h244
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-sta.c2
-rw-r--r--drivers/net/wireless/iwlegacy/iwl3945-base.c8
-rw-r--r--drivers/net/wireless/iwlegacy/iwl4965-base.c6
13 files changed, 364 insertions, 364 deletions
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-rs.c b/drivers/net/wireless/iwlegacy/iwl-3945-rs.c
index 5c855e88b95e..92fa4366ab89 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-3945-rs.c
@@ -42,19 +42,19 @@
42 42
43#define RS_NAME "iwl-3945-rs" 43#define RS_NAME "iwl-3945-rs"
44 44
45static s32 il3945_expected_tpt_g[IL_RATE_COUNT_3945] = { 45static s32 il3945_expected_tpt_g[RATE_COUNT_3945] = {
46 7, 13, 35, 58, 0, 0, 76, 104, 130, 168, 191, 202 46 7, 13, 35, 58, 0, 0, 76, 104, 130, 168, 191, 202
47}; 47};
48 48
49static s32 il3945_expected_tpt_g_prot[IL_RATE_COUNT_3945] = { 49static s32 il3945_expected_tpt_g_prot[RATE_COUNT_3945] = {
50 7, 13, 35, 58, 0, 0, 0, 80, 93, 113, 123, 125 50 7, 13, 35, 58, 0, 0, 0, 80, 93, 113, 123, 125
51}; 51};
52 52
53static s32 il3945_expected_tpt_a[IL_RATE_COUNT_3945] = { 53static s32 il3945_expected_tpt_a[RATE_COUNT_3945] = {
54 0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186 54 0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186
55}; 55};
56 56
57static s32 il3945_expected_tpt_b[IL_RATE_COUNT_3945] = { 57static s32 il3945_expected_tpt_b[RATE_COUNT_3945] = {
58 7, 13, 35, 58, 0, 0, 0, 0, 0, 0, 0, 0 58 7, 13, 35, 58, 0, 0, 0, 0, 0, 0, 0, 0
59}; 59};
60 60
@@ -64,39 +64,39 @@ struct il3945_tpt_entry {
64}; 64};
65 65
66static struct il3945_tpt_entry il3945_tpt_table_a[] = { 66static struct il3945_tpt_entry il3945_tpt_table_a[] = {
67 {-60, IL_RATE_54M_INDEX}, 67 {-60, RATE_54M_INDEX},
68 {-64, IL_RATE_48M_INDEX}, 68 {-64, RATE_48M_INDEX},
69 {-72, IL_RATE_36M_INDEX}, 69 {-72, RATE_36M_INDEX},
70 {-80, IL_RATE_24M_INDEX}, 70 {-80, RATE_24M_INDEX},
71 {-84, IL_RATE_18M_INDEX}, 71 {-84, RATE_18M_INDEX},
72 {-85, IL_RATE_12M_INDEX}, 72 {-85, RATE_12M_INDEX},
73 {-87, IL_RATE_9M_INDEX}, 73 {-87, RATE_9M_INDEX},
74 {-89, IL_RATE_6M_INDEX} 74 {-89, RATE_6M_INDEX}
75}; 75};
76 76
77static struct il3945_tpt_entry il3945_tpt_table_g[] = { 77static struct il3945_tpt_entry il3945_tpt_table_g[] = {
78 {-60, IL_RATE_54M_INDEX}, 78 {-60, RATE_54M_INDEX},
79 {-64, IL_RATE_48M_INDEX}, 79 {-64, RATE_48M_INDEX},
80 {-68, IL_RATE_36M_INDEX}, 80 {-68, RATE_36M_INDEX},
81 {-80, IL_RATE_24M_INDEX}, 81 {-80, RATE_24M_INDEX},
82 {-84, IL_RATE_18M_INDEX}, 82 {-84, RATE_18M_INDEX},
83 {-85, IL_RATE_12M_INDEX}, 83 {-85, RATE_12M_INDEX},
84 {-86, IL_RATE_11M_INDEX}, 84 {-86, RATE_11M_INDEX},
85 {-88, IL_RATE_5M_INDEX}, 85 {-88, RATE_5M_INDEX},
86 {-90, IL_RATE_2M_INDEX}, 86 {-90, RATE_2M_INDEX},
87 {-92, IL_RATE_1M_INDEX} 87 {-92, RATE_1M_INDEX}
88}; 88};
89 89
90#define IL_RATE_MAX_WINDOW 62 90#define RATE_MAX_WINDOW 62
91#define IL_RATE_FLUSH (3*HZ) 91#define RATE_FLUSH (3*HZ)
92#define IL_RATE_WIN_FLUSH (HZ/2) 92#define RATE_WIN_FLUSH (HZ/2)
93#define IL39_RATE_HIGH_TH 11520 93#define IL39_RATE_HIGH_TH 11520
94#define IL_SUCCESS_UP_TH 8960 94#define IL_SUCCESS_UP_TH 8960
95#define IL_SUCCESS_DOWN_TH 10880 95#define IL_SUCCESS_DOWN_TH 10880
96#define IL_RATE_MIN_FAILURE_TH 6 96#define RATE_MIN_FAILURE_TH 6
97#define IL_RATE_MIN_SUCCESS_TH 8 97#define RATE_MIN_SUCCESS_TH 8
98#define IL_RATE_DECREASE_TH 1920 98#define RATE_DECREASE_TH 1920
99#define IL_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_index_by_rssi(s32 rssi, enum ieee80211_band band)
102{ 102{
@@ -157,16 +157,16 @@ static int il3945_rate_scale_flush_wins(struct il3945_rs_sta *rs_sta)
157 157
158 /* 158 /*
159 * For each rate, if we have collected data on that rate 159 * For each rate, if we have collected data on that rate
160 * and it has been more than IL_RATE_WIN_FLUSH 160 * and it has been more than RATE_WIN_FLUSH
161 * since we flushed, clear out the gathered stats 161 * since we flushed, clear out the gathered stats
162 */ 162 */
163 for (i = 0; i < IL_RATE_COUNT_3945; i++) { 163 for (i = 0; i < RATE_COUNT_3945; i++) {
164 if (!rs_sta->win[i].counter) 164 if (!rs_sta->win[i].counter)
165 continue; 165 continue;
166 166
167 spin_lock_irqsave(&rs_sta->lock, flags); 167 spin_lock_irqsave(&rs_sta->lock, flags);
168 if (time_after(jiffies, rs_sta->win[i].stamp + 168 if (time_after(jiffies, rs_sta->win[i].stamp +
169 IL_RATE_WIN_FLUSH)) { 169 RATE_WIN_FLUSH)) {
170 D_RATE("flushing %d samples of rate " 170 D_RATE("flushing %d samples of rate "
171 "index %d\n", 171 "index %d\n",
172 rs_sta->win[i].counter, i); 172 rs_sta->win[i].counter, i);
@@ -179,8 +179,8 @@ static int il3945_rate_scale_flush_wins(struct il3945_rs_sta *rs_sta)
179 return unflushed; 179 return unflushed;
180} 180}
181 181
182#define IL_RATE_FLUSH_MAX 5000 /* msec */ 182#define RATE_FLUSH_MAX 5000 /* msec */
183#define IL_RATE_FLUSH_MIN 50 /* msec */ 183#define RATE_FLUSH_MIN 50 /* msec */
184#define IL_AVERAGE_PACKETS 1500 184#define IL_AVERAGE_PACKETS 1500
185 185
186static void il3945_bg_rate_scale_flush(unsigned long data) 186static void il3945_bg_rate_scale_flush(unsigned long data)
@@ -217,12 +217,12 @@ static void il3945_bg_rate_scale_flush(unsigned long data)
217 217
218 if (pps) { 218 if (pps) {
219 duration = (IL_AVERAGE_PACKETS * 1000) / pps; 219 duration = (IL_AVERAGE_PACKETS * 1000) / pps;
220 if (duration < IL_RATE_FLUSH_MIN) 220 if (duration < RATE_FLUSH_MIN)
221 duration = IL_RATE_FLUSH_MIN; 221 duration = RATE_FLUSH_MIN;
222 else if (duration > IL_RATE_FLUSH_MAX) 222 else if (duration > RATE_FLUSH_MAX)
223 duration = IL_RATE_FLUSH_MAX; 223 duration = RATE_FLUSH_MAX;
224 } else 224 } else
225 duration = IL_RATE_FLUSH_MAX; 225 duration = RATE_FLUSH_MAX;
226 226
227 rs_sta->flush_time = msecs_to_jiffies(duration); 227 rs_sta->flush_time = msecs_to_jiffies(duration);
228 228
@@ -234,7 +234,7 @@ static void il3945_bg_rate_scale_flush(unsigned long data)
234 234
235 rs_sta->last_partial_flush = jiffies; 235 rs_sta->last_partial_flush = jiffies;
236 } else { 236 } else {
237 rs_sta->flush_time = IL_RATE_FLUSH; 237 rs_sta->flush_time = RATE_FLUSH;
238 rs_sta->flush_pending = 0; 238 rs_sta->flush_pending = 0;
239 } 239 }
240 /* If there weren't any unflushed entries, we don't schedule the timer 240 /* If there weren't any unflushed entries, we don't schedule the timer
@@ -278,13 +278,13 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta,
278 * we keep these bitmaps!). 278 * we keep these bitmaps!).
279 * */ 279 * */
280 while (retries > 0) { 280 while (retries > 0) {
281 if (win->counter >= IL_RATE_MAX_WINDOW) { 281 if (win->counter >= RATE_MAX_WINDOW) {
282 282
283 /* remove earliest */ 283 /* remove earliest */
284 win->counter = IL_RATE_MAX_WINDOW - 1; 284 win->counter = RATE_MAX_WINDOW - 1;
285 285
286 if (win->data & (1ULL << (IL_RATE_MAX_WINDOW - 1))) { 286 if (win->data & (1ULL << (RATE_MAX_WINDOW - 1))) {
287 win->data &= ~(1ULL << (IL_RATE_MAX_WINDOW - 1)); 287 win->data &= ~(1ULL << (RATE_MAX_WINDOW - 1));
288 win->success_counter--; 288 win->success_counter--;
289 } 289 }
290 } 290 }
@@ -315,8 +315,8 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta,
315 fail_count = win->counter - win->success_counter; 315 fail_count = win->counter - win->success_counter;
316 316
317 /* Calculate average throughput, if we have enough history. */ 317 /* Calculate average throughput, if we have enough history. */
318 if (fail_count >= IL_RATE_MIN_FAILURE_TH || 318 if (fail_count >= RATE_MIN_FAILURE_TH ||
319 win->success_counter >= IL_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[index] + 64) / 128);
322 else 322 else
@@ -351,20 +351,20 @@ void il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_i
351 351
352 rs_sta->il = il; 352 rs_sta->il = il;
353 353
354 rs_sta->start_rate = IL_RATE_INVALID; 354 rs_sta->start_rate = RATE_INVALID;
355 355
356 /* default to just 802.11b */ 356 /* default to just 802.11b */
357 rs_sta->expected_tpt = il3945_expected_tpt_b; 357 rs_sta->expected_tpt = il3945_expected_tpt_b;
358 358
359 rs_sta->last_partial_flush = jiffies; 359 rs_sta->last_partial_flush = jiffies;
360 rs_sta->last_flush = jiffies; 360 rs_sta->last_flush = jiffies;
361 rs_sta->flush_time = IL_RATE_FLUSH; 361 rs_sta->flush_time = RATE_FLUSH;
362 rs_sta->last_tx_packets = 0; 362 rs_sta->last_tx_packets = 0;
363 363
364 rs_sta->rate_scale_flush.data = (unsigned long)rs_sta; 364 rs_sta->rate_scale_flush.data = (unsigned long)rs_sta;
365 rs_sta->rate_scale_flush.function = il3945_bg_rate_scale_flush; 365 rs_sta->rate_scale_flush.function = il3945_bg_rate_scale_flush;
366 366
367 for (i = 0; i < IL_RATE_COUNT_3945; i++) 367 for (i = 0; i < RATE_COUNT_3945; i++)
368 il3945_clear_win(&rs_sta->win[i]); 368 il3945_clear_win(&rs_sta->win[i]);
369 369
370 /* TODO: what is a good starting rate for STA? About middle? Maybe not 370 /* TODO: what is a good starting rate for STA? About middle? Maybe not
@@ -457,11 +457,11 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *
457 457
458 retries = info->status.rates[0].count; 458 retries = info->status.rates[0].count;
459 /* Sanity Check for retries */ 459 /* Sanity Check for retries */
460 if (retries > IL_RATE_RETRY_TH) 460 if (retries > RATE_RETRY_TH)
461 retries = IL_RATE_RETRY_TH; 461 retries = RATE_RETRY_TH;
462 462
463 first_index = sband->bitrates[info->status.rates[0].idx].hw_value; 463 first_index = sband->bitrates[info->status.rates[0].idx].hw_value;
464 if (first_index < 0 || first_index >= IL_RATE_COUNT_3945) { 464 if (first_index < 0 || first_index >= 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_index);
466 return; 466 return;
467 } 467 }
@@ -549,8 +549,8 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *
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 index, u16 rate_mask, enum ieee80211_band band)
551{ 551{
552 u8 high = IL_RATE_INVALID; 552 u8 high = RATE_INVALID;
553 u8 low = IL_RATE_INVALID; 553 u8 low = RATE_INVALID;
554 struct il_priv *il __maybe_unused = rs_sta->il; 554 struct il_priv *il __maybe_unused = rs_sta->il;
555 555
556 /* 802.11A walks to the next literal adjacent rate in 556 /* 802.11A walks to the next literal adjacent rate in
@@ -570,7 +570,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
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 = index + 1;
573 for (mask = (1 << i); i < IL_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) {
576 high = i; 576 high = i;
@@ -582,12 +582,12 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
582 } 582 }
583 583
584 low = index; 584 low = index;
585 while (low != IL_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;
588 else 588 else
589 low = il3945_rates[low].prev_rs; 589 low = il3945_rates[low].prev_rs;
590 if (low == IL_RATE_INVALID) 590 if (low == RATE_INVALID)
591 break; 591 break;
592 if (rate_mask & (1 << low)) 592 if (rate_mask & (1 << low))
593 break; 593 break;
@@ -595,12 +595,12 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
595 } 595 }
596 596
597 high = index; 597 high = index;
598 while (high != IL_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;
601 else 601 else
602 high = il3945_rates[high].next_rs; 602 high = il3945_rates[high].next_rs;
603 if (high == IL_RATE_INVALID) 603 if (high == RATE_INVALID)
604 break; 604 break;
605 if (rate_mask & (1 << high)) 605 if (rate_mask & (1 << high))
606 break; 606 break;
@@ -631,8 +631,8 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
631{ 631{
632 struct ieee80211_supported_band *sband = txrc->sband; 632 struct ieee80211_supported_band *sband = txrc->sband;
633 struct sk_buff *skb = txrc->skb; 633 struct sk_buff *skb = txrc->skb;
634 u8 low = IL_RATE_INVALID; 634 u8 low = RATE_INVALID;
635 u8 high = IL_RATE_INVALID; 635 u8 high = RATE_INVALID;
636 u16 high_low; 636 u16 high_low;
637 int index; 637 int index;
638 struct il3945_rs_sta *rs_sta = il_sta; 638 struct il3945_rs_sta *rs_sta = il_sta;
@@ -665,10 +665,10 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
665 max_rate_idx = txrc->max_rate_idx; 665 max_rate_idx = txrc->max_rate_idx;
666 if (sband->band == IEEE80211_BAND_5GHZ && max_rate_idx != -1) 666 if (sband->band == IEEE80211_BAND_5GHZ && max_rate_idx != -1)
667 max_rate_idx += IL_FIRST_OFDM_RATE; 667 max_rate_idx += IL_FIRST_OFDM_RATE;
668 if (max_rate_idx < 0 || max_rate_idx >= IL_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, IL_RATE_COUNT_3945 - 1); 671 index = 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;
@@ -678,11 +678,11 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
678 /* for recent assoc, choose best rate regarding 678 /* for recent assoc, choose best rate regarding
679 * to rssi value 679 * to rssi value
680 */ 680 */
681 if (rs_sta->start_rate != IL_RATE_INVALID) { 681 if (rs_sta->start_rate != RATE_INVALID) {
682 if (rs_sta->start_rate < index && 682 if (rs_sta->start_rate < index &&
683 (rate_mask & (1 << rs_sta->start_rate))) 683 (rate_mask & (1 << rs_sta->start_rate)))
684 index = rs_sta->start_rate; 684 index = rs_sta->start_rate;
685 rs_sta->start_rate = IL_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 */
@@ -695,8 +695,8 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
695 695
696 fail_count = win->counter - win->success_counter; 696 fail_count = win->counter - win->success_counter;
697 697
698 if (fail_count < IL_RATE_MIN_FAILURE_TH && 698 if (fail_count < RATE_MIN_FAILURE_TH &&
699 win->success_counter < IL_RATE_MIN_SUCCESS_TH) { 699 win->success_counter < RATE_MIN_SUCCESS_TH) {
700 spin_unlock_irqrestore(&rs_sta->lock, flags); 700 spin_unlock_irqrestore(&rs_sta->lock, flags);
701 701
702 D_RATE("Invalid average_tpt on rate %d: " 702 D_RATE("Invalid average_tpt on rate %d: "
@@ -722,13 +722,13 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
722 722
723 /* If user set max rate, dont allow higher than user constrain */ 723 /* If user set max rate, dont allow higher than user constrain */
724 if (max_rate_idx != -1 && max_rate_idx < high) 724 if (max_rate_idx != -1 && max_rate_idx < high)
725 high = IL_RATE_INVALID; 725 high = RATE_INVALID;
726 726
727 /* Collect Measured throughputs of adjacent rates */ 727 /* Collect Measured throughputs of adjacent rates */
728 if (low != IL_RATE_INVALID) 728 if (low != RATE_INVALID)
729 low_tpt = rs_sta->win[low].average_tpt; 729 low_tpt = rs_sta->win[low].average_tpt;
730 730
731 if (high != IL_RATE_INVALID) 731 if (high != RATE_INVALID)
732 high_tpt = rs_sta->win[high].average_tpt; 732 high_tpt = rs_sta->win[high].average_tpt;
733 733
734 spin_unlock_irqrestore(&rs_sta->lock, flags); 734 spin_unlock_irqrestore(&rs_sta->lock, flags);
@@ -736,7 +736,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
736 scale_action = 0; 736 scale_action = 0;
737 737
738 /* Low success ratio , need to drop the rate */ 738 /* Low success ratio , need to drop the rate */
739 if (win->success_ratio < IL_RATE_DECREASE_TH || !current_tpt) { 739 if (win->success_ratio < RATE_DECREASE_TH || !current_tpt) {
740 D_RATE("decrease rate because of low success_ratio\n"); 740 D_RATE("decrease rate because of low success_ratio\n");
741 scale_action = -1; 741 scale_action = -1;
742 /* No throughput measured yet for adjacent rates, 742 /* No throughput measured yet for adjacent rates,
@@ -744,9 +744,9 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
744 } else if (low_tpt == IL_INVALID_VALUE && 744 } else if (low_tpt == IL_INVALID_VALUE &&
745 high_tpt == IL_INVALID_VALUE) { 745 high_tpt == IL_INVALID_VALUE) {
746 746
747 if (high != IL_RATE_INVALID && win->success_ratio >= IL_RATE_INCREASE_TH) 747 if (high != RATE_INVALID && win->success_ratio >= RATE_INCREASE_TH)
748 scale_action = 1; 748 scale_action = 1;
749 else if (low != IL_RATE_INVALID) 749 else if (low != RATE_INVALID)
750 scale_action = 0; 750 scale_action = 0;
751 751
752 /* Both adjacent throughputs are measured, but neither one has 752 /* Both adjacent throughputs are measured, but neither one has
@@ -768,7 +768,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
768 /* High rate has better throughput, Increase 768 /* High rate has better throughput, Increase
769 * rate */ 769 * rate */
770 if (high_tpt > current_tpt && 770 if (high_tpt > current_tpt &&
771 win->success_ratio >= IL_RATE_INCREASE_TH) 771 win->success_ratio >= RATE_INCREASE_TH)
772 scale_action = 1; 772 scale_action = 1;
773 else { 773 else {
774 D_RATE( 774 D_RATE(
@@ -780,7 +780,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
780 D_RATE( 780 D_RATE(
781 "decrease rate because of low tpt\n"); 781 "decrease rate because of low tpt\n");
782 scale_action = -1; 782 scale_action = -1;
783 } else if (win->success_ratio >= IL_RATE_INCREASE_TH) { 783 } else if (win->success_ratio >= RATE_INCREASE_TH) {
784 /* Lower rate has better 784 /* Lower rate has better
785 * throughput,decrease rate */ 785 * throughput,decrease rate */
786 scale_action = 1; 786 scale_action = 1;
@@ -790,8 +790,8 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
790 790
791 /* Sanity check; asked for decrease, but success rate or throughput 791 /* Sanity check; asked for decrease, but success rate or throughput
792 * has been good at old rate. Don't change it. */ 792 * has been good at old rate. Don't change it. */
793 if (scale_action == -1 && low != IL_RATE_INVALID && 793 if (scale_action == -1 && low != RATE_INVALID &&
794 (win->success_ratio > IL_RATE_HIGH_TH || 794 (win->success_ratio > RATE_HIGH_TH ||
795 current_tpt > 100 * rs_sta->expected_tpt[low])) 795 current_tpt > 100 * rs_sta->expected_tpt[low]))
796 scale_action = 0; 796 scale_action = 0;
797 797
@@ -799,13 +799,13 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
799 case -1: 799 case -1:
800 800
801 /* Decrese rate */ 801 /* Decrese rate */
802 if (low != IL_RATE_INVALID) 802 if (low != RATE_INVALID)
803 index = low; 803 index = low;
804 break; 804 break;
805 805
806 case 1: 806 case 1:
807 /* Increase rate */ 807 /* Increase rate */
808 if (high != IL_RATE_INVALID) 808 if (high != RATE_INVALID)
809 index = high; 809 index = high;
810 810
811 break; 811 break;
@@ -860,7 +860,7 @@ static ssize_t il3945_sta_dbgfs_stats_table_read(struct file *file,
860 lq_sta->tx_packets, 860 lq_sta->tx_packets,
861 lq_sta->last_txrate_idx, 861 lq_sta->last_txrate_idx,
862 lq_sta->start_rate, jiffies_to_msecs(lq_sta->flush_time)); 862 lq_sta->start_rate, jiffies_to_msecs(lq_sta->flush_time));
863 for (j = 0; j < IL_RATE_COUNT_3945; j++) { 863 for (j = 0; j < RATE_COUNT_3945; j++) {
864 desc += sprintf(buff+desc, 864 desc += sprintf(buff+desc,
865 "counter=%d success=%d %%=%d\n", 865 "counter=%d success=%d %%=%d\n",
866 lq_sta->win[j].counter, 866 lq_sta->win[j].counter,
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945.c b/drivers/net/wireless/iwlegacy/iwl-3945.c
index fa4c33a36f22..728a90c33183 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945.c
+++ b/drivers/net/wireless/iwlegacy/iwl-3945.c
@@ -52,26 +52,26 @@
52#include "iwl-3945-debugfs.h" 52#include "iwl-3945-debugfs.h"
53 53
54#define IL_DECLARE_RATE_INFO(r, ip, in, rp, rn, pp, np) \ 54#define IL_DECLARE_RATE_INFO(r, ip, in, rp, rn, pp, np) \
55 [IL_RATE_##r##M_INDEX] = { IL_RATE_##r##M_PLCP, \ 55 [RATE_##r##M_INDEX] = { RATE_##r##M_PLCP, \
56 IL_RATE_##r##M_IEEE, \ 56 RATE_##r##M_IEEE, \
57 IL_RATE_##ip##M_INDEX, \ 57 RATE_##ip##M_INDEX, \
58 IL_RATE_##in##M_INDEX, \ 58 RATE_##in##M_INDEX, \
59 IL_RATE_##rp##M_INDEX, \ 59 RATE_##rp##M_INDEX, \
60 IL_RATE_##rn##M_INDEX, \ 60 RATE_##rn##M_INDEX, \
61 IL_RATE_##pp##M_INDEX, \ 61 RATE_##pp##M_INDEX, \
62 IL_RATE_##np##M_INDEX, \ 62 RATE_##np##M_INDEX, \
63 IL_RATE_##r##M_INDEX_TABLE, \ 63 RATE_##r##M_INDEX_TABLE, \
64 IL_RATE_##ip##M_INDEX_TABLE } 64 RATE_##ip##M_INDEX_TABLE }
65 65
66/* 66/*
67 * Parameter order: 67 * Parameter order:
68 * rate, prev rate, next rate, prev tgg rate, next tgg rate 68 * rate, prev rate, next rate, prev tgg rate, next tgg rate
69 * 69 *
70 * If there isn't a valid next or previous rate then INV is used which 70 * If there isn't a valid next or previous rate then INV is used which
71 * maps to IL_RATE_INVALID 71 * maps to RATE_INVALID
72 * 72 *
73 */ 73 */
74const struct il3945_rate_info il3945_rates[IL_RATE_COUNT_3945] = { 74const struct il3945_rate_info il3945_rates[RATE_COUNT_3945] = {
75 IL_DECLARE_RATE_INFO(1, INV, 2, INV, 2, INV, 2), /* 1mbps */ 75 IL_DECLARE_RATE_INFO(1, INV, 2, INV, 2, INV, 2), /* 1mbps */
76 IL_DECLARE_RATE_INFO(2, 1, 5, 1, 5, 1, 5), /* 2mbps */ 76 IL_DECLARE_RATE_INFO(2, 1, 5, 1, 5, 1, 5), /* 2mbps */
77 IL_DECLARE_RATE_INFO(5, 2, 6, 2, 11, 2, 11), /*5.5mbps */ 77 IL_DECLARE_RATE_INFO(5, 2, 6, 2, 11, 2, 11), /*5.5mbps */
@@ -90,7 +90,7 @@ static inline u8 il3945_get_prev_ieee_rate(u8 rate_index)
90{ 90{
91 u8 rate = il3945_rates[rate_index].prev_ieee; 91 u8 rate = il3945_rates[rate_index].prev_ieee;
92 92
93 if (rate == IL_RATE_INVALID) 93 if (rate == RATE_INVALID)
94 rate = rate_index; 94 rate = rate_index;
95 return rate; 95 return rate;
96} 96}
@@ -194,7 +194,7 @@ static int il3945_hwrate_to_plcp_idx(u8 plcp)
194{ 194{
195 int idx; 195 int idx;
196 196
197 for (idx = 0; idx < IL_RATE_COUNT_3945; idx++) 197 for (idx = 0; idx < RATE_COUNT_3945; idx++)
198 if (il3945_rates[idx].plcp == plcp) 198 if (il3945_rates[idx].plcp == plcp)
199 return idx; 199 return idx;
200 return -1; 200 return -1;
@@ -246,16 +246,16 @@ int il3945_rs_next_rate(struct il_priv *il, int rate)
246 246
247 switch (il->band) { 247 switch (il->band) {
248 case IEEE80211_BAND_5GHZ: 248 case IEEE80211_BAND_5GHZ:
249 if (rate == IL_RATE_12M_INDEX) 249 if (rate == RATE_12M_INDEX)
250 next_rate = IL_RATE_9M_INDEX; 250 next_rate = RATE_9M_INDEX;
251 else if (rate == IL_RATE_6M_INDEX) 251 else if (rate == RATE_6M_INDEX)
252 next_rate = IL_RATE_6M_INDEX; 252 next_rate = RATE_6M_INDEX;
253 break; 253 break;
254 case IEEE80211_BAND_2GHZ: 254 case IEEE80211_BAND_2GHZ:
255 if (!(il->_3945.sta_supp_rates & IL_OFDM_RATES_MASK) && 255 if (!(il->_3945.sta_supp_rates & IL_OFDM_RATES_MASK) &&
256 il_is_associated(il)) { 256 il_is_associated(il)) {
257 if (rate == IL_RATE_11M_INDEX) 257 if (rate == RATE_11M_INDEX)
258 next_rate = IL_RATE_5M_INDEX; 258 next_rate = RATE_5M_INDEX;
259 } 259 }
260 break; 260 break;
261 261
@@ -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, IL_RATE_COUNT_3945); 678 u16 rate_index = 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;
@@ -689,7 +689,7 @@ void il3945_hw_build_tx_cmd_rate(struct il_priv *il,
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
691 * in this running context */ 691 * in this running context */
692 rate_mask = IL_RATES_MASK_3945; 692 rate_mask = RATES_MASK_3945;
693 693
694 /* Set retry limit on DATA packets and Probe Responses*/ 694 /* Set retry limit on DATA packets and Probe Responses*/
695 if (ieee80211_is_probe_resp(fc)) 695 if (ieee80211_is_probe_resp(fc))
@@ -1330,7 +1330,7 @@ static void il3945_hw_reg_set_scan_power(struct il_priv *il, u32 scan_tbl_index,
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
1332 * based on eeprom channel data) for this channel. */ 1332 * based on eeprom channel data) for this channel. */
1333 power = min(ch_info->scan_power, clip_pwrs[IL_RATE_6M_INDEX_TABLE]); 1333 power = min(ch_info->scan_power, clip_pwrs[RATE_6M_INDEX_TABLE]);
1334 1334
1335 power = min(power, il->tx_power_user_lmt); 1335 power = min(power, il->tx_power_user_lmt);
1336 scan_power_info->requested_power = power; 1336 scan_power_info->requested_power = power;
@@ -1342,7 +1342,7 @@ static void il3945_hw_reg_set_scan_power(struct il_priv *il, u32 scan_tbl_index,
1342 * *index*. */ 1342 * *index*. */
1343 power_index = ch_info->power_info[rate_index].power_table_index 1343 power_index = ch_info->power_info[rate_index].power_table_index
1344 - (power - ch_info->power_info 1344 - (power - ch_info->power_info
1345 [IL_RATE_6M_INDEX_TABLE].requested_power) * 2; 1345 [RATE_6M_INDEX_TABLE].requested_power) * 2;
1346 1346
1347 /* store reference index that we use when adjusting *all* scan 1347 /* store reference index 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
@@ -1466,7 +1466,7 @@ static int il3945_hw_reg_set_new_power(struct il_priv *il,
1466 power_info = ch_info->power_info; 1466 power_info = ch_info->power_info;
1467 1467
1468 /* update OFDM Txpower settings */ 1468 /* update OFDM Txpower settings */
1469 for (i = IL_RATE_6M_INDEX_TABLE; i <= IL_RATE_54M_INDEX_TABLE; 1469 for (i = RATE_6M_INDEX_TABLE; i <= RATE_54M_INDEX_TABLE;
1470 i++, ++power_info) { 1470 i++, ++power_info) {
1471 int delta_idx; 1471 int delta_idx;
1472 1472
@@ -1490,14 +1490,14 @@ static int il3945_hw_reg_set_new_power(struct il_priv *il,
1490 * ... all CCK power settings for a given channel are the *same*. */ 1490 * ... all CCK power settings for a given channel are the *same*. */
1491 if (power_changed) { 1491 if (power_changed) {
1492 power = 1492 power =
1493 ch_info->power_info[IL_RATE_12M_INDEX_TABLE]. 1493 ch_info->power_info[RATE_12M_INDEX_TABLE].
1494 requested_power + IL_CCK_FROM_OFDM_POWER_DIFF; 1494 requested_power + IL_CCK_FROM_OFDM_POWER_DIFF;
1495 1495
1496 /* do all CCK rates' il3945_channel_power_info structures */ 1496 /* do all CCK rates' il3945_channel_power_info structures */
1497 for (i = IL_RATE_1M_INDEX_TABLE; i <= IL_RATE_11M_INDEX_TABLE; i++) { 1497 for (i = RATE_1M_INDEX_TABLE; i <= RATE_11M_INDEX_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_index =
1500 ch_info->power_info[IL_RATE_12M_INDEX_TABLE]. 1500 ch_info->power_info[RATE_12M_INDEX_TABLE].
1501 base_power_index + IL_CCK_FROM_OFDM_INDEX_DIFF; 1501 base_power_index + IL_CCK_FROM_OFDM_INDEX_DIFF;
1502 ++power_info; 1502 ++power_info;
1503 } 1503 }
@@ -1574,7 +1574,7 @@ static int il3945_hw_reg_comp_txpower_temp(struct il_priv *il)
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 < IL_RATE_COUNT_3945; 1577 for (rate_index = 0; rate_index < RATE_COUNT_3945;
1578 rate_index++) { 1578 rate_index++) {
1579 int power_idx = 1579 int power_idx =
1580 ch_info->power_info[rate_index].base_power_index; 1580 ch_info->power_info[rate_index].base_power_index;
@@ -1597,7 +1597,7 @@ static int il3945_hw_reg_comp_txpower_temp(struct il_priv *il)
1597 for (scan_tbl_index = 0; 1597 for (scan_tbl_index = 0;
1598 scan_tbl_index < IL_NUM_SCAN_RATES; scan_tbl_index++) { 1598 scan_tbl_index < IL_NUM_SCAN_RATES; scan_tbl_index++) {
1599 s32 actual_index = (scan_tbl_index == 0) ? 1599 s32 actual_index = (scan_tbl_index == 0) ?
1600 IL_RATE_1M_INDEX_TABLE : IL_RATE_6M_INDEX_TABLE; 1600 RATE_1M_INDEX_TABLE : RATE_6M_INDEX_TABLE;
1601 il3945_hw_reg_set_scan_power(il, scan_tbl_index, 1601 il3945_hw_reg_set_scan_power(il, scan_tbl_index,
1602 actual_index, clip_pwrs, 1602 actual_index, clip_pwrs,
1603 ch_info, a_band); 1603 ch_info, a_band);
@@ -2010,21 +2010,21 @@ static void il3945_hw_reg_init_channel_groups(struct il_priv *il)
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_index = 0;
2013 rate_index < IL_RATE_COUNT_3945; rate_index++, clip_pwrs++) { 2013 rate_index < RATE_COUNT_3945; rate_index++, clip_pwrs++) {
2014 switch (rate_index) { 2014 switch (rate_index) {
2015 case IL_RATE_36M_INDEX_TABLE: 2015 case RATE_36M_INDEX_TABLE:
2016 if (i == 0) /* B/G */ 2016 if (i == 0) /* B/G */
2017 *clip_pwrs = satur_pwr; 2017 *clip_pwrs = satur_pwr;
2018 else /* A */ 2018 else /* A */
2019 *clip_pwrs = satur_pwr - 5; 2019 *clip_pwrs = satur_pwr - 5;
2020 break; 2020 break;
2021 case IL_RATE_48M_INDEX_TABLE: 2021 case RATE_48M_INDEX_TABLE:
2022 if (i == 0) 2022 if (i == 0)
2023 *clip_pwrs = satur_pwr - 7; 2023 *clip_pwrs = satur_pwr - 7;
2024 else 2024 else
2025 *clip_pwrs = satur_pwr - 10; 2025 *clip_pwrs = satur_pwr - 10;
2026 break; 2026 break;
2027 case IL_RATE_54M_INDEX_TABLE: 2027 case RATE_54M_INDEX_TABLE:
2028 if (i == 0) 2028 if (i == 0)
2029 *clip_pwrs = satur_pwr - 9; 2029 *clip_pwrs = satur_pwr - 9;
2030 else 2030 else
@@ -2139,7 +2139,7 @@ int il3945_txpower_set_from_eeprom(struct il_priv *il)
2139 } 2139 }
2140 2140
2141 /* set tx power for CCK rates, based on OFDM 12 Mbit settings*/ 2141 /* set tx power for CCK rates, based on OFDM 12 Mbit settings*/
2142 pwr_info = &ch_info->power_info[IL_RATE_12M_INDEX_TABLE]; 2142 pwr_info = &ch_info->power_info[RATE_12M_INDEX_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_index = pwr_info->power_table_index +
@@ -2169,7 +2169,7 @@ int il3945_txpower_set_from_eeprom(struct il_priv *il)
2169 for (scan_tbl_index = 0; 2169 for (scan_tbl_index = 0;
2170 scan_tbl_index < IL_NUM_SCAN_RATES; scan_tbl_index++) { 2170 scan_tbl_index < IL_NUM_SCAN_RATES; scan_tbl_index++) {
2171 s32 actual_index = (scan_tbl_index == 0) ? 2171 s32 actual_index = (scan_tbl_index == 0) ?
2172 IL_RATE_1M_INDEX_TABLE : IL_RATE_6M_INDEX_TABLE; 2172 RATE_1M_INDEX_TABLE : RATE_6M_INDEX_TABLE;
2173 il3945_hw_reg_set_scan_power(il, scan_tbl_index, 2173 il3945_hw_reg_set_scan_power(il, scan_tbl_index,
2174 actual_index, clip_pwrs, ch_info, a_band); 2174 actual_index, clip_pwrs, ch_info, a_band);
2175 } 2175 }
@@ -2289,7 +2289,7 @@ static int il3945_manage_ibss_station(struct il_priv *il,
2289 2289
2290 il3945_sync_sta(il, vif_priv->ibss_bssid_sta_id, 2290 il3945_sync_sta(il, vif_priv->ibss_bssid_sta_id,
2291 (il->band == IEEE80211_BAND_5GHZ) ? 2291 (il->band == IEEE80211_BAND_5GHZ) ?
2292 IL_RATE_6M_PLCP : IL_RATE_1M_PLCP); 2292 RATE_6M_PLCP : RATE_1M_PLCP);
2293 il3945_rate_scale_init(il->hw, vif_priv->ibss_bssid_sta_id); 2293 il3945_rate_scale_init(il->hw, vif_priv->ibss_bssid_sta_id);
2294 2294
2295 return 0; 2295 return 0;
@@ -2326,17 +2326,17 @@ int il3945_init_hw_rate_table(struct il_priv *il)
2326 D_RATE("Select A mode rate scale\n"); 2326 D_RATE("Select A mode rate scale\n");
2327 /* If one of the following CCK rates is used, 2327 /* If one of the following CCK rates is used,
2328 * have it fall back to the 6M OFDM rate */ 2328 * have it fall back to the 6M OFDM rate */
2329 for (i = IL_RATE_1M_INDEX_TABLE; 2329 for (i = RATE_1M_INDEX_TABLE;
2330 i <= IL_RATE_11M_INDEX_TABLE; i++) 2330 i <= RATE_11M_INDEX_TABLE; i++)
2331 table[i].next_rate_index = 2331 table[i].next_rate_index =
2332 il3945_rates[IL_FIRST_OFDM_RATE].table_rs_index; 2332 il3945_rates[IL_FIRST_OFDM_RATE].table_rs_index;
2333 2333
2334 /* Don't fall back to CCK rates */ 2334 /* Don't fall back to CCK rates */
2335 table[IL_RATE_12M_INDEX_TABLE].next_rate_index = 2335 table[RATE_12M_INDEX_TABLE].next_rate_index =
2336 IL_RATE_9M_INDEX_TABLE; 2336 RATE_9M_INDEX_TABLE;
2337 2337
2338 /* Don't drop out of OFDM rates */ 2338 /* Don't drop out of OFDM rates */
2339 table[IL_RATE_6M_INDEX_TABLE].next_rate_index = 2339 table[RATE_6M_INDEX_TABLE].next_rate_index =
2340 il3945_rates[IL_FIRST_OFDM_RATE].table_rs_index; 2340 il3945_rates[IL_FIRST_OFDM_RATE].table_rs_index;
2341 break; 2341 break;
2342 2342
@@ -2349,14 +2349,14 @@ int il3945_init_hw_rate_table(struct il_priv *il)
2349 il_is_associated(il)) { 2349 il_is_associated(il)) {
2350 2350
2351 index = IL_FIRST_CCK_RATE; 2351 index = IL_FIRST_CCK_RATE;
2352 for (i = IL_RATE_6M_INDEX_TABLE; 2352 for (i = RATE_6M_INDEX_TABLE;
2353 i <= IL_RATE_54M_INDEX_TABLE; i++) 2353 i <= RATE_54M_INDEX_TABLE; i++)
2354 table[i].next_rate_index = 2354 table[i].next_rate_index =
2355 il3945_rates[index].table_rs_index; 2355 il3945_rates[index].table_rs_index;
2356 2356
2357 index = IL_RATE_11M_INDEX_TABLE; 2357 index = RATE_11M_INDEX_TABLE;
2358 /* CCK shouldn't fall back to OFDM... */ 2358 /* CCK shouldn't fall back to OFDM... */
2359 table[index].next_rate_index = IL_RATE_5M_INDEX_TABLE; 2359 table[index].next_rate_index = RATE_5M_INDEX_TABLE;
2360 } 2360 }
2361 break; 2361 break;
2362 2362
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945.h b/drivers/net/wireless/iwlegacy/iwl-3945.h
index 967e73357e9c..80fcbf8bbc5b 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945.h
+++ b/drivers/net/wireless/iwlegacy/iwl-3945.h
@@ -96,7 +96,7 @@ struct il3945_rs_sta {
96 u8 flush_pending; 96 u8 flush_pending;
97 u8 start_rate; 97 u8 start_rate;
98 struct timer_list rate_scale_flush; 98 struct timer_list rate_scale_flush;
99 struct il3945_rate_scale_data win[IL_RATE_COUNT_3945]; 99 struct il3945_rate_scale_data win[RATE_COUNT_3945];
100#ifdef CONFIG_MAC80211_DEBUGFS 100#ifdef CONFIG_MAC80211_DEBUGFS
101 struct dentry *rs_sta_dbgfs_stats_table_file; 101 struct dentry *rs_sta_dbgfs_stats_table_file;
102#endif 102#endif
@@ -300,7 +300,7 @@ int il3945_request_scan(struct il_priv *il, struct ieee80211_vif *vif);
300void il3945_post_scan(struct il_priv *il); 300void il3945_post_scan(struct il_priv *il);
301 301
302/* rates */ 302/* rates */
303extern const struct il3945_rate_info il3945_rates[IL_RATE_COUNT_3945]; 303extern const struct il3945_rate_info il3945_rates[RATE_COUNT_3945];
304 304
305/* Requires full declaration of il_priv before including */ 305/* Requires full declaration of il_priv before including */
306#include "iwl-io.h" 306#include "iwl-io.h"
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
index 57fc190ce675..ee04977c0113 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c
@@ -423,7 +423,7 @@ int il4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band)
423 } else { 423 } else {
424 if (band == IEEE80211_BAND_5GHZ) 424 if (band == IEEE80211_BAND_5GHZ)
425 band_offset = IL_FIRST_OFDM_RATE; 425 band_offset = IL_FIRST_OFDM_RATE;
426 for (idx = band_offset; idx < IL_RATE_COUNT_LEGACY; idx++) 426 for (idx = band_offset; idx < RATE_COUNT_LEGACY; idx++)
427 if (il_rates[idx].plcp == (rate_n_flags & 0xFF)) 427 if (il_rates[idx].plcp == (rate_n_flags & 0xFF))
428 return idx - band_offset; 428 return idx - band_offset;
429 } 429 }
@@ -870,14 +870,14 @@ int il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif)
870 RXON_FLG_CHANNEL_MODE_MSK) 870 RXON_FLG_CHANNEL_MODE_MSK)
871 >> RXON_FLG_CHANNEL_MODE_POS; 871 >> RXON_FLG_CHANNEL_MODE_POS;
872 if (chan_mod == CHANNEL_MODE_PURE_40) { 872 if (chan_mod == CHANNEL_MODE_PURE_40) {
873 rate = IL_RATE_6M_PLCP; 873 rate = RATE_6M_PLCP;
874 } else { 874 } else {
875 rate = IL_RATE_1M_PLCP; 875 rate = RATE_1M_PLCP;
876 rate_flags = RATE_MCS_CCK_MSK; 876 rate_flags = RATE_MCS_CCK_MSK;
877 } 877 }
878 break; 878 break;
879 case IEEE80211_BAND_5GHZ: 879 case IEEE80211_BAND_5GHZ:
880 rate = IL_RATE_6M_PLCP; 880 rate = RATE_6M_PLCP;
881 break; 881 break;
882 default: 882 default:
883 IL_WARN("Invalid scan band\n"); 883 IL_WARN("Invalid scan band\n");
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
index 5d88a452e1a3..e31ee20b06fc 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
@@ -46,23 +46,23 @@
46#define IL_NUMBER_TRY 1 46#define IL_NUMBER_TRY 1
47#define IL_HT_NUMBER_TRY 3 47#define IL_HT_NUMBER_TRY 3
48 48
49#define IL_RATE_MAX_WINDOW 62 /* # tx in history win */ 49#define RATE_MAX_WINDOW 62 /* # tx in history win */
50#define IL_RATE_MIN_FAILURE_TH 6 /* min failures to calc tpt */ 50#define RATE_MIN_FAILURE_TH 6 /* min failures to calc tpt */
51#define IL_RATE_MIN_SUCCESS_TH 8 /* min successes to calc tpt */ 51#define RATE_MIN_SUCCESS_TH 8 /* min successes to calc tpt */
52 52
53/* max allowed rate miss before sync LQ cmd */ 53/* max allowed rate miss before sync LQ cmd */
54#define IL_MISSED_RATE_MAX 15 54#define IL_MISSED_RATE_MAX 15
55/* max time to accum history 2 seconds */ 55/* max time to accum history 2 seconds */
56#define IL_RATE_SCALE_FLUSH_INTVL (3*HZ) 56#define RATE_SCALE_FLUSH_INTVL (3*HZ)
57 57
58static u8 rs_ht_to_legacy[] = { 58static u8 rs_ht_to_legacy[] = {
59 IL_RATE_6M_INDEX, IL_RATE_6M_INDEX, 59 RATE_6M_INDEX, RATE_6M_INDEX,
60 IL_RATE_6M_INDEX, IL_RATE_6M_INDEX, 60 RATE_6M_INDEX, RATE_6M_INDEX,
61 IL_RATE_6M_INDEX, 61 RATE_6M_INDEX,
62 IL_RATE_6M_INDEX, IL_RATE_9M_INDEX, 62 RATE_6M_INDEX, RATE_9M_INDEX,
63 IL_RATE_12M_INDEX, IL_RATE_18M_INDEX, 63 RATE_12M_INDEX, RATE_18M_INDEX,
64 IL_RATE_24M_INDEX, IL_RATE_36M_INDEX, 64 RATE_24M_INDEX, RATE_36M_INDEX,
65 IL_RATE_48M_INDEX, IL_RATE_54M_INDEX 65 RATE_48M_INDEX, RATE_54M_INDEX
66}; 66};
67 67
68static const u8 ant_toggle_lookup[] = { 68static const u8 ant_toggle_lookup[] = {
@@ -77,26 +77,26 @@ static const u8 ant_toggle_lookup[] = {
77}; 77};
78 78
79#define IL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \ 79#define IL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \
80 [IL_RATE_##r##M_INDEX] = { IL_RATE_##r##M_PLCP, \ 80 [RATE_##r##M_INDEX] = { RATE_##r##M_PLCP, \
81 IL_RATE_SISO_##s##M_PLCP, \ 81 RATE_SISO_##s##M_PLCP, \
82 IL_RATE_MIMO2_##s##M_PLCP,\ 82 RATE_MIMO2_##s##M_PLCP,\
83 IL_RATE_##r##M_IEEE, \ 83 RATE_##r##M_IEEE, \
84 IL_RATE_##ip##M_INDEX, \ 84 RATE_##ip##M_INDEX, \
85 IL_RATE_##in##M_INDEX, \ 85 RATE_##in##M_INDEX, \
86 IL_RATE_##rp##M_INDEX, \ 86 RATE_##rp##M_INDEX, \
87 IL_RATE_##rn##M_INDEX, \ 87 RATE_##rn##M_INDEX, \
88 IL_RATE_##pp##M_INDEX, \ 88 RATE_##pp##M_INDEX, \
89 IL_RATE_##np##M_INDEX } 89 RATE_##np##M_INDEX }
90 90
91/* 91/*
92 * Parameter order: 92 * Parameter order:
93 * rate, ht rate, prev rate, next rate, prev tgg rate, next tgg rate 93 * rate, ht rate, prev rate, next rate, prev tgg rate, next tgg rate
94 * 94 *
95 * If there isn't a valid next or previous rate then INV is used which 95 * If there isn't a valid next or previous rate then INV is used which
96 * maps to IL_RATE_INVALID 96 * maps to RATE_INVALID
97 * 97 *
98 */ 98 */
99const struct il_rate_info il_rates[IL_RATE_COUNT] = { 99const struct il_rate_info il_rates[RATE_COUNT] = {
100 IL_DECLARE_RATE_INFO(1, INV, INV, 2, INV, 2, INV, 2), /* 1mbps */ 100 IL_DECLARE_RATE_INFO(1, INV, INV, 2, INV, 2, INV, 2), /* 1mbps */
101 IL_DECLARE_RATE_INFO(2, INV, 1, 5, 1, 5, 1, 5), /* 2mbps */ 101 IL_DECLARE_RATE_INFO(2, INV, 1, 5, 1, 5, 1, 5), /* 2mbps */
102 IL_DECLARE_RATE_INFO(5, INV, 2, 6, 2, 11, 2, 11), /*5.5mbps */ 102 IL_DECLARE_RATE_INFO(5, INV, 2, 6, 2, 11, 2, 11), /*5.5mbps */
@@ -120,12 +120,12 @@ static int il4965_hwrate_to_plcp_idx(u32 rate_n_flags)
120 if (rate_n_flags & RATE_MCS_HT_MSK) { 120 if (rate_n_flags & RATE_MCS_HT_MSK) {
121 idx = (rate_n_flags & 0xff); 121 idx = (rate_n_flags & 0xff);
122 122
123 if (idx >= IL_RATE_MIMO2_6M_PLCP) 123 if (idx >= RATE_MIMO2_6M_PLCP)
124 idx = idx - IL_RATE_MIMO2_6M_PLCP; 124 idx = idx - RATE_MIMO2_6M_PLCP;
125 125
126 idx += IL_FIRST_OFDM_RATE; 126 idx += IL_FIRST_OFDM_RATE;
127 /* skip 9M not supported in ht*/ 127 /* skip 9M not supported in ht*/
128 if (idx >= IL_RATE_9M_INDEX) 128 if (idx >= RATE_9M_INDEX)
129 idx += 1; 129 idx += 1;
130 if (idx >= IL_FIRST_OFDM_RATE && idx <= IL_LAST_OFDM_RATE) 130 if (idx >= IL_FIRST_OFDM_RATE && idx <= IL_LAST_OFDM_RATE)
131 return idx; 131 return idx;
@@ -169,32 +169,32 @@ static void il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta,
169 * (2.4 GHz) band. 169 * (2.4 GHz) band.
170 */ 170 */
171 171
172static s32 expected_tpt_legacy[IL_RATE_COUNT] = { 172static s32 expected_tpt_legacy[RATE_COUNT] = {
173 7, 13, 35, 58, 40, 57, 72, 98, 121, 154, 177, 186, 0 173 7, 13, 35, 58, 40, 57, 72, 98, 121, 154, 177, 186, 0
174}; 174};
175 175
176static s32 expected_tpt_siso20MHz[4][IL_RATE_COUNT] = { 176static s32 expected_tpt_siso20MHz[4][RATE_COUNT] = {
177 {0, 0, 0, 0, 42, 0, 76, 102, 124, 158, 183, 193, 202}, /* Norm */ 177 {0, 0, 0, 0, 42, 0, 76, 102, 124, 158, 183, 193, 202}, /* Norm */
178 {0, 0, 0, 0, 46, 0, 82, 110, 132, 167, 192, 202, 210}, /* SGI */ 178 {0, 0, 0, 0, 46, 0, 82, 110, 132, 167, 192, 202, 210}, /* SGI */
179 {0, 0, 0, 0, 48, 0, 93, 135, 176, 251, 319, 351, 381}, /* AGG */ 179 {0, 0, 0, 0, 48, 0, 93, 135, 176, 251, 319, 351, 381}, /* AGG */
180 {0, 0, 0, 0, 53, 0, 102, 149, 193, 275, 348, 381, 413}, /* AGG+SGI */ 180 {0, 0, 0, 0, 53, 0, 102, 149, 193, 275, 348, 381, 413}, /* AGG+SGI */
181}; 181};
182 182
183static s32 expected_tpt_siso40MHz[4][IL_RATE_COUNT] = { 183static s32 expected_tpt_siso40MHz[4][RATE_COUNT] = {
184 {0, 0, 0, 0, 77, 0, 127, 160, 184, 220, 242, 250, 257}, /* Norm */ 184 {0, 0, 0, 0, 77, 0, 127, 160, 184, 220, 242, 250, 257}, /* Norm */
185 {0, 0, 0, 0, 83, 0, 135, 169, 193, 229, 250, 257, 264}, /* SGI */ 185 {0, 0, 0, 0, 83, 0, 135, 169, 193, 229, 250, 257, 264}, /* SGI */
186 {0, 0, 0, 0, 96, 0, 182, 259, 328, 451, 553, 598, 640}, /* AGG */ 186 {0, 0, 0, 0, 96, 0, 182, 259, 328, 451, 553, 598, 640}, /* AGG */
187 {0, 0, 0, 0, 106, 0, 199, 282, 357, 487, 593, 640, 683}, /* AGG+SGI */ 187 {0, 0, 0, 0, 106, 0, 199, 282, 357, 487, 593, 640, 683}, /* AGG+SGI */
188}; 188};
189 189
190static s32 expected_tpt_mimo2_20MHz[4][IL_RATE_COUNT] = { 190static s32 expected_tpt_mimo2_20MHz[4][RATE_COUNT] = {
191 {0, 0, 0, 0, 74, 0, 123, 155, 179, 213, 235, 243, 250}, /* Norm */ 191 {0, 0, 0, 0, 74, 0, 123, 155, 179, 213, 235, 243, 250}, /* Norm */
192 {0, 0, 0, 0, 81, 0, 131, 164, 187, 221, 242, 250, 256}, /* SGI */ 192 {0, 0, 0, 0, 81, 0, 131, 164, 187, 221, 242, 250, 256}, /* SGI */
193 {0, 0, 0, 0, 92, 0, 175, 250, 317, 436, 534, 578, 619}, /* AGG */ 193 {0, 0, 0, 0, 92, 0, 175, 250, 317, 436, 534, 578, 619}, /* AGG */
194 {0, 0, 0, 0, 102, 0, 192, 273, 344, 470, 573, 619, 660}, /* AGG+SGI*/ 194 {0, 0, 0, 0, 102, 0, 192, 273, 344, 470, 573, 619, 660}, /* AGG+SGI*/
195}; 195};
196 196
197static s32 expected_tpt_mimo2_40MHz[4][IL_RATE_COUNT] = { 197static s32 expected_tpt_mimo2_40MHz[4][RATE_COUNT] = {
198 {0, 0, 0, 0, 123, 0, 182, 214, 235, 264, 279, 285, 289}, /* Norm */ 198 {0, 0, 0, 0, 123, 0, 182, 214, 235, 264, 279, 285, 289}, /* Norm */
199 {0, 0, 0, 0, 131, 0, 191, 222, 242, 270, 284, 289, 293}, /* SGI */ 199 {0, 0, 0, 0, 131, 0, 191, 222, 242, 270, 284, 289, 293}, /* SGI */
200 {0, 0, 0, 0, 180, 0, 327, 446, 545, 708, 828, 878, 922}, /* AGG */ 200 {0, 0, 0, 0, 180, 0, 327, 446, 545, 708, 828, 878, 922}, /* AGG */
@@ -202,7 +202,7 @@ static s32 expected_tpt_mimo2_40MHz[4][IL_RATE_COUNT] = {
202}; 202};
203 203
204/* mbps, mcs */ 204/* mbps, mcs */
205static const struct il_rate_mcs_info il_rate_mcs[IL_RATE_COUNT] = { 205static const struct il_rate_mcs_info il_rate_mcs[RATE_COUNT] = {
206 { "1", "BPSK DSSS"}, 206 { "1", "BPSK DSSS"},
207 { "2", "QPSK DSSS"}, 207 { "2", "QPSK DSSS"},
208 {"5.5", "BPSK CCK"}, 208 {"5.5", "BPSK CCK"},
@@ -418,10 +418,10 @@ static int il4965_rs_collect_tx_data(struct il_scale_tbl_info *tbl,
418 int scale_index, int attempts, int successes) 418 int scale_index, 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) << (IL_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 >= IL_RATE_COUNT) 424 if (scale_index < 0 || scale_index >= 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 */
@@ -439,10 +439,10 @@ static int il4965_rs_collect_tx_data(struct il_scale_tbl_info *tbl,
439 * we keep these bitmaps!). 439 * we keep these bitmaps!).
440 */ 440 */
441 while (attempts > 0) { 441 while (attempts > 0) {
442 if (win->counter >= IL_RATE_MAX_WINDOW) { 442 if (win->counter >= RATE_MAX_WINDOW) {
443 443
444 /* remove earliest */ 444 /* remove earliest */
445 win->counter = IL_RATE_MAX_WINDOW - 1; 445 win->counter = RATE_MAX_WINDOW - 1;
446 446
447 if (win->data & mask) { 447 if (win->data & mask) {
448 win->data &= ~mask; 448 win->data &= ~mask;
@@ -476,8 +476,8 @@ static int il4965_rs_collect_tx_data(struct il_scale_tbl_info *tbl,
476 fail_count = win->counter - win->success_counter; 476 fail_count = win->counter - win->success_counter;
477 477
478 /* Calculate average throughput, if we have enough history. */ 478 /* Calculate average throughput, if we have enough history. */
479 if (fail_count >= IL_RATE_MIN_FAILURE_TH || 479 if (fail_count >= RATE_MIN_FAILURE_TH ||
480 win->success_counter >= IL_RATE_MIN_SUCCESS_TH) 480 win->success_counter >= RATE_MIN_SUCCESS_TH)
481 win->average_tpt = (win->success_ratio * tpt + 64) / 128; 481 win->average_tpt = (win->success_ratio * tpt + 64) / 128;
482 else 482 else
483 win->average_tpt = IL_INVALID_VALUE; 483 win->average_tpt = IL_INVALID_VALUE;
@@ -557,7 +557,7 @@ static int il4965_rs_get_tbl_info_from_mcs(const u32 rate_n_flags,
557 memset(tbl, 0, sizeof(struct il_scale_tbl_info)); 557 memset(tbl, 0, sizeof(struct il_scale_tbl_info));
558 *rate_idx = il4965_hwrate_to_plcp_idx(rate_n_flags); 558 *rate_idx = il4965_hwrate_to_plcp_idx(rate_n_flags);
559 559
560 if (*rate_idx == IL_RATE_INVALID) { 560 if (*rate_idx == RATE_INVALID) {
561 *rate_idx = -1; 561 *rate_idx = -1;
562 return -EINVAL; 562 return -EINVAL;
563 } 563 }
@@ -591,7 +591,7 @@ static int il4965_rs_get_tbl_info_from_mcs(const u32 rate_n_flags,
591 mcs = il4965_rs_extract_rate(rate_n_flags); 591 mcs = il4965_rs_extract_rate(rate_n_flags);
592 592
593 /* SISO */ 593 /* SISO */
594 if (mcs <= IL_RATE_SISO_60M_PLCP) { 594 if (mcs <= RATE_SISO_60M_PLCP) {
595 if (il4965_num_of_ant == 1) 595 if (il4965_num_of_ant == 1)
596 tbl->lq_type = LQ_SISO; /*else NONE*/ 596 tbl->lq_type = LQ_SISO; /*else NONE*/
597 /* MIMO2 */ 597 /* MIMO2 */
@@ -669,8 +669,8 @@ static 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 index, u16 rate_mask,
670 int rate_type) 670 int rate_type)
671{ 671{
672 u8 high = IL_RATE_INVALID; 672 u8 high = RATE_INVALID;
673 u8 low = IL_RATE_INVALID; 673 u8 low = RATE_INVALID;
674 674
675 /* 802.11A or ht walks to the next literal adjacent rate in 675 /* 802.11A or ht walks to the next literal adjacent rate in
676 * the rate table */ 676 * the rate table */
@@ -689,7 +689,7 @@ il4965_rs_get_adjacent_rate(struct il_priv *il, u8 index, u16 rate_mask,
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 = index + 1;
692 for (mask = (1 << i); i < IL_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;
695 break; 695 break;
@@ -700,9 +700,9 @@ il4965_rs_get_adjacent_rate(struct il_priv *il, u8 index, u16 rate_mask,
700 } 700 }
701 701
702 low = index; 702 low = index;
703 while (low != IL_RATE_INVALID) { 703 while (low != RATE_INVALID) {
704 low = il_rates[low].prev_rs; 704 low = il_rates[low].prev_rs;
705 if (low == IL_RATE_INVALID) 705 if (low == RATE_INVALID)
706 break; 706 break;
707 if (rate_mask & (1 << low)) 707 if (rate_mask & (1 << low))
708 break; 708 break;
@@ -710,9 +710,9 @@ il4965_rs_get_adjacent_rate(struct il_priv *il, u8 index, u16 rate_mask,
710 } 710 }
711 711
712 high = index; 712 high = index;
713 while (high != IL_RATE_INVALID) { 713 while (high != RATE_INVALID) {
714 high = il_rates[high].next_rs; 714 high = il_rates[high].next_rs;
715 if (high == IL_RATE_INVALID) 715 if (high == RATE_INVALID)
716 break; 716 break;
717 if (rate_mask & (1 << high)) 717 if (rate_mask & (1 << high))
718 break; 718 break;
@@ -776,7 +776,7 @@ static u32 il4965_rs_get_lower_rate(struct il_lq_sta *lq_sta,
776 tbl->lq_type); 776 tbl->lq_type);
777 low = high_low & 0xff; 777 low = high_low & 0xff;
778 778
779 if (low == IL_RATE_INVALID) 779 if (low == RATE_INVALID)
780 low = scale_index; 780 low = scale_index;
781 781
782out: 782out:
@@ -856,7 +856,7 @@ il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband,
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_index &= RATE_MCS_CODE_MSK; /* Remove # of streams */
859 if (mac_index >= (IL_RATE_9M_INDEX - IL_FIRST_OFDM_RATE)) 859 if (mac_index >= (RATE_9M_INDEX - IL_FIRST_OFDM_RATE))
860 mac_index++; 860 mac_index++;
861 /* 861 /*
862 * mac80211 HT index is always zero-indexed; we need to move 862 * mac80211 HT index is always zero-indexed; we need to move
@@ -1023,7 +1023,7 @@ static void il4965_rs_set_expected_tpt_table(struct il_lq_sta *lq_sta,
1023 struct il_scale_tbl_info *tbl) 1023 struct il_scale_tbl_info *tbl)
1024{ 1024{
1025 /* Used to choose among HT tables */ 1025 /* Used to choose among HT tables */
1026 s32 (*ht_tbl_pointer)[IL_RATE_COUNT]; 1026 s32 (*ht_tbl_pointer)[RATE_COUNT];
1027 1027
1028 /* Check for invalid LQ type */ 1028 /* Check for invalid LQ type */
1029 if (WARN_ON_ONCE(!is_legacy(tbl->lq_type) && !is_Ht(tbl->lq_type))) { 1029 if (WARN_ON_ONCE(!is_legacy(tbl->lq_type) && !is_Ht(tbl->lq_type))) {
@@ -1089,7 +1089,7 @@ static s32 il4965_rs_get_best_rate(struct il_priv *il,
1089 u16 high_low; 1089 u16 high_low;
1090 s8 rate = index; 1090 s8 rate = index;
1091 1091
1092 new_rate = high = low = start_hi = IL_RATE_INVALID; 1092 new_rate = high = low = start_hi = RATE_INVALID;
1093 1093
1094 for (; ;) { 1094 for (; ;) {
1095 high_low = il4965_rs_get_adjacent_rate(il, rate, rate_mask, 1095 high_low = il4965_rs_get_adjacent_rate(il, rate, rate_mask,
@@ -1114,16 +1114,16 @@ static s32 il4965_rs_get_best_rate(struct il_priv *il,
1114 * "active" throughput (under perfect conditions). 1114 * "active" throughput (under perfect conditions).
1115 */ 1115 */
1116 if ((100 * tpt_tbl[rate] > lq_sta->last_tpt && 1116 if ((100 * tpt_tbl[rate] > lq_sta->last_tpt &&
1117 (active_sr > IL_RATE_DECREASE_TH && 1117 (active_sr > RATE_DECREASE_TH &&
1118 active_sr <= IL_RATE_HIGH_TH && 1118 active_sr <= RATE_HIGH_TH &&
1119 tpt_tbl[rate] <= active_tpt)) || 1119 tpt_tbl[rate] <= active_tpt)) ||
1120 (active_sr >= IL_RATE_SCALE_SWITCH && 1120 (active_sr >= RATE_SCALE_SWITCH &&
1121 tpt_tbl[rate] > active_tpt)) { 1121 tpt_tbl[rate] > active_tpt)) {
1122 1122
1123 /* (2nd or later pass) 1123 /* (2nd or later pass)
1124 * If we've already tried to raise the rate, and are 1124 * If we've already tried to raise the rate, and are
1125 * now trying to lower it, use the higher rate. */ 1125 * now trying to lower it, use the higher rate. */
1126 if (start_hi != IL_RATE_INVALID) { 1126 if (start_hi != RATE_INVALID) {
1127 new_rate = start_hi; 1127 new_rate = start_hi;
1128 break; 1128 break;
1129 } 1129 }
@@ -1131,7 +1131,7 @@ static s32 il4965_rs_get_best_rate(struct il_priv *il,
1131 new_rate = rate; 1131 new_rate = rate;
1132 1132
1133 /* Loop again with lower rate */ 1133 /* Loop again with lower rate */
1134 if (low != IL_RATE_INVALID) 1134 if (low != RATE_INVALID)
1135 rate = low; 1135 rate = low;
1136 1136
1137 /* Lower rate not available, use the original */ 1137 /* Lower rate not available, use the original */
@@ -1143,11 +1143,11 @@ static s32 il4965_rs_get_best_rate(struct il_priv *il,
1143 /* (2nd or later pass) 1143 /* (2nd or later pass)
1144 * If we've already tried to lower the rate, and are 1144 * If we've already tried to lower the rate, and are
1145 * now trying to raise it, use the lower rate. */ 1145 * now trying to raise it, use the lower rate. */
1146 if (new_rate != IL_RATE_INVALID) 1146 if (new_rate != RATE_INVALID)
1147 break; 1147 break;
1148 1148
1149 /* Loop again with higher rate */ 1149 /* Loop again with higher rate */
1150 else if (high != IL_RATE_INVALID) { 1150 else if (high != RATE_INVALID) {
1151 start_hi = high; 1151 start_hi = high;
1152 rate = high; 1152 rate = high;
1153 1153
@@ -1207,7 +1207,7 @@ static int il4965_rs_switch_to_mimo2(struct il_priv *il,
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 == IL_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 index %d rate mask %x\n",
1213 rate, rate_mask); 1213 rate, rate_mask);
@@ -1259,7 +1259,7 @@ static int il4965_rs_switch_to_siso(struct il_priv *il,
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, index);
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 == IL_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 index %d rate mask %x\n",
1265 rate, rate_mask); 1265 rate, rate_mask);
@@ -1286,7 +1286,7 @@ static int il4965_rs_move_legacy_other(struct il_priv *il,
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[index]);
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) * IL_RATE_COUNT)); 1289 (sizeof(struct il_rate_scale_data) * RATE_COUNT));
1290 u8 start_action; 1290 u8 start_action;
1291 u8 valid_tx_ant = il->hw_params.valid_tx_ant; 1291 u8 valid_tx_ant = il->hw_params.valid_tx_ant;
1292 u8 tx_chains_num = il->hw_params.tx_chains_num; 1292 u8 tx_chains_num = il->hw_params.tx_chains_num;
@@ -1404,7 +1404,7 @@ static int il4965_rs_move_siso_to_other(struct il_priv *il,
1404 struct il_rate_scale_data *win = &(tbl->win[index]); 1404 struct il_rate_scale_data *win = &(tbl->win[index]);
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) * IL_RATE_COUNT)); 1407 (sizeof(struct il_rate_scale_data) * RATE_COUNT));
1408 u8 start_action; 1408 u8 start_action;
1409 u8 valid_tx_ant = il->hw_params.valid_tx_ant; 1409 u8 valid_tx_ant = il->hw_params.valid_tx_ant;
1410 u8 tx_chains_num = il->hw_params.tx_chains_num; 1410 u8 tx_chains_num = il->hw_params.tx_chains_num;
@@ -1526,7 +1526,7 @@ static int il4965_rs_move_mimo2_to_other(struct il_priv *il,
1526 struct il_rate_scale_data *win = &(tbl->win[index]); 1526 struct il_rate_scale_data *win = &(tbl->win[index]);
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) * IL_RATE_COUNT)); 1529 (sizeof(struct il_rate_scale_data) * RATE_COUNT));
1530 u8 start_action; 1530 u8 start_action;
1531 u8 valid_tx_ant = il->hw_params.valid_tx_ant; 1531 u8 valid_tx_ant = il->hw_params.valid_tx_ant;
1532 u8 tx_chains_num = il->hw_params.tx_chains_num; 1532 u8 tx_chains_num = il->hw_params.tx_chains_num;
@@ -1663,7 +1663,7 @@ il4965_rs_stay_in_table(struct il_lq_sta *lq_sta, bool force_search)
1663 flush_interval_passed = 1663 flush_interval_passed =
1664 time_after(jiffies, 1664 time_after(jiffies,
1665 (unsigned long)(lq_sta->flush_timer + 1665 (unsigned long)(lq_sta->flush_timer +
1666 IL_RATE_SCALE_FLUSH_INTVL)); 1666 RATE_SCALE_FLUSH_INTVL));
1667 1667
1668 /* 1668 /*
1669 * Check if we should allow search for new modulation mode. 1669 * Check if we should allow search for new modulation mode.
@@ -1703,7 +1703,7 @@ il4965_rs_stay_in_table(struct il_lq_sta *lq_sta, bool force_search)
1703 1703
1704 D_RATE( 1704 D_RATE(
1705 "LQ: stay in table clear win\n"); 1705 "LQ: stay in table clear win\n");
1706 for (i = 0; i < IL_RATE_COUNT; i++) 1706 for (i = 0; i < RATE_COUNT; i++)
1707 il4965_rs_rate_scale_clear_win( 1707 il4965_rs_rate_scale_clear_win(
1708 &(tbl->win[i])); 1708 &(tbl->win[i]));
1709 } 1709 }
@@ -1713,7 +1713,7 @@ il4965_rs_stay_in_table(struct il_lq_sta *lq_sta, bool force_search)
1713 * bitmaps and stats in active table (this will become the new 1713 * bitmaps and stats in active table (this will become the new
1714 * "search" table). */ 1714 * "search" table). */
1715 if (!lq_sta->stay_in_tbl) { 1715 if (!lq_sta->stay_in_tbl) {
1716 for (i = 0; i < IL_RATE_COUNT; i++) 1716 for (i = 0; i < RATE_COUNT; i++)
1717 il4965_rs_rate_scale_clear_win( 1717 il4965_rs_rate_scale_clear_win(
1718 &(tbl->win[i])); 1718 &(tbl->win[i]));
1719 } 1719 }
@@ -1752,8 +1752,8 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
1752 struct ieee80211_conf *conf = &hw->conf; 1752 struct ieee80211_conf *conf = &hw->conf;
1753 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1753 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1754 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 1754 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
1755 int low = IL_RATE_INVALID; 1755 int low = RATE_INVALID;
1756 int high = IL_RATE_INVALID; 1756 int high = RATE_INVALID;
1757 int index; 1757 int index;
1758 int i; 1758 int i;
1759 struct il_rate_scale_data *win = NULL; 1759 struct il_rate_scale_data *win = NULL;
@@ -1884,8 +1884,8 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
1884 * in current association (use new rate found above). 1884 * in current association (use new rate found above).
1885 */ 1885 */
1886 fail_count = win->counter - win->success_counter; 1886 fail_count = win->counter - win->success_counter;
1887 if (fail_count < IL_RATE_MIN_FAILURE_TH && 1887 if (fail_count < RATE_MIN_FAILURE_TH &&
1888 win->success_counter < IL_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 index %d\n",
1891 win->success_counter, win->counter, index); 1891 win->success_counter, win->counter, index);
@@ -1971,21 +1971,21 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
1971 /* If user set max rate, dont allow higher than user constrain */ 1971 /* If user set max rate, dont allow higher than user constrain */
1972 if (lq_sta->max_rate_idx != -1 && 1972 if (lq_sta->max_rate_idx != -1 &&
1973 lq_sta->max_rate_idx < high) 1973 lq_sta->max_rate_idx < high)
1974 high = IL_RATE_INVALID; 1974 high = RATE_INVALID;
1975 1975
1976 sr = win->success_ratio; 1976 sr = win->success_ratio;
1977 1977
1978 /* Collect measured throughputs for current and adjacent rates */ 1978 /* Collect measured throughputs for current and adjacent rates */
1979 current_tpt = win->average_tpt; 1979 current_tpt = win->average_tpt;
1980 if (low != IL_RATE_INVALID) 1980 if (low != RATE_INVALID)
1981 low_tpt = tbl->win[low].average_tpt; 1981 low_tpt = tbl->win[low].average_tpt;
1982 if (high != IL_RATE_INVALID) 1982 if (high != RATE_INVALID)
1983 high_tpt = tbl->win[high].average_tpt; 1983 high_tpt = tbl->win[high].average_tpt;
1984 1984
1985 scale_action = 0; 1985 scale_action = 0;
1986 1986
1987 /* Too many failures, decrease rate */ 1987 /* Too many failures, decrease rate */
1988 if (sr <= IL_RATE_DECREASE_TH || current_tpt == 0) { 1988 if (sr <= RATE_DECREASE_TH || current_tpt == 0) {
1989 D_RATE( 1989 D_RATE(
1990 "decrease rate because of low success_ratio\n"); 1990 "decrease rate because of low success_ratio\n");
1991 scale_action = -1; 1991 scale_action = -1;
@@ -1994,9 +1994,9 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
1994 } else if (low_tpt == IL_INVALID_VALUE && 1994 } else if (low_tpt == IL_INVALID_VALUE &&
1995 high_tpt == IL_INVALID_VALUE) { 1995 high_tpt == IL_INVALID_VALUE) {
1996 1996
1997 if (high != IL_RATE_INVALID && sr >= IL_RATE_INCREASE_TH) 1997 if (high != RATE_INVALID && sr >= RATE_INCREASE_TH)
1998 scale_action = 1; 1998 scale_action = 1;
1999 else if (low != IL_RATE_INVALID) 1999 else if (low != RATE_INVALID)
2000 scale_action = 0; 2000 scale_action = 0;
2001 } 2001 }
2002 2002
@@ -2013,7 +2013,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
2013 if (high_tpt != IL_INVALID_VALUE) { 2013 if (high_tpt != IL_INVALID_VALUE) {
2014 /* Higher rate has better throughput */ 2014 /* Higher rate has better throughput */
2015 if (high_tpt > current_tpt && 2015 if (high_tpt > current_tpt &&
2016 sr >= IL_RATE_INCREASE_TH) { 2016 sr >= RATE_INCREASE_TH) {
2017 scale_action = 1; 2017 scale_action = 1;
2018 } else { 2018 } else {
2019 scale_action = 0; 2019 scale_action = 0;
@@ -2026,7 +2026,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
2026 D_RATE( 2026 D_RATE(
2027 "decrease rate because of low tpt\n"); 2027 "decrease rate because of low tpt\n");
2028 scale_action = -1; 2028 scale_action = -1;
2029 } else if (sr >= IL_RATE_INCREASE_TH) { 2029 } else if (sr >= RATE_INCREASE_TH) {
2030 scale_action = 1; 2030 scale_action = 1;
2031 } 2031 }
2032 } 2032 }
@@ -2034,14 +2034,14 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
2034 2034
2035 /* Sanity check; asked for decrease, but success rate or throughput 2035 /* Sanity check; asked for decrease, but success rate or throughput
2036 * has been good at old rate. Don't change it. */ 2036 * has been good at old rate. Don't change it. */
2037 if (scale_action == -1 && low != IL_RATE_INVALID && 2037 if (scale_action == -1 && low != RATE_INVALID &&
2038 (sr > IL_RATE_HIGH_TH || current_tpt > 100 * tbl->expected_tpt[low])) 2038 (sr > RATE_HIGH_TH || current_tpt > 100 * tbl->expected_tpt[low]))
2039 scale_action = 0; 2039 scale_action = 0;
2040 2040
2041 switch (scale_action) { 2041 switch (scale_action) {
2042 case -1: 2042 case -1:
2043 /* Decrease starting rate, update uCode's rate table */ 2043 /* Decrease starting rate, update uCode's rate table */
2044 if (low != IL_RATE_INVALID) { 2044 if (low != RATE_INVALID) {
2045 update_lq = 1; 2045 update_lq = 1;
2046 index = low; 2046 index = low;
2047 } 2047 }
@@ -2049,7 +2049,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
2049 break; 2049 break;
2050 case 1: 2050 case 1:
2051 /* Increase starting rate, update uCode's rate table */ 2051 /* Increase starting rate, update uCode's rate table */
2052 if (high != IL_RATE_INVALID) { 2052 if (high != RATE_INVALID) {
2053 update_lq = 1; 2053 update_lq = 1;
2054 index = high; 2054 index = high;
2055 } 2055 }
@@ -2102,7 +2102,7 @@ lq_update:
2102 if (lq_sta->search_better_tbl) { 2102 if (lq_sta->search_better_tbl) {
2103 /* Access the "search" table, clear its history. */ 2103 /* Access the "search" table, clear its history. */
2104 tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 2104 tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
2105 for (i = 0; i < IL_RATE_COUNT; i++) 2105 for (i = 0; i < RATE_COUNT; i++)
2106 il4965_rs_rate_scale_clear_win( 2106 il4965_rs_rate_scale_clear_win(
2107 &(tbl->win[i])); 2107 &(tbl->win[i]));
2108 2108
@@ -2208,7 +2208,7 @@ static void il4965_rs_initialize_lq(struct il_priv *il,
2208 2208
2209 tbl = &(lq_sta->lq_info[active_tbl]); 2209 tbl = &(lq_sta->lq_info[active_tbl]);
2210 2210
2211 if (i < 0 || i >= IL_RATE_COUNT) 2211 if (i < 0 || i >= RATE_COUNT)
2212 i = 0; 2212 i = 0;
2213 2213
2214 rate = il_rates[i].plcp; 2214 rate = il_rates[i].plcp;
@@ -2251,7 +2251,7 @@ il4965_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
2251 lq_sta->max_rate_idx != -1) 2251 lq_sta->max_rate_idx != -1)
2252 lq_sta->max_rate_idx += IL_FIRST_OFDM_RATE; 2252 lq_sta->max_rate_idx += IL_FIRST_OFDM_RATE;
2253 if (lq_sta->max_rate_idx < 0 || 2253 if (lq_sta->max_rate_idx < 0 ||
2254 lq_sta->max_rate_idx >= IL_RATE_COUNT) 2254 lq_sta->max_rate_idx >= RATE_COUNT)
2255 lq_sta->max_rate_idx = -1; 2255 lq_sta->max_rate_idx = -1;
2256 } 2256 }
2257 2257
@@ -2275,7 +2275,7 @@ il4965_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
2275 /* 6M and 9M shared same MCS index */ 2275 /* 6M and 9M shared same MCS index */
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 IL_RATE_MIMO2_6M_PLCP) 2278 RATE_MIMO2_6M_PLCP)
2279 rate_idx = rate_idx + MCS_INDEX_PER_STREAM; 2279 rate_idx = rate_idx + MCS_INDEX_PER_STREAM;
2280 info->control.rates[0].flags = IEEE80211_TX_RC_MCS; 2280 info->control.rates[0].flags = IEEE80211_TX_RC_MCS;
2281 if (lq_sta->last_rate_n_flags & RATE_MCS_SGI_MSK) 2281 if (lq_sta->last_rate_n_flags & RATE_MCS_SGI_MSK)
@@ -2292,7 +2292,7 @@ il4965_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
2292 IEEE80211_TX_RC_GREEN_FIELD; 2292 IEEE80211_TX_RC_GREEN_FIELD;
2293 } else { 2293 } else {
2294 /* Check for invalid rates */ 2294 /* Check for invalid rates */
2295 if (rate_idx < 0 || rate_idx >= IL_RATE_COUNT_LEGACY || 2295 if (rate_idx < 0 || rate_idx >= RATE_COUNT_LEGACY ||
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);
@@ -2345,14 +2345,14 @@ il4965_rs_rate_init(struct il_priv *il,
2345 lq_sta->lq.sta_id = sta_id; 2345 lq_sta->lq.sta_id = sta_id;
2346 2346
2347 for (j = 0; j < LQ_SIZE; j++) 2347 for (j = 0; j < LQ_SIZE; j++)
2348 for (i = 0; i < IL_RATE_COUNT; i++) 2348 for (i = 0; i < RATE_COUNT; i++)
2349 il4965_rs_rate_scale_clear_win( 2349 il4965_rs_rate_scale_clear_win(
2350 &lq_sta->lq_info[j].win[i]); 2350 &lq_sta->lq_info[j].win[i]);
2351 2351
2352 lq_sta->flush_timer = 0; 2352 lq_sta->flush_timer = 0;
2353 lq_sta->supp_rates = sta->supp_rates[sband->band]; 2353 lq_sta->supp_rates = sta->supp_rates[sband->band];
2354 for (j = 0; j < LQ_SIZE; j++) 2354 for (j = 0; j < LQ_SIZE; j++)
2355 for (i = 0; i < IL_RATE_COUNT; i++) 2355 for (i = 0; i < RATE_COUNT; i++)
2356 il4965_rs_rate_scale_clear_win( 2356 il4965_rs_rate_scale_clear_win(
2357 &lq_sta->lq_info[j].win[i]); 2357 &lq_sta->lq_info[j].win[i]);
2358 2358
@@ -2745,7 +2745,7 @@ static ssize_t il4965_rs_sta_dbgfs_stats_table_read(struct file *file,
2745 lq_sta->lq_info[i].is_dup, 2745 lq_sta->lq_info[i].is_dup,
2746 lq_sta->is_green, 2746 lq_sta->is_green,
2747 lq_sta->lq_info[i].current_rate); 2747 lq_sta->lq_info[i].current_rate);
2748 for (j = 0; j < IL_RATE_COUNT; j++) { 2748 for (j = 0; j < RATE_COUNT; j++) {
2749 desc += sprintf(buff+desc, 2749 desc += sprintf(buff+desc,
2750 "counter=%d success=%d %%=%d\n", 2750 "counter=%d success=%d %%=%d\n",
2751 lq_sta->lq_info[i].win[j].counter, 2751 lq_sta->lq_info[i].win[j].counter,
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-sta.c b/drivers/net/wireless/iwlegacy/iwl-4965-sta.c
index a82d44489a6c..278517c9083c 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-sta.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-sta.c
@@ -50,9 +50,9 @@ il4965_sta_alloc_lq(struct il_priv *il, u8 sta_id)
50 /* Set up the rate scaling to start at selected rate, fall back 50 /* Set up the rate scaling to start at selected rate, fall back
51 * all the way down to 1M in IEEE order, and then spin on 1M */ 51 * all the way down to 1M in IEEE order, and then spin on 1M */
52 if (il->band == IEEE80211_BAND_5GHZ) 52 if (il->band == IEEE80211_BAND_5GHZ)
53 r = IL_RATE_6M_INDEX; 53 r = RATE_6M_INDEX;
54 else 54 else
55 r = IL_RATE_1M_INDEX; 55 r = RATE_1M_INDEX;
56 56
57 if (r >= IL_FIRST_CCK_RATE && r <= IL_LAST_CCK_RATE) 57 if (r >= IL_FIRST_CCK_RATE && r <= IL_LAST_CCK_RATE)
58 rate_flags |= RATE_MCS_CCK_MSK; 58 rate_flags |= RATE_MCS_CCK_MSK;
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
index 68c86e009cf3..9671e10ff354 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
@@ -196,7 +196,7 @@ static void il4965_tx_cmd_build_rate(struct il_priv *il,
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) ||
199 rate_idx < 0 || rate_idx > IL_RATE_COUNT_LEGACY) 199 rate_idx < 0 || rate_idx > RATE_COUNT_LEGACY)
200 rate_idx = rate_lowest_index(&il->bands[info->band], 200 rate_idx = rate_lowest_index(&il->bands[info->band],
201 info->control.sta); 201 info->control.sta);
202 /* For 5 GHZ band, remap mac80211 rate indices into driver indices */ 202 /* For 5 GHZ band, remap mac80211 rate indices into driver indices */
diff --git a/drivers/net/wireless/iwlegacy/iwl-commands.h b/drivers/net/wireless/iwlegacy/iwl-commands.h
index d1876d05e7f0..aed11019f094 100644
--- a/drivers/net/wireless/iwlegacy/iwl-commands.h
+++ b/drivers/net/wireless/iwlegacy/iwl-commands.h
@@ -2094,7 +2094,7 @@ struct il_link_quality_cmd {
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 {
2097 __le32 rate_n_flags; /* RATE_MCS_*, IL_RATE_* */ 2097 __le32 rate_n_flags; /* RATE_MCS_*, RATE_* */
2098 } rs_table[LINK_QUAL_MAX_RETRY_NUM]; 2098 } rs_table[LINK_QUAL_MAX_RETRY_NUM];
2099 __le32 reserved2; 2099 __le32 reserved2;
2100} __packed; 2100} __packed;
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c
index 6742a6558ba9..de952fb0a96f 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.c
+++ b/drivers/net/wireless/iwlegacy/iwl-core.c
@@ -174,7 +174,7 @@ int il_init_geos(struct il_priv *il)
174 if (!channels) 174 if (!channels)
175 return -ENOMEM; 175 return -ENOMEM;
176 176
177 rates = kzalloc((sizeof(struct ieee80211_rate) * IL_RATE_COUNT_LEGACY), 177 rates = kzalloc((sizeof(struct ieee80211_rate) * RATE_COUNT_LEGACY),
178 GFP_KERNEL); 178 GFP_KERNEL);
179 if (!rates) { 179 if (!rates) {
180 kfree(channels); 180 kfree(channels);
@@ -186,7 +186,7 @@ int il_init_geos(struct il_priv *il)
186 sband->channels = &channels[ARRAY_SIZE(il_eeprom_band_1)]; 186 sband->channels = &channels[ARRAY_SIZE(il_eeprom_band_1)];
187 /* just OFDM */ 187 /* just OFDM */
188 sband->bitrates = &rates[IL_FIRST_OFDM_RATE]; 188 sband->bitrates = &rates[IL_FIRST_OFDM_RATE];
189 sband->n_bitrates = IL_RATE_COUNT_LEGACY - IL_FIRST_OFDM_RATE; 189 sband->n_bitrates = RATE_COUNT_LEGACY - IL_FIRST_OFDM_RATE;
190 190
191 if (il->cfg->sku & IL_SKU_N) 191 if (il->cfg->sku & IL_SKU_N)
192 il_init_ht_hw_capab(il, &sband->ht_cap, 192 il_init_ht_hw_capab(il, &sband->ht_cap,
@@ -196,7 +196,7 @@ int il_init_geos(struct il_priv *il)
196 sband->channels = channels; 196 sband->channels = channels;
197 /* OFDM & CCK */ 197 /* OFDM & CCK */
198 sband->bitrates = rates; 198 sband->bitrates = rates;
199 sband->n_bitrates = IL_RATE_COUNT_LEGACY; 199 sband->n_bitrates = RATE_COUNT_LEGACY;
200 200
201 if (il->cfg->sku & IL_SKU_N) 201 if (il->cfg->sku & IL_SKU_N)
202 il_init_ht_hw_capab(il, &sband->ht_cap, 202 il_init_ht_hw_capab(il, &sband->ht_cap,
@@ -454,8 +454,8 @@ il_check_rxon_cmd(struct il_priv *il, struct il_rxon_context *ctx)
454 } 454 }
455 455
456 /* make sure basic rates 6Mbps and 1Mbps are supported */ 456 /* make sure basic rates 6Mbps and 1Mbps are supported */
457 if ((rxon->ofdm_basic_rates & IL_RATE_6M_MASK) == 0 && 457 if ((rxon->ofdm_basic_rates & RATE_6M_MASK) == 0 &&
458 (rxon->cck_basic_rates & IL_RATE_1M_MASK) == 0) { 458 (rxon->cck_basic_rates & RATE_1M_MASK) == 0) {
459 IL_WARN("neither 1 nor 6 are basic\n"); 459 IL_WARN("neither 1 nor 6 are basic\n");
460 error = true; 460 error = true;
461 } 461 }
@@ -566,9 +566,9 @@ u8 il_get_lowest_plcp(struct il_priv *il,
566 * the beacon skb from mac80211. 566 * the beacon skb from mac80211.
567 */ 567 */
568 if (ctx->staging.flags & RXON_FLG_BAND_24G_MSK) 568 if (ctx->staging.flags & RXON_FLG_BAND_24G_MSK)
569 return IL_RATE_1M_PLCP; 569 return RATE_1M_PLCP;
570 else 570 else
571 return IL_RATE_6M_PLCP; 571 return RATE_6M_PLCP;
572} 572}
573EXPORT_SYMBOL(il_get_lowest_plcp); 573EXPORT_SYMBOL(il_get_lowest_plcp);
574 574
@@ -835,7 +835,7 @@ void il_set_rate(struct il_priv *il)
835 835
836 for (i = 0; i < hw->n_bitrates; i++) { 836 for (i = 0; i < hw->n_bitrates; i++) {
837 rate = &(hw->bitrates[i]); 837 rate = &(hw->bitrates[i]);
838 if (rate->hw_value < IL_RATE_COUNT_LEGACY) 838 if (rate->hw_value < RATE_COUNT_LEGACY)
839 il->active_rate |= (1 << rate->hw_value); 839 il->active_rate |= (1 << rate->hw_value);
840 } 840 }
841 841
diff --git a/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h b/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
index 19fa92d0e29f..6670f2eb71ae 100644
--- a/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
+++ b/drivers/net/wireless/iwlegacy/iwl-legacy-rs.h
@@ -28,10 +28,10 @@
28#define __il_rs_h__ 28#define __il_rs_h__
29 29
30struct il_rate_info { 30struct il_rate_info {
31 u8 plcp; /* uCode API: IL_RATE_6M_PLCP, etc. */ 31 u8 plcp; /* uCode API: RATE_6M_PLCP, etc. */
32 u8 plcp_siso; /* uCode API: IL_RATE_SISO_6M_PLCP, etc. */ 32 u8 plcp_siso; /* uCode API: RATE_SISO_6M_PLCP, etc. */
33 u8 plcp_mimo2; /* uCode API: IL_RATE_MIMO2_6M_PLCP, etc. */ 33 u8 plcp_mimo2; /* uCode API: RATE_MIMO2_6M_PLCP, etc. */
34 u8 ieee; /* MAC header: IL_RATE_6M_IEEE, etc. */ 34 u8 ieee; /* MAC header: RATE_6M_IEEE, etc. */
35 u8 prev_ieee; /* previous rate in IEEE speeds */ 35 u8 prev_ieee; /* previous rate in IEEE speeds */
36 u8 next_ieee; /* next rate in IEEE speeds */ 36 u8 next_ieee; /* next rate in IEEE speeds */
37 u8 prev_rs; /* previous rate used in rs algo */ 37 u8 prev_rs; /* previous rate used in rs algo */
@@ -41,8 +41,8 @@ struct il_rate_info {
41}; 41};
42 42
43struct il3945_rate_info { 43struct il3945_rate_info {
44 u8 plcp; /* uCode API: IL_RATE_6M_PLCP, etc. */ 44 u8 plcp; /* uCode API: RATE_6M_PLCP, etc. */
45 u8 ieee; /* MAC header: IL_RATE_6M_IEEE, etc. */ 45 u8 ieee; /* MAC header: RATE_6M_IEEE, etc. */
46 u8 prev_ieee; /* previous rate in IEEE speeds */ 46 u8 prev_ieee; /* previous rate in IEEE speeds */
47 u8 next_ieee; /* next rate in IEEE speeds */ 47 u8 next_ieee; /* next rate in IEEE speeds */
48 u8 prev_rs; /* previous rate used in rs algo */ 48 u8 prev_rs; /* previous rate used in rs algo */
@@ -56,153 +56,153 @@ struct il3945_rate_info {
56 56
57/* 57/*
58 * These serve as indexes into 58 * These serve as indexes into
59 * struct il_rate_info il_rates[IL_RATE_COUNT]; 59 * struct il_rate_info il_rates[RATE_COUNT];
60 */ 60 */
61enum { 61enum {
62 IL_RATE_1M_INDEX = 0, 62 RATE_1M_INDEX = 0,
63 IL_RATE_2M_INDEX, 63 RATE_2M_INDEX,
64 IL_RATE_5M_INDEX, 64 RATE_5M_INDEX,
65 IL_RATE_11M_INDEX, 65 RATE_11M_INDEX,
66 IL_RATE_6M_INDEX, 66 RATE_6M_INDEX,
67 IL_RATE_9M_INDEX, 67 RATE_9M_INDEX,
68 IL_RATE_12M_INDEX, 68 RATE_12M_INDEX,
69 IL_RATE_18M_INDEX, 69 RATE_18M_INDEX,
70 IL_RATE_24M_INDEX, 70 RATE_24M_INDEX,
71 IL_RATE_36M_INDEX, 71 RATE_36M_INDEX,
72 IL_RATE_48M_INDEX, 72 RATE_48M_INDEX,
73 IL_RATE_54M_INDEX, 73 RATE_54M_INDEX,
74 IL_RATE_60M_INDEX, 74 RATE_60M_INDEX,
75 IL_RATE_COUNT, 75 RATE_COUNT,
76 IL_RATE_COUNT_LEGACY = IL_RATE_COUNT - 1, /* Excluding 60M */ 76 RATE_COUNT_LEGACY = RATE_COUNT - 1, /* Excluding 60M */
77 IL_RATE_COUNT_3945 = IL_RATE_COUNT - 1, 77 RATE_COUNT_3945 = RATE_COUNT - 1,
78 IL_RATE_INVM_INDEX = IL_RATE_COUNT, 78 RATE_INVM_INDEX = RATE_COUNT,
79 IL_RATE_INVALID = IL_RATE_COUNT, 79 RATE_INVALID = RATE_COUNT,
80}; 80};
81 81
82enum { 82enum {
83 IL_RATE_6M_INDEX_TABLE = 0, 83 RATE_6M_INDEX_TABLE = 0,
84 IL_RATE_9M_INDEX_TABLE, 84 RATE_9M_INDEX_TABLE,
85 IL_RATE_12M_INDEX_TABLE, 85 RATE_12M_INDEX_TABLE,
86 IL_RATE_18M_INDEX_TABLE, 86 RATE_18M_INDEX_TABLE,
87 IL_RATE_24M_INDEX_TABLE, 87 RATE_24M_INDEX_TABLE,
88 IL_RATE_36M_INDEX_TABLE, 88 RATE_36M_INDEX_TABLE,
89 IL_RATE_48M_INDEX_TABLE, 89 RATE_48M_INDEX_TABLE,
90 IL_RATE_54M_INDEX_TABLE, 90 RATE_54M_INDEX_TABLE,
91 IL_RATE_1M_INDEX_TABLE, 91 RATE_1M_INDEX_TABLE,
92 IL_RATE_2M_INDEX_TABLE, 92 RATE_2M_INDEX_TABLE,
93 IL_RATE_5M_INDEX_TABLE, 93 RATE_5M_INDEX_TABLE,
94 IL_RATE_11M_INDEX_TABLE, 94 RATE_11M_INDEX_TABLE,
95 IL_RATE_INVM_INDEX_TABLE = IL_RATE_INVM_INDEX - 1, 95 RATE_INVM_INDEX_TABLE = RATE_INVM_INDEX - 1,
96}; 96};
97 97
98enum { 98enum {
99 IL_FIRST_OFDM_RATE = IL_RATE_6M_INDEX, 99 IL_FIRST_OFDM_RATE = RATE_6M_INDEX,
100 IL39_LAST_OFDM_RATE = IL_RATE_54M_INDEX, 100 IL39_LAST_OFDM_RATE = RATE_54M_INDEX,
101 IL_LAST_OFDM_RATE = IL_RATE_60M_INDEX, 101 IL_LAST_OFDM_RATE = RATE_60M_INDEX,
102 IL_FIRST_CCK_RATE = IL_RATE_1M_INDEX, 102 IL_FIRST_CCK_RATE = RATE_1M_INDEX,
103 IL_LAST_CCK_RATE = IL_RATE_11M_INDEX, 103 IL_LAST_CCK_RATE = RATE_11M_INDEX,
104}; 104};
105 105
106/* #define vs. enum to keep from defaulting to 'large integer' */ 106/* #define vs. enum to keep from defaulting to 'large integer' */
107#define IL_RATE_6M_MASK (1 << IL_RATE_6M_INDEX) 107#define RATE_6M_MASK (1 << RATE_6M_INDEX)
108#define IL_RATE_9M_MASK (1 << IL_RATE_9M_INDEX) 108#define RATE_9M_MASK (1 << RATE_9M_INDEX)
109#define IL_RATE_12M_MASK (1 << IL_RATE_12M_INDEX) 109#define RATE_12M_MASK (1 << RATE_12M_INDEX)
110#define IL_RATE_18M_MASK (1 << IL_RATE_18M_INDEX) 110#define RATE_18M_MASK (1 << RATE_18M_INDEX)
111#define IL_RATE_24M_MASK (1 << IL_RATE_24M_INDEX) 111#define RATE_24M_MASK (1 << RATE_24M_INDEX)
112#define IL_RATE_36M_MASK (1 << IL_RATE_36M_INDEX) 112#define RATE_36M_MASK (1 << RATE_36M_INDEX)
113#define IL_RATE_48M_MASK (1 << IL_RATE_48M_INDEX) 113#define RATE_48M_MASK (1 << RATE_48M_INDEX)
114#define IL_RATE_54M_MASK (1 << IL_RATE_54M_INDEX) 114#define RATE_54M_MASK (1 << RATE_54M_INDEX)
115#define IL_RATE_60M_MASK (1 << IL_RATE_60M_INDEX) 115#define RATE_60M_MASK (1 << RATE_60M_INDEX)
116#define IL_RATE_1M_MASK (1 << IL_RATE_1M_INDEX) 116#define RATE_1M_MASK (1 << RATE_1M_INDEX)
117#define IL_RATE_2M_MASK (1 << IL_RATE_2M_INDEX) 117#define RATE_2M_MASK (1 << RATE_2M_INDEX)
118#define IL_RATE_5M_MASK (1 << IL_RATE_5M_INDEX) 118#define RATE_5M_MASK (1 << RATE_5M_INDEX)
119#define IL_RATE_11M_MASK (1 << IL_RATE_11M_INDEX) 119#define RATE_11M_MASK (1 << RATE_11M_INDEX)
120 120
121/* uCode API values for legacy bit rates, both OFDM and CCK */ 121/* uCode API values for legacy bit rates, both OFDM and CCK */
122enum { 122enum {
123 IL_RATE_6M_PLCP = 13, 123 RATE_6M_PLCP = 13,
124 IL_RATE_9M_PLCP = 15, 124 RATE_9M_PLCP = 15,
125 IL_RATE_12M_PLCP = 5, 125 RATE_12M_PLCP = 5,
126 IL_RATE_18M_PLCP = 7, 126 RATE_18M_PLCP = 7,
127 IL_RATE_24M_PLCP = 9, 127 RATE_24M_PLCP = 9,
128 IL_RATE_36M_PLCP = 11, 128 RATE_36M_PLCP = 11,
129 IL_RATE_48M_PLCP = 1, 129 RATE_48M_PLCP = 1,
130 IL_RATE_54M_PLCP = 3, 130 RATE_54M_PLCP = 3,
131 IL_RATE_60M_PLCP = 3,/*FIXME:RS:should be removed*/ 131 RATE_60M_PLCP = 3,/*FIXME:RS:should be removed*/
132 IL_RATE_1M_PLCP = 10, 132 RATE_1M_PLCP = 10,
133 IL_RATE_2M_PLCP = 20, 133 RATE_2M_PLCP = 20,
134 IL_RATE_5M_PLCP = 55, 134 RATE_5M_PLCP = 55,
135 IL_RATE_11M_PLCP = 110, 135 RATE_11M_PLCP = 110,
136 /*FIXME:RS:add IL_RATE_LEGACY_INVM_PLCP = 0,*/ 136 /*FIXME:RS:add RATE_LEGACY_INVM_PLCP = 0,*/
137}; 137};
138 138
139/* uCode API values for OFDM high-throughput (HT) bit rates */ 139/* uCode API values for OFDM high-throughput (HT) bit rates */
140enum { 140enum {
141 IL_RATE_SISO_6M_PLCP = 0, 141 RATE_SISO_6M_PLCP = 0,
142 IL_RATE_SISO_12M_PLCP = 1, 142 RATE_SISO_12M_PLCP = 1,
143 IL_RATE_SISO_18M_PLCP = 2, 143 RATE_SISO_18M_PLCP = 2,
144 IL_RATE_SISO_24M_PLCP = 3, 144 RATE_SISO_24M_PLCP = 3,
145 IL_RATE_SISO_36M_PLCP = 4, 145 RATE_SISO_36M_PLCP = 4,
146 IL_RATE_SISO_48M_PLCP = 5, 146 RATE_SISO_48M_PLCP = 5,
147 IL_RATE_SISO_54M_PLCP = 6, 147 RATE_SISO_54M_PLCP = 6,
148 IL_RATE_SISO_60M_PLCP = 7, 148 RATE_SISO_60M_PLCP = 7,
149 IL_RATE_MIMO2_6M_PLCP = 0x8, 149 RATE_MIMO2_6M_PLCP = 0x8,
150 IL_RATE_MIMO2_12M_PLCP = 0x9, 150 RATE_MIMO2_12M_PLCP = 0x9,
151 IL_RATE_MIMO2_18M_PLCP = 0xa, 151 RATE_MIMO2_18M_PLCP = 0xa,
152 IL_RATE_MIMO2_24M_PLCP = 0xb, 152 RATE_MIMO2_24M_PLCP = 0xb,
153 IL_RATE_MIMO2_36M_PLCP = 0xc, 153 RATE_MIMO2_36M_PLCP = 0xc,
154 IL_RATE_MIMO2_48M_PLCP = 0xd, 154 RATE_MIMO2_48M_PLCP = 0xd,
155 IL_RATE_MIMO2_54M_PLCP = 0xe, 155 RATE_MIMO2_54M_PLCP = 0xe,
156 IL_RATE_MIMO2_60M_PLCP = 0xf, 156 RATE_MIMO2_60M_PLCP = 0xf,
157 IL_RATE_SISO_INVM_PLCP, 157 RATE_SISO_INVM_PLCP,
158 IL_RATE_MIMO2_INVM_PLCP = IL_RATE_SISO_INVM_PLCP, 158 RATE_MIMO2_INVM_PLCP = RATE_SISO_INVM_PLCP,
159}; 159};
160 160
161/* MAC header values for bit rates */ 161/* MAC header values for bit rates */
162enum { 162enum {
163 IL_RATE_6M_IEEE = 12, 163 RATE_6M_IEEE = 12,
164 IL_RATE_9M_IEEE = 18, 164 RATE_9M_IEEE = 18,
165 IL_RATE_12M_IEEE = 24, 165 RATE_12M_IEEE = 24,
166 IL_RATE_18M_IEEE = 36, 166 RATE_18M_IEEE = 36,
167 IL_RATE_24M_IEEE = 48, 167 RATE_24M_IEEE = 48,
168 IL_RATE_36M_IEEE = 72, 168 RATE_36M_IEEE = 72,
169 IL_RATE_48M_IEEE = 96, 169 RATE_48M_IEEE = 96,
170 IL_RATE_54M_IEEE = 108, 170 RATE_54M_IEEE = 108,
171 IL_RATE_60M_IEEE = 120, 171 RATE_60M_IEEE = 120,
172 IL_RATE_1M_IEEE = 2, 172 RATE_1M_IEEE = 2,
173 IL_RATE_2M_IEEE = 4, 173 RATE_2M_IEEE = 4,
174 IL_RATE_5M_IEEE = 11, 174 RATE_5M_IEEE = 11,
175 IL_RATE_11M_IEEE = 22, 175 RATE_11M_IEEE = 22,
176}; 176};
177 177
178#define IL_CCK_BASIC_RATES_MASK \ 178#define IL_CCK_BASIC_RATES_MASK \
179 (IL_RATE_1M_MASK | \ 179 (RATE_1M_MASK | \
180 IL_RATE_2M_MASK) 180 RATE_2M_MASK)
181 181
182#define IL_CCK_RATES_MASK \ 182#define IL_CCK_RATES_MASK \
183 (IL_CCK_BASIC_RATES_MASK | \ 183 (IL_CCK_BASIC_RATES_MASK | \
184 IL_RATE_5M_MASK | \ 184 RATE_5M_MASK | \
185 IL_RATE_11M_MASK) 185 RATE_11M_MASK)
186 186
187#define IL_OFDM_BASIC_RATES_MASK \ 187#define IL_OFDM_BASIC_RATES_MASK \
188 (IL_RATE_6M_MASK | \ 188 (RATE_6M_MASK | \
189 IL_RATE_12M_MASK | \ 189 RATE_12M_MASK | \
190 IL_RATE_24M_MASK) 190 RATE_24M_MASK)
191 191
192#define IL_OFDM_RATES_MASK \ 192#define IL_OFDM_RATES_MASK \
193 (IL_OFDM_BASIC_RATES_MASK | \ 193 (IL_OFDM_BASIC_RATES_MASK | \
194 IL_RATE_9M_MASK | \ 194 RATE_9M_MASK | \
195 IL_RATE_18M_MASK | \ 195 RATE_18M_MASK | \
196 IL_RATE_36M_MASK | \ 196 RATE_36M_MASK | \
197 IL_RATE_48M_MASK | \ 197 RATE_48M_MASK | \
198 IL_RATE_54M_MASK) 198 RATE_54M_MASK)
199 199
200#define IL_BASIC_RATES_MASK \ 200#define IL_BASIC_RATES_MASK \
201 (IL_OFDM_BASIC_RATES_MASK | \ 201 (IL_OFDM_BASIC_RATES_MASK | \
202 IL_CCK_BASIC_RATES_MASK) 202 IL_CCK_BASIC_RATES_MASK)
203 203
204#define IL_RATES_MASK ((1 << IL_RATE_COUNT) - 1) 204#define RATES_MASK ((1 << RATE_COUNT) - 1)
205#define IL_RATES_MASK_3945 ((1 << IL_RATE_COUNT_3945) - 1) 205#define RATES_MASK_3945 ((1 << RATE_COUNT_3945) - 1)
206 206
207#define IL_INVALID_VALUE -1 207#define IL_INVALID_VALUE -1
208 208
@@ -221,10 +221,10 @@ enum {
221 221
222/* Success ratio (ACKed / attempted tx frames) values (perfect is 128 * 100) */ 222/* Success ratio (ACKed / attempted tx frames) values (perfect is 128 * 100) */
223#define IL_RS_GOOD_RATIO 12800 /* 100% */ 223#define IL_RS_GOOD_RATIO 12800 /* 100% */
224#define IL_RATE_SCALE_SWITCH 10880 /* 85% */ 224#define RATE_SCALE_SWITCH 10880 /* 85% */
225#define IL_RATE_HIGH_TH 10880 /* 85% */ 225#define RATE_HIGH_TH 10880 /* 85% */
226#define IL_RATE_INCREASE_TH 6400 /* 50% */ 226#define RATE_INCREASE_TH 6400 /* 50% */
227#define IL_RATE_DECREASE_TH 1920 /* 15% */ 227#define RATE_DECREASE_TH 1920 /* 15% */
228 228
229/* possible actions when in legacy mode */ 229/* possible actions when in legacy mode */
230#define IL_LEGACY_SWITCH_ANTENNA1 0 230#define IL_LEGACY_SWITCH_ANTENNA1 0
@@ -268,7 +268,7 @@ enum {
268#define TID_MAX_TIME_DIFF ((TID_QUEUE_MAX_SIZE - 1) * TID_QUEUE_CELL_SPACING) 268#define TID_MAX_TIME_DIFF ((TID_QUEUE_MAX_SIZE - 1) * TID_QUEUE_CELL_SPACING)
269#define TIME_WRAP_AROUND(x, y) (((y) > (x)) ? (y) - (x) : (0-(x)) + (y)) 269#define TIME_WRAP_AROUND(x, y) (((y) > (x)) ? (y) - (x) : (0-(x)) + (y))
270 270
271extern const struct il_rate_info il_rates[IL_RATE_COUNT]; 271extern const struct il_rate_info il_rates[RATE_COUNT];
272 272
273enum il_table_type { 273enum il_table_type {
274 LQ_NONE, 274 LQ_NONE,
@@ -331,7 +331,7 @@ struct il_scale_tbl_info {
331 u8 max_search; /* maximun number of tables we can search */ 331 u8 max_search; /* maximun number of tables we can search */
332 s32 *expected_tpt; /* throughput metrics; expected_tpt_G, etc. */ 332 s32 *expected_tpt; /* throughput metrics; expected_tpt_G, etc. */
333 u32 current_rate; /* rate_n_flags, uCode API format */ 333 u32 current_rate; /* rate_n_flags, uCode API format */
334 struct il_rate_scale_data win[IL_RATE_COUNT]; /* rate histories */ 334 struct il_rate_scale_data win[RATE_COUNT]; /* rate histories */
335}; 335};
336 336
337struct il_traffic_load { 337struct il_traffic_load {
@@ -371,7 +371,7 @@ struct il_lq_sta {
371 u8 is_dup; 371 u8 is_dup;
372 enum ieee80211_band band; 372 enum ieee80211_band band;
373 373
374 /* The following are bitmaps of rates; IL_RATE_6M_MASK, etc. */ 374 /* The following are bitmaps of rates; RATE_6M_MASK, etc. */
375 u32 supp_rates; 375 u32 supp_rates;
376 u16 active_legacy_rate; 376 u16 active_legacy_rate;
377 u16 active_siso_rate; 377 u16 active_siso_rate;
diff --git a/drivers/net/wireless/iwlegacy/iwl-sta.c b/drivers/net/wireless/iwlegacy/iwl-sta.c
index 3c354a8952ec..dcaa3fb62743 100644
--- a/drivers/net/wireless/iwlegacy/iwl-sta.c
+++ b/drivers/net/wireless/iwlegacy/iwl-sta.c
@@ -314,7 +314,7 @@ u8 il_prep_station(struct il_priv *il, struct il_rxon_context *ctx,
314 314
315 /* 3945 only */ 315 /* 3945 only */
316 rate = (il->band == IEEE80211_BAND_5GHZ) ? 316 rate = (il->band == IEEE80211_BAND_5GHZ) ?
317 IL_RATE_6M_PLCP : IL_RATE_1M_PLCP; 317 RATE_6M_PLCP : RATE_1M_PLCP;
318 /* Turn on both antennas for the station... */ 318 /* Turn on both antennas for the station... */
319 station->sta.rate_n_flags = cpu_to_le16(rate | RATE_MCS_ANT_AB_MSK); 319 station->sta.rate_n_flags = cpu_to_le16(rate | RATE_MCS_ANT_AB_MSK);
320 320
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c
index c602570a3408..1fc9bfbc891e 100644
--- a/drivers/net/wireless/iwlegacy/iwl3945-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c
@@ -1654,7 +1654,7 @@ static void il3945_init_hw_rates(struct il_priv *il,
1654{ 1654{
1655 int i; 1655 int i;
1656 1656
1657 for (i = 0; i < IL_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 indexes */
1660 rates[i].hw_value_short = i; 1660 rates[i].hw_value_short = i;
@@ -2239,7 +2239,7 @@ static void il3945_alive_start(struct il_priv *il)
2239 2239
2240 ieee80211_wake_queues(il->hw); 2240 ieee80211_wake_queues(il->hw);
2241 2241
2242 il->active_rate = IL_RATES_MASK_3945; 2242 il->active_rate = RATES_MASK_3945;
2243 2243
2244 il_power_update_mode(il, true); 2244 il_power_update_mode(il, true);
2245 2245
@@ -2642,11 +2642,11 @@ int il3945_request_scan(struct il_priv *il, struct ieee80211_vif *vif)
2642 switch (il->scan_band) { 2642 switch (il->scan_band) {
2643 case IEEE80211_BAND_2GHZ: 2643 case IEEE80211_BAND_2GHZ:
2644 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; 2644 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK;
2645 scan->tx_cmd.rate = IL_RATE_1M_PLCP; 2645 scan->tx_cmd.rate = RATE_1M_PLCP;
2646 band = IEEE80211_BAND_2GHZ; 2646 band = IEEE80211_BAND_2GHZ;
2647 break; 2647 break;
2648 case IEEE80211_BAND_5GHZ: 2648 case IEEE80211_BAND_5GHZ:
2649 scan->tx_cmd.rate = IL_RATE_6M_PLCP; 2649 scan->tx_cmd.rate = RATE_6M_PLCP;
2650 band = IEEE80211_BAND_5GHZ; 2650 band = IEEE80211_BAND_5GHZ;
2651 break; 2651 break;
2652 default: 2652 default:
diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c
index 736c2f540b16..bc5a0080b9d3 100644
--- a/drivers/net/wireless/iwlegacy/iwl4965-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl4965-base.c
@@ -1757,7 +1757,7 @@ static void il4965_alive_start(struct il_priv *il)
1757 1757
1758 ieee80211_wake_queues(il->hw); 1758 ieee80211_wake_queues(il->hw);
1759 1759
1760 il->active_rate = IL_RATES_MASK; 1760 il->active_rate = RATES_MASK;
1761 1761
1762 if (il_is_associated_ctx(ctx)) { 1762 if (il_is_associated_ctx(ctx)) {
1763 struct il_rxon_cmd *active_rxon = 1763 struct il_rxon_cmd *active_rxon =
@@ -2711,7 +2711,7 @@ static void il4965_init_hw_rates(struct il_priv *il,
2711{ 2711{
2712 int i; 2712 int i;
2713 2713
2714 for (i = 0; i < IL_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 indexes */
2717 rates[i].hw_value_short = i; 2717 rates[i].hw_value_short = i;
@@ -2721,7 +2721,7 @@ static void il4965_init_hw_rates(struct il_priv *il,
2721 * If CCK != 1M then set short preamble rate flag. 2721 * If CCK != 1M then set short preamble rate flag.
2722 */ 2722 */
2723 rates[i].flags |= 2723 rates[i].flags |=
2724 (il_rates[i].plcp == IL_RATE_1M_PLCP) ? 2724 (il_rates[i].plcp == RATE_1M_PLCP) ?
2725 0 : IEEE80211_RATE_SHORT_PREAMBLE; 2725 0 : IEEE80211_RATE_SHORT_PREAMBLE;
2726 } 2726 }
2727 } 2727 }