aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2011-08-26 09:49:28 -0400
committerStanislaw Gruszka <sgruszka@redhat.com>2011-11-15 06:26:33 -0500
commit6ce1dc45304eece672a36241cda587ba056d2b1f (patch)
treec6a7837c8d6af9f932f7cde0d235e10c4fb4a205 /drivers
parentebf0d90d12cf013019005a8ee7d1bc8599935356 (diff)
iwlegacy: s/window/win/
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-3945-rs.c108
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-hw.h4
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-rs.c134
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-tx.c14
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965.c2
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-commands.h16
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-core.c6
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-dev.h12
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-prph.h12
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-tx.c10
10 files changed, 159 insertions, 159 deletions
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-rs.c b/drivers/net/wireless/iwlegacy/iwl-3945-rs.c
index ebee6c350dbe..5c855e88b95e 100644
--- a/drivers/net/wireless/iwlegacy/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-3945-rs.c
@@ -131,24 +131,24 @@ static u8 il3945_get_rate_index_by_rssi(s32 rssi, enum ieee80211_band band)
131 return tpt_table[index].index; 131 return tpt_table[index].index;
132} 132}
133 133
134static void il3945_clear_window(struct il3945_rate_scale_data *window) 134static void il3945_clear_win(struct il3945_rate_scale_data *win)
135{ 135{
136 window->data = 0; 136 win->data = 0;
137 window->success_counter = 0; 137 win->success_counter = 0;
138 window->success_ratio = -1; 138 win->success_ratio = -1;
139 window->counter = 0; 139 win->counter = 0;
140 window->average_tpt = IL_INVALID_VALUE; 140 win->average_tpt = IL_INVALID_VALUE;
141 window->stamp = 0; 141 win->stamp = 0;
142} 142}
143 143
144/** 144/**
145 * il3945_rate_scale_flush_windows - flush out the rate scale windows 145 * il3945_rate_scale_flush_wins - flush out the rate scale wins
146 * 146 *
147 * Returns the number of windows that have gathered data but were 147 * Returns the number of wins that have gathered data but were
148 * not flushed. If there were any that were not flushed, then 148 * not flushed. If there were any that were not flushed, then
149 * reschedule the rate flushing routine. 149 * reschedule the rate flushing routine.
150 */ 150 */
151static int il3945_rate_scale_flush_windows(struct il3945_rs_sta *rs_sta) 151static int il3945_rate_scale_flush_wins(struct il3945_rs_sta *rs_sta)
152{ 152{
153 int unflushed = 0; 153 int unflushed = 0;
154 int i; 154 int i;
@@ -170,7 +170,7 @@ static int il3945_rate_scale_flush_windows(struct il3945_rs_sta *rs_sta)
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);
173 il3945_clear_window(&rs_sta->win[i]); 173 il3945_clear_win(&rs_sta->win[i]);
174 } else 174 } else
175 unflushed++; 175 unflushed++;
176 spin_unlock_irqrestore(&rs_sta->lock, flags); 176 spin_unlock_irqrestore(&rs_sta->lock, flags);
@@ -193,7 +193,7 @@ static void il3945_bg_rate_scale_flush(unsigned long data)
193 193
194 D_RATE("enter\n"); 194 D_RATE("enter\n");
195 195
196 unflushed = il3945_rate_scale_flush_windows(rs_sta); 196 unflushed = il3945_rate_scale_flush_wins(rs_sta);
197 197
198 spin_lock_irqsave(&rs_sta->lock, flags); 198 spin_lock_irqsave(&rs_sta->lock, flags);
199 199
@@ -248,14 +248,14 @@ static void il3945_bg_rate_scale_flush(unsigned long data)
248} 248}
249 249
250/** 250/**
251 * il3945_collect_tx_data - Update the success/failure sliding window 251 * il3945_collect_tx_data - Update the success/failure sliding win
252 * 252 *
253 * We keep a sliding window of the last 64 packets transmitted 253 * We keep a sliding win of the last 64 packets transmitted
254 * at this rate. window->data contains the bitmask of successful 254 * at this rate. win->data contains the bitmask of successful
255 * packets. 255 * packets.
256 */ 256 */
257static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta, 257static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta,
258 struct il3945_rate_scale_data *window, 258 struct il3945_rate_scale_data *win,
259 int success, int retries, int index) 259 int success, int retries, int index)
260{ 260{
261 unsigned long flags; 261 unsigned long flags;
@@ -271,34 +271,34 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta,
271 271
272 /* 272 /*
273 * Keep track of only the latest 62 tx frame attempts in this rate's 273 * Keep track of only the latest 62 tx frame attempts in this rate's
274 * history window; anything older isn't really relevant any more. 274 * history win; anything older isn't really relevant any more.
275 * If we have filled up the sliding window, drop the oldest attempt; 275 * If we have filled up the sliding win, drop the oldest attempt;
276 * if the oldest attempt (highest bit in bitmap) shows "success", 276 * if the oldest attempt (highest bit in bitmap) shows "success",
277 * subtract "1" from the success counter (this is the main reason 277 * subtract "1" from the success counter (this is the main reason
278 * we keep these bitmaps!). 278 * we keep these bitmaps!).
279 * */ 279 * */
280 while (retries > 0) { 280 while (retries > 0) {
281 if (window->counter >= IL_RATE_MAX_WINDOW) { 281 if (win->counter >= IL_RATE_MAX_WINDOW) {
282 282
283 /* remove earliest */ 283 /* remove earliest */
284 window->counter = IL_RATE_MAX_WINDOW - 1; 284 win->counter = IL_RATE_MAX_WINDOW - 1;
285 285
286 if (window->data & (1ULL << (IL_RATE_MAX_WINDOW - 1))) { 286 if (win->data & (1ULL << (IL_RATE_MAX_WINDOW - 1))) {
287 window->data &= ~(1ULL << (IL_RATE_MAX_WINDOW - 1)); 287 win->data &= ~(1ULL << (IL_RATE_MAX_WINDOW - 1));
288 window->success_counter--; 288 win->success_counter--;
289 } 289 }
290 } 290 }
291 291
292 /* Increment frames-attempted counter */ 292 /* Increment frames-attempted counter */
293 window->counter++; 293 win->counter++;
294 294
295 /* Shift bitmap by one frame (throw away oldest history), 295 /* Shift bitmap by one frame (throw away oldest history),
296 * OR in "1", and increment "success" if this 296 * OR in "1", and increment "success" if this
297 * frame was successful. */ 297 * frame was successful. */
298 window->data <<= 1; 298 win->data <<= 1;
299 if (success > 0) { 299 if (success > 0) {
300 window->success_counter++; 300 win->success_counter++;
301 window->data |= 0x1; 301 win->data |= 0x1;
302 success--; 302 success--;
303 } 303 }
304 304
@@ -306,24 +306,24 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta,
306 } 306 }
307 307
308 /* Calculate current success ratio, avoid divide-by-0! */ 308 /* Calculate current success ratio, avoid divide-by-0! */
309 if (window->counter > 0) 309 if (win->counter > 0)
310 window->success_ratio = 128 * (100 * window->success_counter) 310 win->success_ratio = 128 * (100 * win->success_counter)
311 / window->counter; 311 / win->counter;
312 else 312 else
313 window->success_ratio = IL_INVALID_VALUE; 313 win->success_ratio = IL_INVALID_VALUE;
314 314
315 fail_count = window->counter - window->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 >= IL_RATE_MIN_FAILURE_TH ||
319 window->success_counter >= IL_RATE_MIN_SUCCESS_TH) 319 win->success_counter >= IL_RATE_MIN_SUCCESS_TH)
320 window->average_tpt = ((window->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
323 window->average_tpt = IL_INVALID_VALUE; 323 win->average_tpt = IL_INVALID_VALUE;
324 324
325 /* Tag this window as having been updated */ 325 /* Tag this win as having been updated */
326 window->stamp = jiffies; 326 win->stamp = jiffies;
327 327
328 spin_unlock_irqrestore(&rs_sta->lock, flags); 328 spin_unlock_irqrestore(&rs_sta->lock, flags);
329 329
@@ -365,7 +365,7 @@ void il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_i
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 < IL_RATE_COUNT_3945; i++)
368 il3945_clear_window(&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
371 * the lowest or the highest rate.. Could consider using RSSI from 371 * the lowest or the highest rate.. Could consider using RSSI from
@@ -484,7 +484,7 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *
484 last_index = first_index; 484 last_index = first_index;
485 485
486 /* 486 /*
487 * Update the window for each rate. We determine which rates 487 * Update the win for each rate. We determine which rates
488 * were Tx'd based on the total number of retries vs. the number 488 * were Tx'd based on the total number of retries vs. the number
489 * of retries configured for each rate -- currently set to the 489 * of retries configured for each rate -- currently set to the
490 * il value 'retry_rate' vs. rate specific 490 * il value 'retry_rate' vs. rate specific
@@ -517,7 +517,7 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *
517 } 517 }
518 518
519 519
520 /* Update the last index window with success/failure based on ACK */ 520 /* Update the last index win with success/failure based on ACK */
521 D_RATE("Update rate %d with %s.\n", 521 D_RATE("Update rate %d with %s.\n",
522 last_index, 522 last_index,
523 (info->flags & IEEE80211_TX_STAT_ACK) ? 523 (info->flags & IEEE80211_TX_STAT_ACK) ?
@@ -526,7 +526,7 @@ static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *
526 &rs_sta->win[last_index], 526 &rs_sta->win[last_index],
527 info->flags & IEEE80211_TX_STAT_ACK, 1, last_index); 527 info->flags & IEEE80211_TX_STAT_ACK, 1, last_index);
528 528
529 /* We updated the rate scale window -- if its been more than 529 /* We updated the rate scale win -- if its been more than
530 * flush_time since the last run, schedule the flush 530 * flush_time since the last run, schedule the flush
531 * again */ 531 * again */
532 spin_lock_irqsave(&rs_sta->lock, flags); 532 spin_lock_irqsave(&rs_sta->lock, flags);
@@ -636,7 +636,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
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;
639 struct il3945_rate_scale_data *window = NULL; 639 struct il3945_rate_scale_data *win = NULL;
640 int current_tpt = IL_INVALID_VALUE; 640 int current_tpt = IL_INVALID_VALUE;
641 int low_tpt = IL_INVALID_VALUE; 641 int low_tpt = IL_INVALID_VALUE;
642 int high_tpt = IL_INVALID_VALUE; 642 int high_tpt = IL_INVALID_VALUE;
@@ -691,29 +691,29 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
691 index = max_rate_idx; 691 index = max_rate_idx;
692 } 692 }
693 693
694 window = &(rs_sta->win[index]); 694 win = &(rs_sta->win[index]);
695 695
696 fail_count = window->counter - window->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 < IL_RATE_MIN_FAILURE_TH &&
699 window->success_counter < IL_RATE_MIN_SUCCESS_TH) { 699 win->success_counter < IL_RATE_MIN_SUCCESS_TH) {
700 spin_unlock_irqrestore(&rs_sta->lock, flags); 700 spin_unlock_irqrestore(&rs_sta->lock, flags);
701 701
702 D_RATE("Invalid average_tpt on rate %d: " 702 D_RATE("Invalid average_tpt on rate %d: "
703 "counter: %d, success_counter: %d, " 703 "counter: %d, success_counter: %d, "
704 "expected_tpt is %sNULL\n", 704 "expected_tpt is %sNULL\n",
705 index, 705 index,
706 window->counter, 706 win->counter,
707 window->success_counter, 707 win->success_counter,
708 rs_sta->expected_tpt ? "not " : ""); 708 rs_sta->expected_tpt ? "not " : "");
709 709
710 /* Can't calculate this yet; not enough history */ 710 /* Can't calculate this yet; not enough history */
711 window->average_tpt = IL_INVALID_VALUE; 711 win->average_tpt = IL_INVALID_VALUE;
712 goto out; 712 goto out;
713 713
714 } 714 }
715 715
716 current_tpt = window->average_tpt; 716 current_tpt = win->average_tpt;
717 717
718 high_low = il3945_get_adjacent_rate(rs_sta, index, rate_mask, 718 high_low = il3945_get_adjacent_rate(rs_sta, index, rate_mask,
719 sband->band); 719 sband->band);
@@ -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 (window->success_ratio < IL_RATE_DECREASE_TH || !current_tpt) { 739 if (win->success_ratio < IL_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,7 +744,7 @@ 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 && window->success_ratio >= IL_RATE_INCREASE_TH) 747 if (high != IL_RATE_INVALID && win->success_ratio >= IL_RATE_INCREASE_TH)
748 scale_action = 1; 748 scale_action = 1;
749 else if (low != IL_RATE_INVALID) 749 else if (low != IL_RATE_INVALID)
750 scale_action = 0; 750 scale_action = 0;
@@ -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 window->success_ratio >= IL_RATE_INCREASE_TH) 771 win->success_ratio >= IL_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 (window->success_ratio >= IL_RATE_INCREASE_TH) { 783 } else if (win->success_ratio >= IL_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;
@@ -791,7 +791,7 @@ static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
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 != IL_RATE_INVALID &&
794 (window->success_ratio > IL_RATE_HIGH_TH || 794 (win->success_ratio > IL_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
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
index 21ff694421a9..83748c7ae93f 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h
@@ -773,8 +773,8 @@ enum {
773 * 773 *
774 * Each Tx queue uses a byte-count table containing 320 entries: 774 * Each Tx queue uses a byte-count table containing 320 entries:
775 * one 16-bit entry for each of 256 TFDs, plus an additional 64 entries that 775 * one 16-bit entry for each of 256 TFDs, plus an additional 64 entries that
776 * duplicate the first 64 entries (to avoid wrap-around within a Tx window; 776 * duplicate the first 64 entries (to avoid wrap-around within a Tx win;
777 * max Tx window is 64 TFDs). 777 * max Tx win is 64 TFDs).
778 * 778 *
779 * When driver sets up a new TFD, it must also enter the total byte count 779 * When driver sets up a new TFD, it must also enter the total byte count
780 * of the frame to be transmitted into the corresponding entry in the byte 780 * of the frame to be transmitted into the corresponding entry in the byte
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
index e99a20c8891d..5d88a452e1a3 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
@@ -46,7 +46,7 @@
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 window */ 49#define IL_RATE_MAX_WINDOW 62 /* # tx in history win */
50#define IL_RATE_MIN_FAILURE_TH 6 /* min failures to calc tpt */ 50#define IL_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 IL_RATE_MIN_SUCCESS_TH 8 /* min successes to calc tpt */
52 52
@@ -226,14 +226,14 @@ static inline u8 il4965_rs_extract_rate(u32 rate_n_flags)
226} 226}
227 227
228static void 228static void
229il4965_rs_rate_scale_clear_window(struct il_rate_scale_data *window) 229il4965_rs_rate_scale_clear_win(struct il_rate_scale_data *win)
230{ 230{
231 window->data = 0; 231 win->data = 0;
232 window->success_counter = 0; 232 win->success_counter = 0;
233 window->success_ratio = IL_INVALID_VALUE; 233 win->success_ratio = IL_INVALID_VALUE;
234 window->counter = 0; 234 win->counter = 0;
235 window->average_tpt = IL_INVALID_VALUE; 235 win->average_tpt = IL_INVALID_VALUE;
236 window->stamp = 0; 236 win->stamp = 0;
237} 237}
238 238
239static inline u8 il4965_rs_is_valid_ant(u8 valid_antenna, u8 ant_type) 239static inline u8 il4965_rs_is_valid_ant(u8 valid_antenna, u8 ant_type)
@@ -408,58 +408,58 @@ il4965_get_expected_tpt(struct il_scale_tbl_info *tbl, int rs_index)
408} 408}
409 409
410/** 410/**
411 * il4965_rs_collect_tx_data - Update the success/failure sliding window 411 * il4965_rs_collect_tx_data - Update the success/failure sliding win
412 * 412 *
413 * We keep a sliding window of the last 62 packets transmitted 413 * We keep a sliding win of the last 62 packets transmitted
414 * at this rate. window->data contains the bitmask of successful 414 * at this rate. win->data contains the bitmask of successful
415 * packets. 415 * packets.
416 */ 416 */
417static int il4965_rs_collect_tx_data(struct il_scale_tbl_info *tbl, 417static int il4965_rs_collect_tx_data(struct il_scale_tbl_info *tbl,
418 int scale_index, int attempts, int successes) 418 int scale_index, int attempts, int successes)
419{ 419{
420 struct il_rate_scale_data *window = 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) << (IL_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 >= IL_RATE_COUNT)
425 return -EINVAL; 425 return -EINVAL;
426 426
427 /* Select window for current tx bit rate */ 427 /* Select win for current tx bit rate */
428 window = &(tbl->win[scale_index]); 428 win = &(tbl->win[scale_index]);
429 429
430 /* Get expected throughput */ 430 /* Get expected throughput */
431 tpt = il4965_get_expected_tpt(tbl, scale_index); 431 tpt = il4965_get_expected_tpt(tbl, scale_index);
432 432
433 /* 433 /*
434 * Keep track of only the latest 62 tx frame attempts in this rate's 434 * Keep track of only the latest 62 tx frame attempts in this rate's
435 * history window; anything older isn't really relevant any more. 435 * history win; anything older isn't really relevant any more.
436 * If we have filled up the sliding window, drop the oldest attempt; 436 * If we have filled up the sliding win, drop the oldest attempt;
437 * if the oldest attempt (highest bit in bitmap) shows "success", 437 * if the oldest attempt (highest bit in bitmap) shows "success",
438 * subtract "1" from the success counter (this is the main reason 438 * subtract "1" from the success counter (this is the main reason
439 * we keep these bitmaps!). 439 * we keep these bitmaps!).
440 */ 440 */
441 while (attempts > 0) { 441 while (attempts > 0) {
442 if (window->counter >= IL_RATE_MAX_WINDOW) { 442 if (win->counter >= IL_RATE_MAX_WINDOW) {
443 443
444 /* remove earliest */ 444 /* remove earliest */
445 window->counter = IL_RATE_MAX_WINDOW - 1; 445 win->counter = IL_RATE_MAX_WINDOW - 1;
446 446
447 if (window->data & mask) { 447 if (win->data & mask) {
448 window->data &= ~mask; 448 win->data &= ~mask;
449 window->success_counter--; 449 win->success_counter--;
450 } 450 }
451 } 451 }
452 452
453 /* Increment frames-attempted counter */ 453 /* Increment frames-attempted counter */
454 window->counter++; 454 win->counter++;
455 455
456 /* Shift bitmap by one frame to throw away oldest history */ 456 /* Shift bitmap by one frame to throw away oldest history */
457 window->data <<= 1; 457 win->data <<= 1;
458 458
459 /* Mark the most recent #successes attempts as successful */ 459 /* Mark the most recent #successes attempts as successful */
460 if (successes > 0) { 460 if (successes > 0) {
461 window->success_counter++; 461 win->success_counter++;
462 window->data |= 0x1; 462 win->data |= 0x1;
463 successes--; 463 successes--;
464 } 464 }
465 465
@@ -467,23 +467,23 @@ static int il4965_rs_collect_tx_data(struct il_scale_tbl_info *tbl,
467 } 467 }
468 468
469 /* Calculate current success ratio, avoid divide-by-0! */ 469 /* Calculate current success ratio, avoid divide-by-0! */
470 if (window->counter > 0) 470 if (win->counter > 0)
471 window->success_ratio = 128 * (100 * window->success_counter) 471 win->success_ratio = 128 * (100 * win->success_counter)
472 / window->counter; 472 / win->counter;
473 else 473 else
474 window->success_ratio = IL_INVALID_VALUE; 474 win->success_ratio = IL_INVALID_VALUE;
475 475
476 fail_count = window->counter - window->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 >= IL_RATE_MIN_FAILURE_TH ||
480 window->success_counter >= IL_RATE_MIN_SUCCESS_TH) 480 win->success_counter >= IL_RATE_MIN_SUCCESS_TH)
481 window->average_tpt = (window->success_ratio * tpt + 64) / 128; 481 win->average_tpt = (win->success_ratio * tpt + 64) / 128;
482 else 482 else
483 window->average_tpt = IL_INVALID_VALUE; 483 win->average_tpt = IL_INVALID_VALUE;
484 484
485 /* Tag this window as having been updated */ 485 /* Tag this win as having been updated */
486 window->stamp = jiffies; 486 win->stamp = jiffies;
487 487
488 return 0; 488 return 0;
489} 489}
@@ -817,7 +817,7 @@ il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband,
817 struct il_rxon_context *ctx = sta_priv->common.ctx; 817 struct il_rxon_context *ctx = sta_priv->common.ctx;
818 818
819 D_RATE( 819 D_RATE(
820 "get frame ack response, update rate scale window\n"); 820 "get frame ack response, update rate scale win\n");
821 821
822 /* Treat uninitialized rate scaling data same as non-existing. */ 822 /* Treat uninitialized rate scaling data same as non-existing. */
823 if (!lq_sta) { 823 if (!lq_sta) {
@@ -1284,7 +1284,7 @@ static int il4965_rs_move_legacy_other(struct il_priv *il,
1284 struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1284 struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
1285 struct il_scale_tbl_info *search_tbl = 1285 struct il_scale_tbl_info *search_tbl =
1286 &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 1286 &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
1287 struct il_rate_scale_data *window = &(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) * IL_RATE_COUNT));
1290 u8 start_action; 1290 u8 start_action;
@@ -1310,7 +1310,7 @@ static int il4965_rs_move_legacy_other(struct il_priv *il,
1310 break; 1310 break;
1311 1311
1312 /* Don't change antenna if success has been great */ 1312 /* Don't change antenna if success has been great */
1313 if (window->success_ratio >= IL_RS_GOOD_RATIO) 1313 if (win->success_ratio >= IL_RS_GOOD_RATIO)
1314 break; 1314 break;
1315 1315
1316 /* Set up search table to try other antenna */ 1316 /* Set up search table to try other antenna */
@@ -1401,7 +1401,7 @@ static int il4965_rs_move_siso_to_other(struct il_priv *il,
1401 struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1401 struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
1402 struct il_scale_tbl_info *search_tbl = 1402 struct il_scale_tbl_info *search_tbl =
1403 &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 1403 &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
1404 struct il_rate_scale_data *window = &(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) * IL_RATE_COUNT));
@@ -1425,7 +1425,7 @@ static int il4965_rs_move_siso_to_other(struct il_priv *il,
1425 tx_chains_num <= 2)) 1425 tx_chains_num <= 2))
1426 break; 1426 break;
1427 1427
1428 if (window->success_ratio >= IL_RS_GOOD_RATIO) 1428 if (win->success_ratio >= IL_RS_GOOD_RATIO)
1429 break; 1429 break;
1430 1430
1431 memcpy(search_tbl, tbl, sz); 1431 memcpy(search_tbl, tbl, sz);
@@ -1523,7 +1523,7 @@ static int il4965_rs_move_mimo2_to_other(struct il_priv *il,
1523 struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1523 struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
1524 struct il_scale_tbl_info *search_tbl = 1524 struct il_scale_tbl_info *search_tbl =
1525 &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 1525 &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
1526 struct il_rate_scale_data *window = &(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) * IL_RATE_COUNT));
@@ -1544,7 +1544,7 @@ static int il4965_rs_move_mimo2_to_other(struct il_priv *il,
1544 if (tx_chains_num <= 2) 1544 if (tx_chains_num <= 2)
1545 break; 1545 break;
1546 1546
1547 if (window->success_ratio >= IL_RS_GOOD_RATIO) 1547 if (win->success_ratio >= IL_RS_GOOD_RATIO)
1548 break; 1548 break;
1549 1549
1550 memcpy(search_tbl, tbl, sz); 1550 memcpy(search_tbl, tbl, sz);
@@ -1704,7 +1704,7 @@ il4965_rs_stay_in_table(struct il_lq_sta *lq_sta, bool force_search)
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 < IL_RATE_COUNT; i++)
1707 il4965_rs_rate_scale_clear_window( 1707 il4965_rs_rate_scale_clear_win(
1708 &(tbl->win[i])); 1708 &(tbl->win[i]));
1709 } 1709 }
1710 } 1710 }
@@ -1714,7 +1714,7 @@ il4965_rs_stay_in_table(struct il_lq_sta *lq_sta, bool force_search)
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 < IL_RATE_COUNT; i++)
1717 il4965_rs_rate_scale_clear_window( 1717 il4965_rs_rate_scale_clear_win(
1718 &(tbl->win[i])); 1718 &(tbl->win[i]));
1719 } 1719 }
1720 } 1720 }
@@ -1756,7 +1756,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
1756 int high = IL_RATE_INVALID; 1756 int high = IL_RATE_INVALID;
1757 int index; 1757 int index;
1758 int i; 1758 int i;
1759 struct il_rate_scale_data *window = NULL; 1759 struct il_rate_scale_data *win = NULL;
1760 int current_tpt = IL_INVALID_VALUE; 1760 int current_tpt = IL_INVALID_VALUE;
1761 int low_tpt = IL_INVALID_VALUE; 1761 int low_tpt = IL_INVALID_VALUE;
1762 int high_tpt = IL_INVALID_VALUE; 1762 int high_tpt = IL_INVALID_VALUE;
@@ -1859,7 +1859,7 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
1859 return; 1859 return;
1860 } 1860 }
1861 1861
1862 /* Get expected throughput table and history window for current rate */ 1862 /* Get expected throughput table and history win for current rate */
1863 if (!tbl->expected_tpt) { 1863 if (!tbl->expected_tpt) {
1864 IL_ERR("tbl->expected_tpt is NULL\n"); 1864 IL_ERR("tbl->expected_tpt is NULL\n");
1865 return; 1865 return;
@@ -1870,11 +1870,11 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
1870 lq_sta->max_rate_idx < index) { 1870 lq_sta->max_rate_idx < index) {
1871 index = lq_sta->max_rate_idx; 1871 index = lq_sta->max_rate_idx;
1872 update_lq = 1; 1872 update_lq = 1;
1873 window = &(tbl->win[index]); 1873 win = &(tbl->win[index]);
1874 goto lq_update; 1874 goto lq_update;
1875 } 1875 }
1876 1876
1877 window = &(tbl->win[index]); 1877 win = &(tbl->win[index]);
1878 1878
1879 /* 1879 /*
1880 * If there is not enough history to calculate actual average 1880 * If there is not enough history to calculate actual average
@@ -1883,15 +1883,15 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
1883 * Set up new rate table in uCode only if old rate is not supported 1883 * Set up new rate table in uCode only if old rate is not supported
1884 * in current association (use new rate found above). 1884 * in current association (use new rate found above).
1885 */ 1885 */
1886 fail_count = window->counter - window->success_counter; 1886 fail_count = win->counter - win->success_counter;
1887 if (fail_count < IL_RATE_MIN_FAILURE_TH && 1887 if (fail_count < IL_RATE_MIN_FAILURE_TH &&
1888 window->success_counter < IL_RATE_MIN_SUCCESS_TH) { 1888 win->success_counter < IL_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 window->success_counter, window->counter, index); 1891 win->success_counter, win->counter, index);
1892 1892
1893 /* Can't calculate this yet; not enough history */ 1893 /* Can't calculate this yet; not enough history */
1894 window->average_tpt = IL_INVALID_VALUE; 1894 win->average_tpt = IL_INVALID_VALUE;
1895 1895
1896 /* Should we stay with this modulation mode, 1896 /* Should we stay with this modulation mode,
1897 * or search for a new one? */ 1897 * or search for a new one? */
@@ -1901,11 +1901,11 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
1901 } 1901 }
1902 /* Else we have enough samples; calculate estimate of 1902 /* Else we have enough samples; calculate estimate of
1903 * actual average throughput */ 1903 * actual average throughput */
1904 if (window->average_tpt != ((window->success_ratio * 1904 if (win->average_tpt != ((win->success_ratio *
1905 tbl->expected_tpt[index] + 64) / 128)) { 1905 tbl->expected_tpt[index] + 64) / 128)) {
1906 IL_ERR( 1906 IL_ERR(
1907 "expected_tpt should have been calculated by now\n"); 1907 "expected_tpt should have been calculated by now\n");
1908 window->average_tpt = ((window->success_ratio * 1908 win->average_tpt = ((win->success_ratio *
1909 tbl->expected_tpt[index] + 64) / 128); 1909 tbl->expected_tpt[index] + 64) / 128);
1910 } 1910 }
1911 1911
@@ -1914,12 +1914,12 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
1914 /* If good success, continue using the "search" mode; 1914 /* If good success, continue using the "search" mode;
1915 * no need to send new link quality command, since we're 1915 * no need to send new link quality command, since we're
1916 * continuing to use the setup that we've been trying. */ 1916 * continuing to use the setup that we've been trying. */
1917 if (window->average_tpt > lq_sta->last_tpt) { 1917 if (win->average_tpt > lq_sta->last_tpt) {
1918 1918
1919 D_RATE("LQ: SWITCHING TO NEW TABLE " 1919 D_RATE("LQ: SWITCHING TO NEW TABLE "
1920 "suc=%d cur-tpt=%d old-tpt=%d\n", 1920 "suc=%d cur-tpt=%d old-tpt=%d\n",
1921 window->success_ratio, 1921 win->success_ratio,
1922 window->average_tpt, 1922 win->average_tpt,
1923 lq_sta->last_tpt); 1923 lq_sta->last_tpt);
1924 1924
1925 if (!is_legacy(tbl->lq_type)) 1925 if (!is_legacy(tbl->lq_type))
@@ -1927,15 +1927,15 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
1927 1927
1928 /* Swap tables; "search" becomes "active" */ 1928 /* Swap tables; "search" becomes "active" */
1929 lq_sta->active_tbl = active_tbl; 1929 lq_sta->active_tbl = active_tbl;
1930 current_tpt = window->average_tpt; 1930 current_tpt = win->average_tpt;
1931 1931
1932 /* Else poor success; go back to mode in "active" table */ 1932 /* Else poor success; go back to mode in "active" table */
1933 } else { 1933 } else {
1934 1934
1935 D_RATE("LQ: GOING BACK TO THE OLD TABLE " 1935 D_RATE("LQ: GOING BACK TO THE OLD TABLE "
1936 "suc=%d cur-tpt=%d old-tpt=%d\n", 1936 "suc=%d cur-tpt=%d old-tpt=%d\n",
1937 window->success_ratio, 1937 win->success_ratio,
1938 window->average_tpt, 1938 win->average_tpt,
1939 lq_sta->last_tpt); 1939 lq_sta->last_tpt);
1940 1940
1941 /* Nullify "search" table */ 1941 /* Nullify "search" table */
@@ -1973,10 +1973,10 @@ static void il4965_rs_rate_scale_perform(struct il_priv *il,
1973 lq_sta->max_rate_idx < high) 1973 lq_sta->max_rate_idx < high)
1974 high = IL_RATE_INVALID; 1974 high = IL_RATE_INVALID;
1975 1975
1976 sr = window->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 = window->average_tpt; 1979 current_tpt = win->average_tpt;
1980 if (low != IL_RATE_INVALID) 1980 if (low != IL_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 != IL_RATE_INVALID)
@@ -2082,7 +2082,7 @@ lq_update:
2082 * 3) Allowing a new search 2082 * 3) Allowing a new search
2083 */ 2083 */
2084 if (!update_lq && !done_search && !lq_sta->stay_in_tbl && 2084 if (!update_lq && !done_search && !lq_sta->stay_in_tbl &&
2085 window->counter) { 2085 win->counter) {
2086 /* Save current throughput to compare with "search" throughput*/ 2086 /* Save current throughput to compare with "search" throughput*/
2087 lq_sta->last_tpt = current_tpt; 2087 lq_sta->last_tpt = current_tpt;
2088 2088
@@ -2103,7 +2103,7 @@ lq_update:
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 < IL_RATE_COUNT; i++)
2106 il4965_rs_rate_scale_clear_window( 2106 il4965_rs_rate_scale_clear_win(
2107 &(tbl->win[i])); 2107 &(tbl->win[i]));
2108 2108
2109 /* Use new "search" start rate */ 2109 /* Use new "search" start rate */
@@ -2314,7 +2314,7 @@ static void *il4965_rs_alloc_sta(void *il_rate, struct ieee80211_sta *sta,
2314 struct il_priv *il; 2314 struct il_priv *il;
2315 2315
2316 il = (struct il_priv *)il_rate; 2316 il = (struct il_priv *)il_rate;
2317 D_RATE("create station rate scale window\n"); 2317 D_RATE("create station rate scale win\n");
2318 2318
2319 lq_sta = &sta_priv->lq_sta; 2319 lq_sta = &sta_priv->lq_sta;
2320 2320
@@ -2346,14 +2346,14 @@ il4965_rs_rate_init(struct il_priv *il,
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 < IL_RATE_COUNT; i++)
2349 il4965_rs_rate_scale_clear_window( 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 < IL_RATE_COUNT; i++)
2356 il4965_rs_rate_scale_clear_window( 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
2359 D_RATE("LQ:" 2359 D_RATE("LQ:"
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
index dff48e89862e..68c86e009cf3 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
@@ -834,7 +834,7 @@ static int il4965_txq_agg_enable(struct il_priv *il, int txq_id,
834 il->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); 834 il->txq[txq_id].q.write_ptr = (ssn_idx & 0xff);
835 il4965_set_wr_ptrs(il, txq_id, ssn_idx); 835 il4965_set_wr_ptrs(il, txq_id, ssn_idx);
836 836
837 /* Set up Tx window size and frame limit for this queue */ 837 /* Set up Tx win size and frame limit for this queue */
838 il_write_targ_mem(il, 838 il_write_targ_mem(il,
839 il->scd_base_addr + IL49_SCD_CONTEXT_QUEUE_OFFSET(txq_id), 839 il->scd_base_addr + IL49_SCD_CONTEXT_QUEUE_OFFSET(txq_id),
840 (SCD_WIN_SIZE << IL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & 840 (SCD_WIN_SIZE << IL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) &
@@ -1171,7 +1171,7 @@ static int il4965_tx_status_reply_compressed_ba(struct il_priv *il,
1171 D_TX_REPLY("BA %d %d\n", agg->start_idx, 1171 D_TX_REPLY("BA %d %d\n", agg->start_idx,
1172 ba_resp->seq_ctl); 1172 ba_resp->seq_ctl);
1173 1173
1174 /* Calculate shift to align block-ack bits with our Tx window bits */ 1174 /* Calculate shift to align block-ack bits with our Tx win bits */
1175 sh = agg->start_idx - SEQ_TO_INDEX(seq_ctl >> 4); 1175 sh = agg->start_idx - SEQ_TO_INDEX(seq_ctl >> 4);
1176 if (sh < 0) /* tbw something is wrong with indices */ 1176 if (sh < 0) /* tbw something is wrong with indices */
1177 sh += 0x100; 1177 sh += 0x100;
@@ -1260,8 +1260,8 @@ void il4965_rx_reply_compressed_ba(struct il_priv *il,
1260 /* "flow" corresponds to Tx queue */ 1260 /* "flow" corresponds to Tx queue */
1261 u16 scd_flow = le16_to_cpu(ba_resp->scd_flow); 1261 u16 scd_flow = le16_to_cpu(ba_resp->scd_flow);
1262 1262
1263 /* "ssn" is start of block-ack Tx window, corresponds to index 1263 /* "ssn" is start of block-ack Tx win, corresponds to index
1264 * (in Tx queue's circular buffer) of first TFD/frame in window */ 1264 * (in Tx queue's circular buffer) of first TFD/frame in win */
1265 u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn); 1265 u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn);
1266 1266
1267 if (scd_flow >= il->hw_params.max_txq_num) { 1267 if (scd_flow >= il->hw_params.max_txq_num) {
@@ -1287,7 +1287,7 @@ void il4965_rx_reply_compressed_ba(struct il_priv *il,
1287 return; 1287 return;
1288 } 1288 }
1289 1289
1290 /* Find index just before block-ack window */ 1290 /* Find index just before block-ack win */
1291 index = il_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd); 1291 index = il_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd);
1292 1292
1293 spin_lock_irqsave(&il->sta_lock, flags); 1293 spin_lock_irqsave(&il->sta_lock, flags);
@@ -1309,11 +1309,11 @@ void il4965_rx_reply_compressed_ba(struct il_priv *il,
1309 agg->start_idx, 1309 agg->start_idx,
1310 (unsigned long long)agg->bitmap); 1310 (unsigned long long)agg->bitmap);
1311 1311
1312 /* Update driver's record of ACK vs. not for each frame in window */ 1312 /* Update driver's record of ACK vs. not for each frame in win */
1313 il4965_tx_status_reply_compressed_ba(il, agg, ba_resp); 1313 il4965_tx_status_reply_compressed_ba(il, agg, ba_resp);
1314 1314
1315 /* Release all TFDs before the SSN, i.e. all TFDs in front of 1315 /* Release all TFDs before the SSN, i.e. all TFDs in front of
1316 * block-ack window (we assume that they've been successfully 1316 * block-ack win (we assume that they've been successfully
1317 * transmitted ... if not, it's too late anyway). */ 1317 * transmitted ... if not, it's too late anyway). */
1318 if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) { 1318 if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) {
1319 /* calculate mac80211 ampdu sw queue to wake */ 1319 /* calculate mac80211 ampdu sw queue to wake */
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.c b/drivers/net/wireless/iwlegacy/iwl-4965.c
index 9cfc14001d3d..f62475de7591 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965.c
@@ -1649,7 +1649,7 @@ static int il4965_tx_status_reply_tx(struct il_priv *il,
1649 u64 bitmap = 0; 1649 u64 bitmap = 0;
1650 int start = agg->start_idx; 1650 int start = agg->start_idx;
1651 1651
1652 /* Construct bit-map of pending frames within Tx window */ 1652 /* Construct bit-map of pending frames within Tx win */
1653 for (i = 0; i < agg->frame_count; i++) { 1653 for (i = 0; i < agg->frame_count; i++) {
1654 u16 sc; 1654 u16 sc;
1655 status = le16_to_cpu(frame_status[i].status); 1655 status = le16_to_cpu(frame_status[i].status);
diff --git a/drivers/net/wireless/iwlegacy/iwl-commands.h b/drivers/net/wireless/iwlegacy/iwl-commands.h
index ea6c0f50ecf7..d1876d05e7f0 100644
--- a/drivers/net/wireless/iwlegacy/iwl-commands.h
+++ b/drivers/net/wireless/iwlegacy/iwl-commands.h
@@ -754,7 +754,7 @@ struct il4965_rxon_assoc_cmd {
754struct il_rxon_time_cmd { 754struct il_rxon_time_cmd {
755 __le64 timestamp; 755 __le64 timestamp;
756 __le16 beacon_interval; 756 __le16 beacon_interval;
757 __le16 atim_window; 757 __le16 atim_win;
758 __le32 beacon_init_val; 758 __le32 beacon_init_val;
759 __le16 listen_interval; 759 __le16 listen_interval;
760 u8 dtim_period; 760 u8 dtim_period;
@@ -803,15 +803,15 @@ struct il_csa_notification {
803 * struct il_ac_qos -- QOS timing params for REPLY_QOS_PARAM 803 * struct il_ac_qos -- QOS timing params for REPLY_QOS_PARAM
804 * One for each of 4 EDCA access categories in struct il_qosparam_cmd 804 * One for each of 4 EDCA access categories in struct il_qosparam_cmd
805 * 805 *
806 * @cw_min: Contention window, start value in numbers of slots. 806 * @cw_min: Contention win, start value in numbers of slots.
807 * Should be a power-of-2, minus 1. Device's default is 0x0f. 807 * Should be a power-of-2, minus 1. Device's default is 0x0f.
808 * @cw_max: Contention window, max value in numbers of slots. 808 * @cw_max: Contention win, max value in numbers of slots.
809 * Should be a power-of-2, minus 1. Device's default is 0x3f. 809 * Should be a power-of-2, minus 1. Device's default is 0x3f.
810 * @aifsn: Number of slots in Arbitration Interframe Space (before 810 * @aifsn: Number of slots in Arbitration Interframe Space (before
811 * performing random backoff timing prior to Tx). Device default 1. 811 * performing random backoff timing prior to Tx). Device default 1.
812 * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0. 812 * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0.
813 * 813 *
814 * Device will automatically increase contention window by (2*CW) + 1 for each 814 * Device will automatically increase contention win by (2*CW) + 1 for each
815 * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW 815 * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW
816 * value, to cap the CW value. 816 * value, to cap the CW value.
817 */ 817 */
@@ -1948,13 +1948,13 @@ struct il_link_qual_agg_params {
1948 * speculative mode as the new current active mode. 1948 * speculative mode as the new current active mode.
1949 * 1949 *
1950 * Each history set contains, separately for each possible rate, data for a 1950 * Each history set contains, separately for each possible rate, data for a
1951 * sliding window of the 62 most recent tx attempts at that rate. The data 1951 * sliding win of the 62 most recent tx attempts at that rate. The data
1952 * includes a shifting bitmap of success(1)/failure(0), and sums of successful 1952 * includes a shifting bitmap of success(1)/failure(0), and sums of successful
1953 * and attempted frames, from which the driver can additionally calculate a 1953 * and attempted frames, from which the driver can additionally calculate a
1954 * success ratio (success / attempted) and number of failures 1954 * success ratio (success / attempted) and number of failures
1955 * (attempted - success), and control the size of the window (attempted). 1955 * (attempted - success), and control the size of the win (attempted).
1956 * The driver uses the bit map to remove successes from the success sum, as 1956 * The driver uses the bit map to remove successes from the success sum, as
1957 * the oldest tx attempts fall out of the window. 1957 * the oldest tx attempts fall out of the win.
1958 * 1958 *
1959 * When the 4965 device makes multiple tx attempts for a given frame, each 1959 * When the 4965 device makes multiple tx attempts for a given frame, each
1960 * attempt might be at a different rate, and have different modulation 1960 * attempt might be at a different rate, and have different modulation
@@ -2017,7 +2017,7 @@ struct il_link_qual_agg_params {
2017 * 2017 *
2018 * 6) Re-evaluate the rate after each tx frame. If working with block- 2018 * 6) Re-evaluate the rate after each tx frame. If working with block-
2019 * acknowledge, history and stats may be calculated for the entire 2019 * acknowledge, history and stats may be calculated for the entire
2020 * block (including prior history that fits within the history windows), 2020 * block (including prior history that fits within the history wins),
2021 * before re-evaluation. 2021 * before re-evaluation.
2022 * 2022 *
2023 * FINDING BEST STARTING MODULATION MODE: 2023 * FINDING BEST STARTING MODULATION MODE:
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c
index 475bcac7aa9e..6742a6558ba9 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.c
+++ b/drivers/net/wireless/iwlegacy/iwl-core.c
@@ -380,10 +380,10 @@ il_send_rxon_timing(struct il_priv *il, struct il_rxon_context *ctx)
380 beacon_int = vif ? vif->bss_conf.beacon_int : 0; 380 beacon_int = vif ? vif->bss_conf.beacon_int : 0;
381 381
382 /* 382 /*
383 * TODO: For IBSS we need to get atim_window from mac80211, 383 * TODO: For IBSS we need to get atim_win from mac80211,
384 * for now just always use 0 384 * for now just always use 0
385 */ 385 */
386 ctx->timing.atim_window = 0; 386 ctx->timing.atim_win = 0;
387 387
388 beacon_int = il_adjust_beacon_interval(beacon_int, 388 beacon_int = il_adjust_beacon_interval(beacon_int,
389 il->hw_params.max_beacon_itrvl * TIME_UNIT); 389 il->hw_params.max_beacon_itrvl * TIME_UNIT);
@@ -400,7 +400,7 @@ il_send_rxon_timing(struct il_priv *il, struct il_rxon_context *ctx)
400 "beacon interval %d beacon timer %d beacon tim %d\n", 400 "beacon interval %d beacon timer %d beacon tim %d\n",
401 le16_to_cpu(ctx->timing.beacon_interval), 401 le16_to_cpu(ctx->timing.beacon_interval),
402 le32_to_cpu(ctx->timing.beacon_init_val), 402 le32_to_cpu(ctx->timing.beacon_init_val),
403 le16_to_cpu(ctx->timing.atim_window)); 403 le16_to_cpu(ctx->timing.atim_win));
404 404
405 return il_send_cmd_pdu(il, ctx->rxon_timing_cmd, 405 return il_send_cmd_pdu(il, ctx->rxon_timing_cmd,
406 sizeof(ctx->timing), &ctx->timing); 406 sizeof(ctx->timing), &ctx->timing);
diff --git a/drivers/net/wireless/iwlegacy/iwl-dev.h b/drivers/net/wireless/iwlegacy/iwl-dev.h
index 4388538b9de8..18dd253b43f7 100644
--- a/drivers/net/wireless/iwlegacy/iwl-dev.h
+++ b/drivers/net/wireless/iwlegacy/iwl-dev.h
@@ -129,7 +129,7 @@ struct il_queue {
129 int read_ptr; /* last used entry (index) host_r*/ 129 int read_ptr; /* last used entry (index) host_r*/
130 /* use for monitoring and recovering the stuck queue */ 130 /* use for monitoring and recovering the stuck queue */
131 dma_addr_t dma_addr; /* physical addr for BD's */ 131 dma_addr_t dma_addr; /* physical addr for BD's */
132 int n_window; /* safe queue window */ 132 int n_win; /* safe queue win */
133 u32 id; 133 u32 id;
134 int low_mark; /* low watermark, resume queue if free 134 int low_mark; /* low watermark, resume queue if free
135 * space more than this */ 135 * space more than this */
@@ -377,9 +377,9 @@ struct il_rx_queue {
377 * @txq_id: Tx queue used for Tx attempt 377 * @txq_id: Tx queue used for Tx attempt
378 * @frame_count: # frames attempted by Tx command 378 * @frame_count: # frames attempted by Tx command
379 * @wait_for_ba: Expect block-ack before next Tx reply 379 * @wait_for_ba: Expect block-ack before next Tx reply
380 * @start_idx: Index of 1st Transmit Frame Descriptor (TFD) in Tx window 380 * @start_idx: Index of 1st Transmit Frame Descriptor (TFD) in Tx win
381 * @bitmap0: Low order bitmap, one bit for each frame pending ACK in Tx window 381 * @bitmap0: Low order bitmap, one bit for each frame pending ACK in Tx win
382 * @bitmap1: High order, one bit for each frame pending ACK in Tx window 382 * @bitmap1: High order, one bit for each frame pending ACK in Tx win
383 * @rate_n_flags: Rate at which Tx was attempted 383 * @rate_n_flags: Rate at which Tx was attempted
384 * 384 *
385 * If REPLY_TX indicates that aggregation was attempted, driver must wait 385 * If REPLY_TX indicates that aggregation was attempted, driver must wait
@@ -645,10 +645,10 @@ static inline u8 il_get_cmd_index(struct il_queue *q, u32 index,
645 * the big buffer at end of command array 645 * the big buffer at end of command array
646 */ 646 */
647 if (is_huge) 647 if (is_huge)
648 return q->n_window; /* must be power of 2 */ 648 return q->n_win; /* must be power of 2 */
649 649
650 /* Otherwise, use normal size buffers */ 650 /* Otherwise, use normal size buffers */
651 return index & (q->n_window - 1); 651 return index & (q->n_win - 1);
652} 652}
653 653
654 654
diff --git a/drivers/net/wireless/iwlegacy/iwl-prph.h b/drivers/net/wireless/iwlegacy/iwl-prph.h
index caa383726787..200f2955ab54 100644
--- a/drivers/net/wireless/iwlegacy/iwl-prph.h
+++ b/drivers/net/wireless/iwlegacy/iwl-prph.h
@@ -274,13 +274,13 @@
274 * The driver sets up each queue to work in one of two modes: 274 * The driver sets up each queue to work in one of two modes:
275 * 275 *
276 * 1) Scheduler-Ack, in which the scheduler automatically supports a 276 * 1) Scheduler-Ack, in which the scheduler automatically supports a
277 * block-ack (BA) window of up to 64 TFDs. In this mode, each queue 277 * block-ack (BA) win of up to 64 TFDs. In this mode, each queue
278 * contains TFDs for a unique combination of Recipient Address (RA) 278 * contains TFDs for a unique combination of Recipient Address (RA)
279 * and Traffic Identifier (TID), that is, traffic of a given 279 * and Traffic Identifier (TID), that is, traffic of a given
280 * Quality-Of-Service (QOS) priority, destined for a single station. 280 * Quality-Of-Service (QOS) priority, destined for a single station.
281 * 281 *
282 * In scheduler-ack mode, the scheduler keeps track of the Tx status of 282 * In scheduler-ack mode, the scheduler keeps track of the Tx status of
283 * each frame within the BA window, including whether it's been transmitted, 283 * each frame within the BA win, including whether it's been transmitted,
284 * and whether it's been acknowledged by the receiving station. The device 284 * and whether it's been acknowledged by the receiving station. The device
285 * automatically processes block-acks received from the receiving STA, 285 * automatically processes block-acks received from the receiving STA,
286 * and reschedules un-acked frames to be retransmitted (successful 286 * and reschedules un-acked frames to be retransmitted (successful
@@ -316,7 +316,7 @@
316 */ 316 */
317 317
318/** 318/**
319 * Max Tx window size is the max number of contiguous TFDs that the scheduler 319 * Max Tx win size is the max number of contiguous TFDs that the scheduler
320 * can keep track of at one time when creating block-ack chains of frames. 320 * can keep track of at one time when creating block-ack chains of frames.
321 * Note that "64" matches the number of ack bits in a block-ack packet. 321 * Note that "64" matches the number of ack bits in a block-ack packet.
322 * Driver should use SCD_WIN_SIZE and SCD_FRAME_LIMIT values to initialize 322 * Driver should use SCD_WIN_SIZE and SCD_FRAME_LIMIT values to initialize
@@ -377,7 +377,7 @@
377/* 377/*
378 * Queue (x) Read Pointers (indexes, really!), one for each Tx queue. 378 * Queue (x) Read Pointers (indexes, really!), one for each Tx queue.
379 * For FIFO mode, index indicates next frame to transmit. 379 * For FIFO mode, index indicates next frame to transmit.
380 * For Scheduler-ACK mode, index indicates first frame in Tx window. 380 * For Scheduler-ACK mode, index indicates first frame in Tx win.
381 * Initialized by driver, updated by scheduler. 381 * Initialized by driver, updated by scheduler.
382 */ 382 */
383#define IL49_SCD_QUEUE_RDPTR(x) (IL49_SCD_START_OFFSET + 0x64 + (x) * 4) 383#define IL49_SCD_QUEUE_RDPTR(x) (IL49_SCD_START_OFFSET + 0x64 + (x) * 4)
@@ -414,7 +414,7 @@
414 * Driver should init to "1" for aggregation mode, or "0" otherwise. 414 * Driver should init to "1" for aggregation mode, or "0" otherwise.
415 * 7-6: Driver should init to "0" 415 * 7-6: Driver should init to "0"
416 * 5: Window Size Left; indicates whether scheduler can request 416 * 5: Window Size Left; indicates whether scheduler can request
417 * another TFD, based on window size, etc. Driver should init 417 * another TFD, based on win size, etc. Driver should init
418 * this bit to "1" for aggregation mode, or "0" for non-agg. 418 * this bit to "1" for aggregation mode, or "0" for non-agg.
419 * 4-1: Tx FIFO to use (range 0-7). 419 * 4-1: Tx FIFO to use (range 0-7).
420 * 0: Queue is active (1), not active (0). 420 * 0: Queue is active (1), not active (0).
@@ -460,7 +460,7 @@
460 * each queue's entry as follows: 460 * each queue's entry as follows:
461 * 461 *
462 * LS Dword bit fields: 462 * LS Dword bit fields:
463 * 0-06: Max Tx window size for Scheduler-ACK. Driver should init to 64. 463 * 0-06: Max Tx win size for Scheduler-ACK. Driver should init to 64.
464 * 464 *
465 * MS Dword bit fields: 465 * MS Dword bit fields:
466 * 16-22: Frame limit. Driver should init to 10 (0xa). 466 * 16-22: Frame limit. Driver should init to 10 (0xa).
diff --git a/drivers/net/wireless/iwlegacy/iwl-tx.c b/drivers/net/wireless/iwlegacy/iwl-tx.c
index 2e95b7885c6d..b9c417ce52b3 100644
--- a/drivers/net/wireless/iwlegacy/iwl-tx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-tx.c
@@ -165,7 +165,7 @@ void il_cmd_queue_unmap(struct il_priv *il)
165 q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd); 165 q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd);
166 } 166 }
167 167
168 i = q->n_window; 168 i = q->n_win;
169 if (txq->meta[i].flags & CMD_MAPPED) { 169 if (txq->meta[i].flags & CMD_MAPPED) {
170 pci_unmap_single(il->pci_dev, 170 pci_unmap_single(il->pci_dev,
171 dma_unmap_addr(&txq->meta[i], mapping), 171 dma_unmap_addr(&txq->meta[i], mapping),
@@ -243,7 +243,7 @@ int il_queue_space(const struct il_queue *q)
243 s -= q->n_bd; 243 s -= q->n_bd;
244 244
245 if (s <= 0) 245 if (s <= 0)
246 s += q->n_window; 246 s += q->n_win;
247 /* keep some reserve to not confuse empty and full situations */ 247 /* keep some reserve to not confuse empty and full situations */
248 s -= 2; 248 s -= 2;
249 if (s < 0) 249 if (s < 0)
@@ -260,7 +260,7 @@ static int il_queue_init(struct il_priv *il, struct il_queue *q,
260 int count, int slots_num, u32 id) 260 int count, int slots_num, u32 id)
261{ 261{
262 q->n_bd = count; 262 q->n_bd = count;
263 q->n_window = slots_num; 263 q->n_win = slots_num;
264 q->id = id; 264 q->id = id;
265 265
266 /* count must be power-of-two size, otherwise il_queue_inc_wrap 266 /* count must be power-of-two size, otherwise il_queue_inc_wrap
@@ -271,11 +271,11 @@ static int il_queue_init(struct il_priv *il, struct il_queue *q,
271 * il_get_cmd_index is broken. */ 271 * il_get_cmd_index is broken. */
272 BUG_ON(!is_power_of_2(slots_num)); 272 BUG_ON(!is_power_of_2(slots_num));
273 273
274 q->low_mark = q->n_window / 4; 274 q->low_mark = q->n_win / 4;
275 if (q->low_mark < 4) 275 if (q->low_mark < 4)
276 q->low_mark = 4; 276 q->low_mark = 4;
277 277
278 q->high_mark = q->n_window / 8; 278 q->high_mark = q->n_win / 8;
279 if (q->high_mark < 2) 279 if (q->high_mark < 2)
280 q->high_mark = 2; 280 q->high_mark = 2;
281 281