diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-3945-rs.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 93 |
1 files changed, 62 insertions, 31 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c index 21c841847d88..044abf734eb6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved. | 3 | * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or modify it |
6 | * under the terms of version 2 of the GNU General Public License as | 6 | * under the terms of version 2 of the GNU General Public License as |
@@ -36,6 +36,7 @@ | |||
36 | 36 | ||
37 | #include <linux/workqueue.h> | 37 | #include <linux/workqueue.h> |
38 | 38 | ||
39 | #include "iwl-commands.h" | ||
39 | #include "iwl-3945.h" | 40 | #include "iwl-3945.h" |
40 | 41 | ||
41 | #define RS_NAME "iwl-3945-rs" | 42 | #define RS_NAME "iwl-3945-rs" |
@@ -51,6 +52,7 @@ struct iwl3945_rate_scale_data { | |||
51 | 52 | ||
52 | struct iwl3945_rs_sta { | 53 | struct iwl3945_rs_sta { |
53 | spinlock_t lock; | 54 | spinlock_t lock; |
55 | struct iwl_priv *priv; | ||
54 | s32 *expected_tpt; | 56 | s32 *expected_tpt; |
55 | unsigned long last_partial_flush; | 57 | unsigned long last_partial_flush; |
56 | unsigned long last_flush; | 58 | unsigned long last_flush; |
@@ -62,7 +64,7 @@ struct iwl3945_rs_sta { | |||
62 | u8 start_rate; | 64 | u8 start_rate; |
63 | u8 ibss_sta_added; | 65 | u8 ibss_sta_added; |
64 | struct timer_list rate_scale_flush; | 66 | struct timer_list rate_scale_flush; |
65 | struct iwl3945_rate_scale_data win[IWL_RATE_COUNT]; | 67 | struct iwl3945_rate_scale_data win[IWL_RATE_COUNT_3945]; |
66 | #ifdef CONFIG_MAC80211_DEBUGFS | 68 | #ifdef CONFIG_MAC80211_DEBUGFS |
67 | struct dentry *rs_sta_dbgfs_stats_table_file; | 69 | struct dentry *rs_sta_dbgfs_stats_table_file; |
68 | #endif | 70 | #endif |
@@ -71,19 +73,19 @@ struct iwl3945_rs_sta { | |||
71 | int last_txrate_idx; | 73 | int last_txrate_idx; |
72 | }; | 74 | }; |
73 | 75 | ||
74 | static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT] = { | 76 | static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT_3945] = { |
75 | 7, 13, 35, 58, 0, 0, 76, 104, 130, 168, 191, 202 | 77 | 7, 13, 35, 58, 0, 0, 76, 104, 130, 168, 191, 202 |
76 | }; | 78 | }; |
77 | 79 | ||
78 | static s32 iwl3945_expected_tpt_g_prot[IWL_RATE_COUNT] = { | 80 | static s32 iwl3945_expected_tpt_g_prot[IWL_RATE_COUNT_3945] = { |
79 | 7, 13, 35, 58, 0, 0, 0, 80, 93, 113, 123, 125 | 81 | 7, 13, 35, 58, 0, 0, 0, 80, 93, 113, 123, 125 |
80 | }; | 82 | }; |
81 | 83 | ||
82 | static s32 iwl3945_expected_tpt_a[IWL_RATE_COUNT] = { | 84 | static s32 iwl3945_expected_tpt_a[IWL_RATE_COUNT_3945] = { |
83 | 0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186 | 85 | 0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186 |
84 | }; | 86 | }; |
85 | 87 | ||
86 | static s32 iwl3945_expected_tpt_b[IWL_RATE_COUNT] = { | 88 | static s32 iwl3945_expected_tpt_b[IWL_RATE_COUNT_3945] = { |
87 | 7, 13, 35, 58, 0, 0, 0, 0, 0, 0, 0, 0 | 89 | 7, 13, 35, 58, 0, 0, 0, 0, 0, 0, 0, 0 |
88 | }; | 90 | }; |
89 | 91 | ||
@@ -119,7 +121,7 @@ static struct iwl3945_tpt_entry iwl3945_tpt_table_g[] = { | |||
119 | #define IWL_RATE_MAX_WINDOW 62 | 121 | #define IWL_RATE_MAX_WINDOW 62 |
120 | #define IWL_RATE_FLUSH (3*HZ) | 122 | #define IWL_RATE_FLUSH (3*HZ) |
121 | #define IWL_RATE_WIN_FLUSH (HZ/2) | 123 | #define IWL_RATE_WIN_FLUSH (HZ/2) |
122 | #define IWL_RATE_HIGH_TH 11520 | 124 | #define IWL39_RATE_HIGH_TH 11520 |
123 | #define IWL_SUCCESS_UP_TH 8960 | 125 | #define IWL_SUCCESS_UP_TH 8960 |
124 | #define IWL_SUCCESS_DOWN_TH 10880 | 126 | #define IWL_SUCCESS_DOWN_TH 10880 |
125 | #define IWL_RATE_MIN_FAILURE_TH 8 | 127 | #define IWL_RATE_MIN_FAILURE_TH 8 |
@@ -165,7 +167,7 @@ static void iwl3945_clear_window(struct iwl3945_rate_scale_data *window) | |||
165 | window->success_counter = 0; | 167 | window->success_counter = 0; |
166 | window->success_ratio = -1; | 168 | window->success_ratio = -1; |
167 | window->counter = 0; | 169 | window->counter = 0; |
168 | window->average_tpt = IWL_INV_TPT; | 170 | window->average_tpt = IWL_INVALID_VALUE; |
169 | window->stamp = 0; | 171 | window->stamp = 0; |
170 | } | 172 | } |
171 | 173 | ||
@@ -181,13 +183,14 @@ static int iwl3945_rate_scale_flush_windows(struct iwl3945_rs_sta *rs_sta) | |||
181 | int unflushed = 0; | 183 | int unflushed = 0; |
182 | int i; | 184 | int i; |
183 | unsigned long flags; | 185 | unsigned long flags; |
186 | struct iwl_priv *priv = rs_sta->priv; | ||
184 | 187 | ||
185 | /* | 188 | /* |
186 | * For each rate, if we have collected data on that rate | 189 | * For each rate, if we have collected data on that rate |
187 | * and it has been more than IWL_RATE_WIN_FLUSH | 190 | * and it has been more than IWL_RATE_WIN_FLUSH |
188 | * since we flushed, clear out the gathered statistics | 191 | * since we flushed, clear out the gathered statistics |
189 | */ | 192 | */ |
190 | for (i = 0; i < IWL_RATE_COUNT; i++) { | 193 | for (i = 0; i < IWL_RATE_COUNT_3945; i++) { |
191 | if (!rs_sta->win[i].counter) | 194 | if (!rs_sta->win[i].counter) |
192 | continue; | 195 | continue; |
193 | 196 | ||
@@ -213,6 +216,7 @@ static int iwl3945_rate_scale_flush_windows(struct iwl3945_rs_sta *rs_sta) | |||
213 | static void iwl3945_bg_rate_scale_flush(unsigned long data) | 216 | static void iwl3945_bg_rate_scale_flush(unsigned long data) |
214 | { | 217 | { |
215 | struct iwl3945_rs_sta *rs_sta = (void *)data; | 218 | struct iwl3945_rs_sta *rs_sta = (void *)data; |
219 | struct iwl_priv *priv = rs_sta->priv; | ||
216 | int unflushed = 0; | 220 | int unflushed = 0; |
217 | unsigned long flags; | 221 | unsigned long flags; |
218 | u32 packet_count, duration, pps; | 222 | u32 packet_count, duration, pps; |
@@ -286,6 +290,7 @@ static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta, | |||
286 | { | 290 | { |
287 | unsigned long flags; | 291 | unsigned long flags; |
288 | s32 fail_count; | 292 | s32 fail_count; |
293 | struct iwl_priv *priv = rs_sta->priv; | ||
289 | 294 | ||
290 | if (!retries) { | 295 | if (!retries) { |
291 | IWL_DEBUG_RATE("leave: retries == 0 -- should be at least 1\n"); | 296 | IWL_DEBUG_RATE("leave: retries == 0 -- should be at least 1\n"); |
@@ -329,7 +334,7 @@ static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta, | |||
329 | window->average_tpt = ((window->success_ratio * | 334 | window->average_tpt = ((window->success_ratio * |
330 | rs_sta->expected_tpt[index] + 64) / 128); | 335 | rs_sta->expected_tpt[index] + 64) / 128); |
331 | else | 336 | else |
332 | window->average_tpt = IWL_INV_TPT; | 337 | window->average_tpt = IWL_INVALID_VALUE; |
333 | 338 | ||
334 | spin_unlock_irqrestore(&rs_sta->lock, flags); | 339 | spin_unlock_irqrestore(&rs_sta->lock, flags); |
335 | 340 | ||
@@ -339,7 +344,7 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband, | |||
339 | struct ieee80211_sta *sta, void *priv_sta) | 344 | struct ieee80211_sta *sta, void *priv_sta) |
340 | { | 345 | { |
341 | struct iwl3945_rs_sta *rs_sta = priv_sta; | 346 | struct iwl3945_rs_sta *rs_sta = priv_sta; |
342 | struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_r; | 347 | struct iwl_priv *priv = (struct iwl_priv *)priv_r; |
343 | int i; | 348 | int i; |
344 | 349 | ||
345 | IWL_DEBUG_RATE("enter\n"); | 350 | IWL_DEBUG_RATE("enter\n"); |
@@ -379,10 +384,11 @@ static void rs_free(void *priv) | |||
379 | return; | 384 | return; |
380 | } | 385 | } |
381 | 386 | ||
382 | static void *rs_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) | 387 | static void *rs_alloc_sta(void *iwl_priv, struct ieee80211_sta *sta, gfp_t gfp) |
383 | { | 388 | { |
384 | struct iwl3945_rs_sta *rs_sta; | 389 | struct iwl3945_rs_sta *rs_sta; |
385 | struct iwl3945_sta_priv *psta = (void *) sta->drv_priv; | 390 | struct iwl3945_sta_priv *psta = (void *) sta->drv_priv; |
391 | struct iwl_priv *priv = iwl_priv; | ||
386 | int i; | 392 | int i; |
387 | 393 | ||
388 | /* | 394 | /* |
@@ -402,6 +408,8 @@ static void *rs_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) | |||
402 | 408 | ||
403 | spin_lock_init(&rs_sta->lock); | 409 | spin_lock_init(&rs_sta->lock); |
404 | 410 | ||
411 | rs_sta->priv = priv; | ||
412 | |||
405 | rs_sta->start_rate = IWL_RATE_INVALID; | 413 | rs_sta->start_rate = IWL_RATE_INVALID; |
406 | 414 | ||
407 | /* default to just 802.11b */ | 415 | /* default to just 802.11b */ |
@@ -417,7 +425,7 @@ static void *rs_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) | |||
417 | rs_sta->rate_scale_flush.data = (unsigned long)rs_sta; | 425 | rs_sta->rate_scale_flush.data = (unsigned long)rs_sta; |
418 | rs_sta->rate_scale_flush.function = &iwl3945_bg_rate_scale_flush; | 426 | rs_sta->rate_scale_flush.function = &iwl3945_bg_rate_scale_flush; |
419 | 427 | ||
420 | for (i = 0; i < IWL_RATE_COUNT; i++) | 428 | for (i = 0; i < IWL_RATE_COUNT_3945; i++) |
421 | iwl3945_clear_window(&rs_sta->win[i]); | 429 | iwl3945_clear_window(&rs_sta->win[i]); |
422 | 430 | ||
423 | IWL_DEBUG_RATE("leave\n"); | 431 | IWL_DEBUG_RATE("leave\n"); |
@@ -425,11 +433,12 @@ static void *rs_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) | |||
425 | return rs_sta; | 433 | return rs_sta; |
426 | } | 434 | } |
427 | 435 | ||
428 | static void rs_free_sta(void *priv, struct ieee80211_sta *sta, | 436 | static void rs_free_sta(void *iwl_priv, struct ieee80211_sta *sta, |
429 | void *priv_sta) | 437 | void *priv_sta) |
430 | { | 438 | { |
431 | struct iwl3945_sta_priv *psta = (void *) sta->drv_priv; | 439 | struct iwl3945_sta_priv *psta = (void *) sta->drv_priv; |
432 | struct iwl3945_rs_sta *rs_sta = priv_sta; | 440 | struct iwl3945_rs_sta *rs_sta = priv_sta; |
441 | struct iwl_priv *priv = rs_sta->priv; | ||
433 | 442 | ||
434 | psta->rs_sta = NULL; | 443 | psta->rs_sta = NULL; |
435 | 444 | ||
@@ -443,7 +452,7 @@ static void rs_free_sta(void *priv, struct ieee80211_sta *sta, | |||
443 | /** | 452 | /** |
444 | * rs_tx_status - Update rate control values based on Tx results | 453 | * rs_tx_status - Update rate control values based on Tx results |
445 | * | 454 | * |
446 | * NOTE: Uses iwl3945_priv->retry_rate for the # of retries attempted by | 455 | * NOTE: Uses iwl_priv->retry_rate for the # of retries attempted by |
447 | * the hardware for each rate. | 456 | * the hardware for each rate. |
448 | */ | 457 | */ |
449 | static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband, | 458 | static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband, |
@@ -453,7 +462,7 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband | |||
453 | s8 retries = 0, current_count; | 462 | s8 retries = 0, current_count; |
454 | int scale_rate_index, first_index, last_index; | 463 | int scale_rate_index, first_index, last_index; |
455 | unsigned long flags; | 464 | unsigned long flags; |
456 | struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate; | 465 | struct iwl_priv *priv = (struct iwl_priv *)priv_rate; |
457 | struct iwl3945_rs_sta *rs_sta = priv_sta; | 466 | struct iwl3945_rs_sta *rs_sta = priv_sta; |
458 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 467 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
459 | 468 | ||
@@ -462,7 +471,7 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband | |||
462 | retries = info->status.rates[0].count; | 471 | retries = info->status.rates[0].count; |
463 | 472 | ||
464 | first_index = sband->bitrates[info->status.rates[0].idx].hw_value; | 473 | first_index = sband->bitrates[info->status.rates[0].idx].hw_value; |
465 | if ((first_index < 0) || (first_index >= IWL_RATE_COUNT)) { | 474 | if ((first_index < 0) || (first_index >= IWL_RATE_COUNT_3945)) { |
466 | IWL_DEBUG_RATE("leave: Rate out of bounds: %d\n", first_index); | 475 | IWL_DEBUG_RATE("leave: Rate out of bounds: %d\n", first_index); |
467 | return; | 476 | return; |
468 | } | 477 | } |
@@ -547,6 +556,7 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta, | |||
547 | { | 556 | { |
548 | u8 high = IWL_RATE_INVALID; | 557 | u8 high = IWL_RATE_INVALID; |
549 | u8 low = IWL_RATE_INVALID; | 558 | u8 low = IWL_RATE_INVALID; |
559 | struct iwl_priv *priv = rs_sta->priv; | ||
550 | 560 | ||
551 | /* 802.11A walks to the next literal adjacent rate in | 561 | /* 802.11A walks to the next literal adjacent rate in |
552 | * the rate table */ | 562 | * the rate table */ |
@@ -565,7 +575,8 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta, | |||
565 | 575 | ||
566 | /* Find the next rate that is in the rate mask */ | 576 | /* Find the next rate that is in the rate mask */ |
567 | i = index + 1; | 577 | i = index + 1; |
568 | for (mask = (1 << i); i < IWL_RATE_COUNT; i++, mask <<= 1) { | 578 | for (mask = (1 << i); i < IWL_RATE_COUNT_3945; |
579 | i++, mask <<= 1) { | ||
569 | if (rate_mask & mask) { | 580 | if (rate_mask & mask) { |
570 | high = i; | 581 | high = i; |
571 | break; | 582 | break; |
@@ -631,16 +642,17 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
631 | int index; | 642 | int index; |
632 | struct iwl3945_rs_sta *rs_sta = priv_sta; | 643 | struct iwl3945_rs_sta *rs_sta = priv_sta; |
633 | struct iwl3945_rate_scale_data *window = NULL; | 644 | struct iwl3945_rate_scale_data *window = NULL; |
634 | int current_tpt = IWL_INV_TPT; | 645 | int current_tpt = IWL_INVALID_VALUE; |
635 | int low_tpt = IWL_INV_TPT; | 646 | int low_tpt = IWL_INVALID_VALUE; |
636 | int high_tpt = IWL_INV_TPT; | 647 | int high_tpt = IWL_INVALID_VALUE; |
637 | u32 fail_count; | 648 | u32 fail_count; |
638 | s8 scale_action = 0; | 649 | s8 scale_action = 0; |
639 | unsigned long flags; | 650 | unsigned long flags; |
640 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 651 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
641 | u16 fc; | 652 | u16 fc; |
642 | u16 rate_mask = 0; | 653 | u16 rate_mask = 0; |
643 | struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_r; | 654 | s8 max_rate_idx = -1; |
655 | struct iwl_priv *priv = (struct iwl_priv *)priv_r; | ||
644 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 656 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
645 | 657 | ||
646 | IWL_DEBUG_RATE("enter\n"); | 658 | IWL_DEBUG_RATE("enter\n"); |
@@ -664,7 +676,14 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
664 | return; | 676 | return; |
665 | } | 677 | } |
666 | 678 | ||
667 | index = min(rs_sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT - 1); | 679 | /* get user max rate if set */ |
680 | max_rate_idx = txrc->max_rate_idx; | ||
681 | if ((sband->band == IEEE80211_BAND_5GHZ) && (max_rate_idx != -1)) | ||
682 | max_rate_idx += IWL_FIRST_OFDM_RATE; | ||
683 | if ((max_rate_idx < 0) || (max_rate_idx >= IWL_RATE_COUNT)) | ||
684 | max_rate_idx = -1; | ||
685 | |||
686 | index = min(rs_sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT_3945 - 1); | ||
668 | 687 | ||
669 | if (sband->band == IEEE80211_BAND_5GHZ) | 688 | if (sband->band == IEEE80211_BAND_5GHZ) |
670 | rate_mask = rate_mask << IWL_FIRST_OFDM_RATE; | 689 | rate_mask = rate_mask << IWL_FIRST_OFDM_RATE; |
@@ -695,6 +714,12 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
695 | rs_sta->start_rate = IWL_RATE_INVALID; | 714 | rs_sta->start_rate = IWL_RATE_INVALID; |
696 | } | 715 | } |
697 | 716 | ||
717 | /* force user max rate if set by user */ | ||
718 | if ((max_rate_idx != -1) && (max_rate_idx < index)) { | ||
719 | if (rate_mask & (1 << max_rate_idx)) | ||
720 | index = max_rate_idx; | ||
721 | } | ||
722 | |||
698 | window = &(rs_sta->win[index]); | 723 | window = &(rs_sta->win[index]); |
699 | 724 | ||
700 | fail_count = window->counter - window->success_counter; | 725 | fail_count = window->counter - window->success_counter; |
@@ -721,6 +746,10 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
721 | low = high_low & 0xff; | 746 | low = high_low & 0xff; |
722 | high = (high_low >> 8) & 0xff; | 747 | high = (high_low >> 8) & 0xff; |
723 | 748 | ||
749 | /* If user set max rate, dont allow higher than user constrain */ | ||
750 | if ((max_rate_idx != -1) && (max_rate_idx < high)) | ||
751 | high = IWL_RATE_INVALID; | ||
752 | |||
724 | if (low != IWL_RATE_INVALID) | 753 | if (low != IWL_RATE_INVALID) |
725 | low_tpt = rs_sta->win[low].average_tpt; | 754 | low_tpt = rs_sta->win[low].average_tpt; |
726 | 755 | ||
@@ -734,16 +763,18 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
734 | if ((window->success_ratio < IWL_RATE_DECREASE_TH) || !current_tpt) { | 763 | if ((window->success_ratio < IWL_RATE_DECREASE_TH) || !current_tpt) { |
735 | IWL_DEBUG_RATE("decrease rate because of low success_ratio\n"); | 764 | IWL_DEBUG_RATE("decrease rate because of low success_ratio\n"); |
736 | scale_action = -1; | 765 | scale_action = -1; |
737 | } else if ((low_tpt == IWL_INV_TPT) && (high_tpt == IWL_INV_TPT)) | 766 | } else if ((low_tpt == IWL_INVALID_VALUE) && |
767 | (high_tpt == IWL_INVALID_VALUE)) | ||
738 | scale_action = 1; | 768 | scale_action = 1; |
739 | else if ((low_tpt != IWL_INV_TPT) && (high_tpt != IWL_INV_TPT) && | 769 | else if ((low_tpt != IWL_INVALID_VALUE) && |
770 | (high_tpt != IWL_INVALID_VALUE) && | ||
740 | (low_tpt < current_tpt) && (high_tpt < current_tpt)) { | 771 | (low_tpt < current_tpt) && (high_tpt < current_tpt)) { |
741 | IWL_DEBUG_RATE("No action -- low [%d] & high [%d] < " | 772 | IWL_DEBUG_RATE("No action -- low [%d] & high [%d] < " |
742 | "current_tpt [%d]\n", | 773 | "current_tpt [%d]\n", |
743 | low_tpt, high_tpt, current_tpt); | 774 | low_tpt, high_tpt, current_tpt); |
744 | scale_action = 0; | 775 | scale_action = 0; |
745 | } else { | 776 | } else { |
746 | if (high_tpt != IWL_INV_TPT) { | 777 | if (high_tpt != IWL_INVALID_VALUE) { |
747 | if (high_tpt > current_tpt) | 778 | if (high_tpt > current_tpt) |
748 | scale_action = 1; | 779 | scale_action = 1; |
749 | else { | 780 | else { |
@@ -751,7 +782,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
751 | ("decrease rate because of high tpt\n"); | 782 | ("decrease rate because of high tpt\n"); |
752 | scale_action = -1; | 783 | scale_action = -1; |
753 | } | 784 | } |
754 | } else if (low_tpt != IWL_INV_TPT) { | 785 | } else if (low_tpt != IWL_INVALID_VALUE) { |
755 | if (low_tpt > current_tpt) { | 786 | if (low_tpt > current_tpt) { |
756 | IWL_DEBUG_RATE | 787 | IWL_DEBUG_RATE |
757 | ("decrease rate because of low tpt\n"); | 788 | ("decrease rate because of low tpt\n"); |
@@ -825,7 +856,7 @@ static ssize_t iwl3945_sta_dbgfs_stats_table_read(struct file *file, | |||
825 | lq_sta->tx_packets, | 856 | lq_sta->tx_packets, |
826 | lq_sta->last_txrate_idx, | 857 | lq_sta->last_txrate_idx, |
827 | lq_sta->start_rate, jiffies_to_msecs(lq_sta->flush_time)); | 858 | lq_sta->start_rate, jiffies_to_msecs(lq_sta->flush_time)); |
828 | for (j = 0; j < IWL_RATE_COUNT; j++) { | 859 | for (j = 0; j < IWL_RATE_COUNT_3945; j++) { |
829 | desc += sprintf(buff+desc, | 860 | desc += sprintf(buff+desc, |
830 | "counter=%d success=%d %%=%d\n", | 861 | "counter=%d success=%d %%=%d\n", |
831 | lq_sta->win[j].counter, | 862 | lq_sta->win[j].counter, |
@@ -877,7 +908,7 @@ static struct rate_control_ops rs_ops = { | |||
877 | 908 | ||
878 | void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) | 909 | void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) |
879 | { | 910 | { |
880 | struct iwl3945_priv *priv = hw->priv; | 911 | struct iwl_priv *priv = hw->priv; |
881 | s32 rssi = 0; | 912 | s32 rssi = 0; |
882 | unsigned long flags; | 913 | unsigned long flags; |
883 | struct iwl3945_rs_sta *rs_sta; | 914 | struct iwl3945_rs_sta *rs_sta; |
@@ -888,7 +919,7 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) | |||
888 | 919 | ||
889 | rcu_read_lock(); | 920 | rcu_read_lock(); |
890 | 921 | ||
891 | sta = ieee80211_find_sta(hw, priv->stations[sta_id].sta.sta.addr); | 922 | sta = ieee80211_find_sta(hw, priv->stations_39[sta_id].sta.sta.addr); |
892 | if (!sta) { | 923 | if (!sta) { |
893 | rcu_read_unlock(); | 924 | rcu_read_unlock(); |
894 | return; | 925 | return; |
@@ -903,7 +934,7 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) | |||
903 | switch (priv->band) { | 934 | switch (priv->band) { |
904 | case IEEE80211_BAND_2GHZ: | 935 | case IEEE80211_BAND_2GHZ: |
905 | /* TODO: this always does G, not a regression */ | 936 | /* TODO: this always does G, not a regression */ |
906 | if (priv->active_rxon.flags & RXON_FLG_TGG_PROTECT_MSK) { | 937 | if (priv->active39_rxon.flags & RXON_FLG_TGG_PROTECT_MSK) { |
907 | rs_sta->tgg = 1; | 938 | rs_sta->tgg = 1; |
908 | rs_sta->expected_tpt = iwl3945_expected_tpt_g_prot; | 939 | rs_sta->expected_tpt = iwl3945_expected_tpt_g_prot; |
909 | } else | 940 | } else |