aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorVasanthakumar Thiagarajan <vasanth@atheros.com>2009-07-14 20:14:13 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-24 15:05:17 -0400
commit922bac602255d4557c289cabba7857c5be332d34 (patch)
treec005286e01d8b2aa3849bdd5264d3b7ca795105a /drivers/net
parentc41304653e120749dae8b04332b92ffb5f4dbbfd (diff)
ath9k: Nuke struct ath_tx_ratectrl_state
Move its only member (u8 per) to struct ath_rate_priv. Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.c50
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.h7
2 files changed, 27 insertions, 30 deletions
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index a97dd7b6b706..a07efa22551e 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -636,7 +636,7 @@ static u8 ath_rc_get_highest_rix(struct ath_softc *sc,
636 * 10-15 and we would be worse off then staying 636 * 10-15 and we would be worse off then staying
637 * at the current rate. 637 * at the current rate.
638 */ 638 */
639 per_thres = ath_rc_priv->state[rate].per; 639 per_thres = ath_rc_priv->per[rate];
640 if (per_thres < 12) 640 if (per_thres < 12)
641 per_thres = 12; 641 per_thres = 12;
642 642
@@ -881,13 +881,13 @@ static bool ath_rc_update_per(struct ath_softc *sc,
881 100 * 9 / 10 881 100 * 9 / 10
882 }; 882 };
883 883
884 last_per = ath_rc_priv->state[tx_rate].per; 884 last_per = ath_rc_priv->per[tx_rate];
885 885
886 if (xretries) { 886 if (xretries) {
887 if (xretries == 1) { 887 if (xretries == 1) {
888 ath_rc_priv->state[tx_rate].per += 30; 888 ath_rc_priv->per[tx_rate] += 30;
889 if (ath_rc_priv->state[tx_rate].per > 100) 889 if (ath_rc_priv->per[tx_rate] > 100)
890 ath_rc_priv->state[tx_rate].per = 100; 890 ath_rc_priv->per[tx_rate] = 100;
891 } else { 891 } else {
892 /* xretries == 2 */ 892 /* xretries == 2 */
893 count = ARRAY_SIZE(nretry_to_per_lookup); 893 count = ARRAY_SIZE(nretry_to_per_lookup);
@@ -895,7 +895,7 @@ static bool ath_rc_update_per(struct ath_softc *sc,
895 retries = count - 1; 895 retries = count - 1;
896 896
897 /* new_PER = 7/8*old_PER + 1/8*(currentPER) */ 897 /* new_PER = 7/8*old_PER + 1/8*(currentPER) */
898 ath_rc_priv->state[tx_rate].per = 898 ath_rc_priv->per[tx_rate] =
899 (u8)(last_per - (last_per >> 3) + (100 >> 3)); 899 (u8)(last_per - (last_per >> 3) + (100 >> 3));
900 } 900 }
901 901
@@ -931,10 +931,10 @@ static bool ath_rc_update_per(struct ath_softc *sc,
931 n_frames = tx_info_priv->n_frames * (retries + 1); 931 n_frames = tx_info_priv->n_frames * (retries + 1);
932 cur_per = (100 * n_bad_frames / n_frames) >> 3; 932 cur_per = (100 * n_bad_frames / n_frames) >> 3;
933 new_per = (u8)(last_per - (last_per >> 3) + cur_per); 933 new_per = (u8)(last_per - (last_per >> 3) + cur_per);
934 ath_rc_priv->state[tx_rate].per = new_per; 934 ath_rc_priv->per[tx_rate] = new_per;
935 } 935 }
936 } else { 936 } else {
937 ath_rc_priv->state[tx_rate].per = 937 ath_rc_priv->per[tx_rate] =
938 (u8)(last_per - (last_per >> 3) + 938 (u8)(last_per - (last_per >> 3) +
939 (nretry_to_per_lookup[retries] >> 3)); 939 (nretry_to_per_lookup[retries] >> 3));
940 } 940 }
@@ -962,8 +962,8 @@ static bool ath_rc_update_per(struct ath_softc *sc,
962 ath_rc_priv->probe_rate; 962 ath_rc_priv->probe_rate;
963 probe_rate = ath_rc_priv->probe_rate; 963 probe_rate = ath_rc_priv->probe_rate;
964 964
965 if (ath_rc_priv->state[probe_rate].per > 30) 965 if (ath_rc_priv->per[probe_rate] > 30)
966 ath_rc_priv->state[probe_rate].per = 20; 966 ath_rc_priv->per[probe_rate] = 20;
967 967
968 ath_rc_priv->probe_rate = 0; 968 ath_rc_priv->probe_rate = 0;
969 969
@@ -1018,7 +1018,7 @@ static void ath_rc_update_ht(struct ath_softc *sc,
1018 if ((tx_rate < 0) || (tx_rate > rate_table->rate_cnt)) 1018 if ((tx_rate < 0) || (tx_rate > rate_table->rate_cnt))
1019 return; 1019 return;
1020 1020
1021 last_per = ath_rc_priv->state[tx_rate].per; 1021 last_per = ath_rc_priv->per[tx_rate];
1022 1022
1023 /* Update PER first */ 1023 /* Update PER first */
1024 state_change = ath_rc_update_per(sc, rate_table, ath_rc_priv, 1024 state_change = ath_rc_update_per(sc, rate_table, ath_rc_priv,
@@ -1029,7 +1029,7 @@ static void ath_rc_update_ht(struct ath_softc *sc,
1029 * If this rate looks bad (high PER) then stop using it for 1029 * If this rate looks bad (high PER) then stop using it for
1030 * a while (except if we are probing). 1030 * a while (except if we are probing).
1031 */ 1031 */
1032 if (ath_rc_priv->state[tx_rate].per >= 55 && tx_rate > 0 && 1032 if (ath_rc_priv->per[tx_rate] >= 55 && tx_rate > 0 &&
1033 rate_table->info[tx_rate].ratekbps <= 1033 rate_table->info[tx_rate].ratekbps <=
1034 rate_table->info[ath_rc_priv->rate_max_phy].ratekbps) { 1034 rate_table->info[ath_rc_priv->rate_max_phy].ratekbps) {
1035 ath_rc_get_lower_rix(rate_table, ath_rc_priv, 1035 ath_rc_get_lower_rix(rate_table, ath_rc_priv,
@@ -1041,26 +1041,26 @@ static void ath_rc_update_ht(struct ath_softc *sc,
1041 1041
1042 /* Make sure the rates below this have lower PER */ 1042 /* Make sure the rates below this have lower PER */
1043 /* Monotonicity is kept only for rates below the current rate. */ 1043 /* Monotonicity is kept only for rates below the current rate. */
1044 if (ath_rc_priv->state[tx_rate].per < last_per) { 1044 if (ath_rc_priv->per[tx_rate] < last_per) {
1045 for (rate = tx_rate - 1; rate >= 0; rate--) { 1045 for (rate = tx_rate - 1; rate >= 0; rate--) {
1046 if (rate_table->info[rate].phy != 1046 if (rate_table->info[rate].phy !=
1047 rate_table->info[tx_rate].phy) 1047 rate_table->info[tx_rate].phy)
1048 break; 1048 break;
1049 1049
1050 if (ath_rc_priv->state[rate].per > 1050 if (ath_rc_priv->per[rate] >
1051 ath_rc_priv->state[rate+1].per) { 1051 ath_rc_priv->per[rate+1]) {
1052 ath_rc_priv->state[rate].per = 1052 ath_rc_priv->per[rate] =
1053 ath_rc_priv->state[rate+1].per; 1053 ath_rc_priv->per[rate+1];
1054 } 1054 }
1055 } 1055 }
1056 } 1056 }
1057 1057
1058 /* Maintain monotonicity for rates above the current rate */ 1058 /* Maintain monotonicity for rates above the current rate */
1059 for (rate = tx_rate; rate < size - 1; rate++) { 1059 for (rate = tx_rate; rate < size - 1; rate++) {
1060 if (ath_rc_priv->state[rate+1].per < 1060 if (ath_rc_priv->per[rate+1] <
1061 ath_rc_priv->state[rate].per) 1061 ath_rc_priv->per[rate])
1062 ath_rc_priv->state[rate+1].per = 1062 ath_rc_priv->per[rate+1] =
1063 ath_rc_priv->state[rate].per; 1063 ath_rc_priv->per[rate];
1064 } 1064 }
1065 1065
1066 /* Every so often, we reduce the thresholds 1066 /* Every so often, we reduce the thresholds
@@ -1068,15 +1068,15 @@ static void ath_rc_update_ht(struct ath_softc *sc,
1068 if (now_msec - ath_rc_priv->per_down_time >= 1068 if (now_msec - ath_rc_priv->per_down_time >=
1069 rate_table->probe_interval) { 1069 rate_table->probe_interval) {
1070 for (rate = 0; rate < size; rate++) { 1070 for (rate = 0; rate < size; rate++) {
1071 ath_rc_priv->state[rate].per = 1071 ath_rc_priv->per[rate] =
1072 7 * ath_rc_priv->state[rate].per / 8; 1072 7 * ath_rc_priv->per[rate] / 8;
1073 } 1073 }
1074 1074
1075 ath_rc_priv->per_down_time = now_msec; 1075 ath_rc_priv->per_down_time = now_msec;
1076 } 1076 }
1077 1077
1078 ath_debug_stat_retries(sc, tx_rate, xretries, retries, 1078 ath_debug_stat_retries(sc, tx_rate, xretries, retries,
1079 ath_rc_priv->state[tx_rate].per); 1079 ath_rc_priv->per[tx_rate]);
1080 1080
1081} 1081}
1082 1082
@@ -1213,7 +1213,7 @@ static void ath_rc_init(struct ath_softc *sc,
1213 1213
1214 /* Initialize thresholds according to the global rate table */ 1214 /* Initialize thresholds according to the global rate table */
1215 for (i = 0 ; i < ath_rc_priv->rate_table_size; i++) { 1215 for (i = 0 ; i < ath_rc_priv->rate_table_size; i++) {
1216 ath_rc_priv->state[i].per = 0; 1216 ath_rc_priv->per[i] = 0;
1217 } 1217 }
1218 1218
1219 /* Determine the valid rates */ 1219 /* Determine the valid rates */
diff --git a/drivers/net/wireless/ath/ath9k/rc.h b/drivers/net/wireless/ath/ath9k/rc.h
index c794d6c82ad4..fa21a628ddd0 100644
--- a/drivers/net/wireless/ath/ath9k/rc.h
+++ b/drivers/net/wireless/ath/ath9k/rc.h
@@ -122,10 +122,6 @@ struct ath_rate_table {
122 u8 initial_ratemax; 122 u8 initial_ratemax;
123}; 123};
124 124
125struct ath_tx_ratectrl_state {
126 u8 per; /* recent estimate of packet error rate (%) */
127};
128
129struct ath_rateset { 125struct ath_rateset {
130 u8 rs_nrates; 126 u8 rs_nrates;
131 u8 rs_rates[ATH_RATE_MAX]; 127 u8 rs_rates[ATH_RATE_MAX];
@@ -141,6 +137,7 @@ struct ath_rateset {
141 * @per_down_time: msec timestamp for last PER down step 137 * @per_down_time: msec timestamp for last PER down step
142 * @valid_phy_ratecnt: valid rate count 138 * @valid_phy_ratecnt: valid rate count
143 * @rate_max_phy: phy index for the max rate 139 * @rate_max_phy: phy index for the max rate
140 * @per: PER for every valid rate in %
144 * @probe_interval: interval for ratectrl to probe for other rates 141 * @probe_interval: interval for ratectrl to probe for other rates
145 * @prev_data_rix: rate idx of last data frame 142 * @prev_data_rix: rate idx of last data frame
146 * @ht_cap: HT capabilities 143 * @ht_cap: HT capabilities
@@ -157,12 +154,12 @@ struct ath_rate_priv {
157 u8 valid_phy_ratecnt[WLAN_RC_PHY_MAX]; 154 u8 valid_phy_ratecnt[WLAN_RC_PHY_MAX];
158 u8 valid_phy_rateidx[WLAN_RC_PHY_MAX][RATE_TABLE_SIZE]; 155 u8 valid_phy_rateidx[WLAN_RC_PHY_MAX][RATE_TABLE_SIZE];
159 u8 rate_max_phy; 156 u8 rate_max_phy;
157 u8 per[RATE_TABLE_SIZE];
160 u32 probe_time; 158 u32 probe_time;
161 u32 per_down_time; 159 u32 per_down_time;
162 u32 probe_interval; 160 u32 probe_interval;
163 u32 prev_data_rix; 161 u32 prev_data_rix;
164 u32 tx_triglevel_max; 162 u32 tx_triglevel_max;
165 struct ath_tx_ratectrl_state state[RATE_TABLE_SIZE];
166 struct ath_rateset neg_rates; 163 struct ath_rateset neg_rates;
167 struct ath_rateset neg_ht_rates; 164 struct ath_rateset neg_ht_rates;
168 struct ath_rate_softc *asc; 165 struct ath_rate_softc *asc;