diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2008-12-18 21:37:12 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 15:58:58 -0500 |
commit | d9829a67f953379b5cab6b78ae8f7a879a591eb1 (patch) | |
tree | a41656685e3ecda9ecdec06ca06efc5367485f05 /drivers/net/wireless/iwlwifi/iwl-3945-rs.c | |
parent | 250bdd216c95907760b3fcc3aac1ed436d21c66c (diff) |
iwl3945: Use iwl-agn-rs.h rates definitions.
A lot of rate relates definition are shared between iwl-3945-rs.h and
iwl-agn-rs.h. Let's just use the agn version, and add the 3945 specific
constants there.
Signed-off-by: Samuel Ortiz <samuel.ortiz@intel.com>
Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-3945-rs.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c index 42b8bc495d8..3fa9570f82b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c | |||
@@ -64,7 +64,7 @@ struct iwl3945_rs_sta { | |||
64 | u8 start_rate; | 64 | u8 start_rate; |
65 | u8 ibss_sta_added; | 65 | u8 ibss_sta_added; |
66 | struct timer_list rate_scale_flush; | 66 | struct timer_list rate_scale_flush; |
67 | struct iwl3945_rate_scale_data win[IWL_RATE_COUNT]; | 67 | struct iwl3945_rate_scale_data win[IWL_RATE_COUNT_3945]; |
68 | #ifdef CONFIG_MAC80211_DEBUGFS | 68 | #ifdef CONFIG_MAC80211_DEBUGFS |
69 | struct dentry *rs_sta_dbgfs_stats_table_file; | 69 | struct dentry *rs_sta_dbgfs_stats_table_file; |
70 | #endif | 70 | #endif |
@@ -73,19 +73,19 @@ struct iwl3945_rs_sta { | |||
73 | int last_txrate_idx; | 73 | int last_txrate_idx; |
74 | }; | 74 | }; |
75 | 75 | ||
76 | static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT] = { | 76 | static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT_3945] = { |
77 | 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 |
78 | }; | 78 | }; |
79 | 79 | ||
80 | static s32 iwl3945_expected_tpt_g_prot[IWL_RATE_COUNT] = { | 80 | static s32 iwl3945_expected_tpt_g_prot[IWL_RATE_COUNT_3945] = { |
81 | 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 |
82 | }; | 82 | }; |
83 | 83 | ||
84 | static s32 iwl3945_expected_tpt_a[IWL_RATE_COUNT] = { | 84 | static s32 iwl3945_expected_tpt_a[IWL_RATE_COUNT_3945] = { |
85 | 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 |
86 | }; | 86 | }; |
87 | 87 | ||
88 | static s32 iwl3945_expected_tpt_b[IWL_RATE_COUNT] = { | 88 | static s32 iwl3945_expected_tpt_b[IWL_RATE_COUNT_3945] = { |
89 | 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 |
90 | }; | 90 | }; |
91 | 91 | ||
@@ -121,7 +121,7 @@ static struct iwl3945_tpt_entry iwl3945_tpt_table_g[] = { | |||
121 | #define IWL_RATE_MAX_WINDOW 62 | 121 | #define IWL_RATE_MAX_WINDOW 62 |
122 | #define IWL_RATE_FLUSH (3*HZ) | 122 | #define IWL_RATE_FLUSH (3*HZ) |
123 | #define IWL_RATE_WIN_FLUSH (HZ/2) | 123 | #define IWL_RATE_WIN_FLUSH (HZ/2) |
124 | #define IWL_RATE_HIGH_TH 11520 | 124 | #define IWL39_RATE_HIGH_TH 11520 |
125 | #define IWL_SUCCESS_UP_TH 8960 | 125 | #define IWL_SUCCESS_UP_TH 8960 |
126 | #define IWL_SUCCESS_DOWN_TH 10880 | 126 | #define IWL_SUCCESS_DOWN_TH 10880 |
127 | #define IWL_RATE_MIN_FAILURE_TH 8 | 127 | #define IWL_RATE_MIN_FAILURE_TH 8 |
@@ -167,7 +167,7 @@ static void iwl3945_clear_window(struct iwl3945_rate_scale_data *window) | |||
167 | window->success_counter = 0; | 167 | window->success_counter = 0; |
168 | window->success_ratio = -1; | 168 | window->success_ratio = -1; |
169 | window->counter = 0; | 169 | window->counter = 0; |
170 | window->average_tpt = IWL_INV_TPT; | 170 | window->average_tpt = IWL_INVALID_VALUE; |
171 | window->stamp = 0; | 171 | window->stamp = 0; |
172 | } | 172 | } |
173 | 173 | ||
@@ -190,7 +190,7 @@ static int iwl3945_rate_scale_flush_windows(struct iwl3945_rs_sta *rs_sta) | |||
190 | * and it has been more than IWL_RATE_WIN_FLUSH | 190 | * and it has been more than IWL_RATE_WIN_FLUSH |
191 | * since we flushed, clear out the gathered statistics | 191 | * since we flushed, clear out the gathered statistics |
192 | */ | 192 | */ |
193 | for (i = 0; i < IWL_RATE_COUNT; i++) { | 193 | for (i = 0; i < IWL_RATE_COUNT_3945; i++) { |
194 | if (!rs_sta->win[i].counter) | 194 | if (!rs_sta->win[i].counter) |
195 | continue; | 195 | continue; |
196 | 196 | ||
@@ -334,7 +334,7 @@ static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta, | |||
334 | window->average_tpt = ((window->success_ratio * | 334 | window->average_tpt = ((window->success_ratio * |
335 | rs_sta->expected_tpt[index] + 64) / 128); | 335 | rs_sta->expected_tpt[index] + 64) / 128); |
336 | else | 336 | else |
337 | window->average_tpt = IWL_INV_TPT; | 337 | window->average_tpt = IWL_INVALID_VALUE; |
338 | 338 | ||
339 | spin_unlock_irqrestore(&rs_sta->lock, flags); | 339 | spin_unlock_irqrestore(&rs_sta->lock, flags); |
340 | 340 | ||
@@ -425,7 +425,7 @@ static void *rs_alloc_sta(void *iwl_priv, struct ieee80211_sta *sta, gfp_t gfp) | |||
425 | rs_sta->rate_scale_flush.data = (unsigned long)rs_sta; | 425 | rs_sta->rate_scale_flush.data = (unsigned long)rs_sta; |
426 | rs_sta->rate_scale_flush.function = &iwl3945_bg_rate_scale_flush; | 426 | rs_sta->rate_scale_flush.function = &iwl3945_bg_rate_scale_flush; |
427 | 427 | ||
428 | for (i = 0; i < IWL_RATE_COUNT; i++) | 428 | for (i = 0; i < IWL_RATE_COUNT_3945; i++) |
429 | iwl3945_clear_window(&rs_sta->win[i]); | 429 | iwl3945_clear_window(&rs_sta->win[i]); |
430 | 430 | ||
431 | IWL_DEBUG_RATE("leave\n"); | 431 | IWL_DEBUG_RATE("leave\n"); |
@@ -471,7 +471,7 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband | |||
471 | retries = info->status.rates[0].count; | 471 | retries = info->status.rates[0].count; |
472 | 472 | ||
473 | first_index = sband->bitrates[info->status.rates[0].idx].hw_value; | 473 | first_index = sband->bitrates[info->status.rates[0].idx].hw_value; |
474 | if ((first_index < 0) || (first_index >= IWL_RATE_COUNT)) { | 474 | if ((first_index < 0) || (first_index >= IWL_RATE_COUNT_3945)) { |
475 | 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); |
476 | return; | 476 | return; |
477 | } | 477 | } |
@@ -575,7 +575,8 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta, | |||
575 | 575 | ||
576 | /* Find the next rate that is in the rate mask */ | 576 | /* Find the next rate that is in the rate mask */ |
577 | i = index + 1; | 577 | i = index + 1; |
578 | 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) { | ||
579 | if (rate_mask & mask) { | 580 | if (rate_mask & mask) { |
580 | high = i; | 581 | high = i; |
581 | break; | 582 | break; |
@@ -641,9 +642,9 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
641 | int index; | 642 | int index; |
642 | struct iwl3945_rs_sta *rs_sta = priv_sta; | 643 | struct iwl3945_rs_sta *rs_sta = priv_sta; |
643 | struct iwl3945_rate_scale_data *window = NULL; | 644 | struct iwl3945_rate_scale_data *window = NULL; |
644 | int current_tpt = IWL_INV_TPT; | 645 | int current_tpt = IWL_INVALID_VALUE; |
645 | int low_tpt = IWL_INV_TPT; | 646 | int low_tpt = IWL_INVALID_VALUE; |
646 | int high_tpt = IWL_INV_TPT; | 647 | int high_tpt = IWL_INVALID_VALUE; |
647 | u32 fail_count; | 648 | u32 fail_count; |
648 | s8 scale_action = 0; | 649 | s8 scale_action = 0; |
649 | unsigned long flags; | 650 | unsigned long flags; |
@@ -674,7 +675,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
674 | return; | 675 | return; |
675 | } | 676 | } |
676 | 677 | ||
677 | index = min(rs_sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT - 1); | 678 | index = min(rs_sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT_3945 - 1); |
678 | 679 | ||
679 | if (sband->band == IEEE80211_BAND_5GHZ) | 680 | if (sband->band == IEEE80211_BAND_5GHZ) |
680 | rate_mask = rate_mask << IWL_FIRST_OFDM_RATE; | 681 | rate_mask = rate_mask << IWL_FIRST_OFDM_RATE; |
@@ -744,16 +745,18 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
744 | if ((window->success_ratio < IWL_RATE_DECREASE_TH) || !current_tpt) { | 745 | if ((window->success_ratio < IWL_RATE_DECREASE_TH) || !current_tpt) { |
745 | IWL_DEBUG_RATE("decrease rate because of low success_ratio\n"); | 746 | IWL_DEBUG_RATE("decrease rate because of low success_ratio\n"); |
746 | scale_action = -1; | 747 | scale_action = -1; |
747 | } else if ((low_tpt == IWL_INV_TPT) && (high_tpt == IWL_INV_TPT)) | 748 | } else if ((low_tpt == IWL_INVALID_VALUE) && |
749 | (high_tpt == IWL_INVALID_VALUE)) | ||
748 | scale_action = 1; | 750 | scale_action = 1; |
749 | else if ((low_tpt != IWL_INV_TPT) && (high_tpt != IWL_INV_TPT) && | 751 | else if ((low_tpt != IWL_INVALID_VALUE) && |
752 | (high_tpt != IWL_INVALID_VALUE) && | ||
750 | (low_tpt < current_tpt) && (high_tpt < current_tpt)) { | 753 | (low_tpt < current_tpt) && (high_tpt < current_tpt)) { |
751 | IWL_DEBUG_RATE("No action -- low [%d] & high [%d] < " | 754 | IWL_DEBUG_RATE("No action -- low [%d] & high [%d] < " |
752 | "current_tpt [%d]\n", | 755 | "current_tpt [%d]\n", |
753 | low_tpt, high_tpt, current_tpt); | 756 | low_tpt, high_tpt, current_tpt); |
754 | scale_action = 0; | 757 | scale_action = 0; |
755 | } else { | 758 | } else { |
756 | if (high_tpt != IWL_INV_TPT) { | 759 | if (high_tpt != IWL_INVALID_VALUE) { |
757 | if (high_tpt > current_tpt) | 760 | if (high_tpt > current_tpt) |
758 | scale_action = 1; | 761 | scale_action = 1; |
759 | else { | 762 | else { |
@@ -761,7 +764,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
761 | ("decrease rate because of high tpt\n"); | 764 | ("decrease rate because of high tpt\n"); |
762 | scale_action = -1; | 765 | scale_action = -1; |
763 | } | 766 | } |
764 | } else if (low_tpt != IWL_INV_TPT) { | 767 | } else if (low_tpt != IWL_INVALID_VALUE) { |
765 | if (low_tpt > current_tpt) { | 768 | if (low_tpt > current_tpt) { |
766 | IWL_DEBUG_RATE | 769 | IWL_DEBUG_RATE |
767 | ("decrease rate because of low tpt\n"); | 770 | ("decrease rate because of low tpt\n"); |
@@ -835,7 +838,7 @@ static ssize_t iwl3945_sta_dbgfs_stats_table_read(struct file *file, | |||
835 | lq_sta->tx_packets, | 838 | lq_sta->tx_packets, |
836 | lq_sta->last_txrate_idx, | 839 | lq_sta->last_txrate_idx, |
837 | lq_sta->start_rate, jiffies_to_msecs(lq_sta->flush_time)); | 840 | lq_sta->start_rate, jiffies_to_msecs(lq_sta->flush_time)); |
838 | for (j = 0; j < IWL_RATE_COUNT; j++) { | 841 | for (j = 0; j < IWL_RATE_COUNT_3945; j++) { |
839 | desc += sprintf(buff+desc, | 842 | desc += sprintf(buff+desc, |
840 | "counter=%d success=%d %%=%d\n", | 843 | "counter=%d success=%d %%=%d\n", |
841 | lq_sta->win[j].counter, | 844 | lq_sta->win[j].counter, |