diff options
author | Vasanthakumar Thiagarajan <vasanth@atheros.com> | 2009-07-14 20:14:10 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-24 15:05:16 -0400 |
commit | 39a4cafe1638bb21f335b210d037cd2cd8ce6c08 (patch) | |
tree | 12c24df7cbf4ac1bffc4130d03ab7b393fa5a85d /drivers/net/wireless/ath/ath9k/rc.c | |
parent | e25739a171d7352168346dbab7f006e1f9275995 (diff) |
ath9k: Remove dead code in rate control
ath9k rate control is based on only PER (packet error rate),
remove unused code which was intented to do rssi based rate
selection.
Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/rc.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/rc.c | 163 |
1 files changed, 4 insertions, 159 deletions
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c index e66734c2cae1..a39b1a7d3775 100644 --- a/drivers/net/wireless/ath/ath9k/rc.c +++ b/drivers/net/wireless/ath/ath9k/rc.c | |||
@@ -607,47 +607,14 @@ static u8 ath_rc_get_highest_rix(struct ath_softc *sc, | |||
607 | const struct ath_rate_table *rate_table, | 607 | const struct ath_rate_table *rate_table, |
608 | int *is_probing) | 608 | int *is_probing) |
609 | { | 609 | { |
610 | u32 dt, best_thruput, this_thruput, now_msec; | 610 | u32 best_thruput, this_thruput, now_msec; |
611 | u8 rate, next_rate, best_rate, maxindex, minindex; | 611 | u8 rate, next_rate, best_rate, maxindex, minindex; |
612 | int8_t rssi_last, rssi_reduce = 0, index = 0; | 612 | int8_t index = 0; |
613 | |||
614 | *is_probing = 0; | ||
615 | |||
616 | rssi_last = median(ath_rc_priv->rssi_last, | ||
617 | ath_rc_priv->rssi_last_prev, | ||
618 | ath_rc_priv->rssi_last_prev2); | ||
619 | |||
620 | /* | ||
621 | * Age (reduce) last ack rssi based on how old it is. | ||
622 | * The bizarre numbers are so the delta is 160msec, | ||
623 | * meaning we divide by 16. | ||
624 | * 0msec <= dt <= 25msec: don't derate | ||
625 | * 25msec <= dt <= 185msec: derate linearly from 0 to 10dB | ||
626 | * 185msec <= dt: derate by 10dB | ||
627 | */ | ||
628 | 613 | ||
629 | now_msec = jiffies_to_msecs(jiffies); | 614 | now_msec = jiffies_to_msecs(jiffies); |
630 | dt = now_msec - ath_rc_priv->rssi_time; | 615 | *is_probing = 0; |
631 | |||
632 | if (dt >= 185) | ||
633 | rssi_reduce = 10; | ||
634 | else if (dt >= 25) | ||
635 | rssi_reduce = (u8)((dt - 25) >> 4); | ||
636 | |||
637 | /* Now reduce rssi_last by rssi_reduce */ | ||
638 | if (rssi_last < rssi_reduce) | ||
639 | rssi_last = 0; | ||
640 | else | ||
641 | rssi_last -= rssi_reduce; | ||
642 | |||
643 | /* | ||
644 | * Now look up the rate in the rssi table and return it. | ||
645 | * If no rates match then we return 0 (lowest rate) | ||
646 | */ | ||
647 | |||
648 | best_thruput = 0; | 616 | best_thruput = 0; |
649 | maxindex = ath_rc_priv->max_valid_rate-1; | 617 | maxindex = ath_rc_priv->max_valid_rate-1; |
650 | |||
651 | minindex = 0; | 618 | minindex = 0; |
652 | best_rate = minindex; | 619 | best_rate = minindex; |
653 | 620 | ||
@@ -687,7 +654,6 @@ static u8 ath_rc_get_highest_rix(struct ath_softc *sc, | |||
687 | } | 654 | } |
688 | 655 | ||
689 | rate = best_rate; | 656 | rate = best_rate; |
690 | ath_rc_priv->rssi_last_lookup = rssi_last; | ||
691 | 657 | ||
692 | /* | 658 | /* |
693 | * Must check the actual rate (ratekbps) to account for | 659 | * Must check the actual rate (ratekbps) to account for |
@@ -977,10 +943,6 @@ static bool ath_rc_update_per(struct ath_softc *sc, | |||
977 | (nretry_to_per_lookup[retries] >> 3)); | 943 | (nretry_to_per_lookup[retries] >> 3)); |
978 | } | 944 | } |
979 | 945 | ||
980 | ath_rc_priv->rssi_last_prev2 = ath_rc_priv->rssi_last_prev; | ||
981 | ath_rc_priv->rssi_last_prev = ath_rc_priv->rssi_last; | ||
982 | ath_rc_priv->rssi_last = tx_info_priv->tx.ts_rssi; | ||
983 | ath_rc_priv->rssi_time = now_msec; | ||
984 | 946 | ||
985 | /* | 947 | /* |
986 | * If we got at most one retry then increase the max rate if | 948 | * If we got at most one retry then increase the max rate if |
@@ -1024,18 +986,9 @@ static bool ath_rc_update_per(struct ath_softc *sc, | |||
1024 | /* | 986 | /* |
1025 | * Don't update anything. We don't know if | 987 | * Don't update anything. We don't know if |
1026 | * this was because of collisions or poor signal. | 988 | * this was because of collisions or poor signal. |
1027 | * | ||
1028 | * Later: if rssi_ack is close to | ||
1029 | * ath_rc_priv->state[txRate].rssi_thres and we see lots | ||
1030 | * of retries, then we could increase | ||
1031 | * ath_rc_priv->state[txRate].rssi_thres. | ||
1032 | */ | 989 | */ |
1033 | ath_rc_priv->hw_maxretry_pktcnt = 0; | 990 | ath_rc_priv->hw_maxretry_pktcnt = 0; |
1034 | } else { | 991 | } else { |
1035 | int32_t rssi_ackAvg; | ||
1036 | int8_t rssi_thres; | ||
1037 | int8_t rssi_ack_vmin; | ||
1038 | |||
1039 | /* | 992 | /* |
1040 | * It worked with no retries. First ignore bogus (small) | 993 | * It worked with no retries. First ignore bogus (small) |
1041 | * rssi_ack values. | 994 | * rssi_ack values. |
@@ -1045,43 +998,9 @@ static bool ath_rc_update_per(struct ath_softc *sc, | |||
1045 | ath_rc_priv->hw_maxretry_pktcnt++; | 998 | ath_rc_priv->hw_maxretry_pktcnt++; |
1046 | } | 999 | } |
1047 | 1000 | ||
1048 | if (tx_info_priv->tx.ts_rssi < | ||
1049 | rate_table->info[tx_rate].rssi_ack_validmin) | ||
1050 | goto exit; | ||
1051 | |||
1052 | /* Average the rssi */ | ||
1053 | if (tx_rate != ath_rc_priv->rssi_sum_rate) { | ||
1054 | ath_rc_priv->rssi_sum_rate = tx_rate; | ||
1055 | ath_rc_priv->rssi_sum = | ||
1056 | ath_rc_priv->rssi_sum_cnt = 0; | ||
1057 | } | ||
1058 | |||
1059 | ath_rc_priv->rssi_sum += tx_info_priv->tx.ts_rssi; | ||
1060 | ath_rc_priv->rssi_sum_cnt++; | ||
1061 | |||
1062 | if (ath_rc_priv->rssi_sum_cnt < 4) | ||
1063 | goto exit; | ||
1064 | |||
1065 | rssi_ackAvg = | ||
1066 | (ath_rc_priv->rssi_sum + 2) / 4; | ||
1067 | rssi_thres = | ||
1068 | ath_rc_priv->state[tx_rate].rssi_thres; | ||
1069 | rssi_ack_vmin = | ||
1070 | rate_table->info[tx_rate].rssi_ack_validmin; | ||
1071 | |||
1072 | ath_rc_priv->rssi_sum = | ||
1073 | ath_rc_priv->rssi_sum_cnt = 0; | ||
1074 | |||
1075 | /* Now reduce the current rssi threshold */ | ||
1076 | if ((rssi_ackAvg < rssi_thres + 2) && | ||
1077 | (rssi_thres > rssi_ack_vmin)) { | ||
1078 | ath_rc_priv->state[tx_rate].rssi_thres--; | ||
1079 | } | ||
1080 | |||
1081 | state_change = true; | ||
1082 | } | 1001 | } |
1083 | } | 1002 | } |
1084 | exit: | 1003 | |
1085 | return state_change; | 1004 | return state_change; |
1086 | } | 1005 | } |
1087 | 1006 | ||
@@ -1093,11 +1012,6 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1093 | struct ath_tx_info_priv *tx_info_priv, | 1012 | struct ath_tx_info_priv *tx_info_priv, |
1094 | int tx_rate, int xretries, int retries) | 1013 | int tx_rate, int xretries, int retries) |
1095 | { | 1014 | { |
1096 | #define CHK_RSSI(rate) \ | ||
1097 | ((ath_rc_priv->state[(rate)].rssi_thres + \ | ||
1098 | rate_table->info[(rate)].rssi_ack_deltamin) > \ | ||
1099 | ath_rc_priv->state[(rate)+1].rssi_thres) | ||
1100 | |||
1101 | u32 now_msec = jiffies_to_msecs(jiffies); | 1015 | u32 now_msec = jiffies_to_msecs(jiffies); |
1102 | int rate; | 1016 | int rate; |
1103 | u8 last_per; | 1017 | u8 last_per; |
@@ -1108,13 +1022,6 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1108 | if ((tx_rate < 0) || (tx_rate > rate_table->rate_cnt)) | 1022 | if ((tx_rate < 0) || (tx_rate > rate_table->rate_cnt)) |
1109 | return; | 1023 | return; |
1110 | 1024 | ||
1111 | /* To compensate for some imbalance between ctrl and ext. channel */ | ||
1112 | |||
1113 | if (WLAN_RC_PHY_40(rate_table->info[tx_rate].phy)) | ||
1114 | tx_info_priv->tx.ts_rssi = | ||
1115 | tx_info_priv->tx.ts_rssi < 3 ? 0 : | ||
1116 | tx_info_priv->tx.ts_rssi - 3; | ||
1117 | |||
1118 | last_per = ath_rc_priv->state[tx_rate].per; | 1025 | last_per = ath_rc_priv->state[tx_rate].per; |
1119 | 1026 | ||
1120 | /* Update PER first */ | 1027 | /* Update PER first */ |
@@ -1136,51 +1043,6 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1136 | ath_rc_priv->probe_time = now_msec; | 1043 | ath_rc_priv->probe_time = now_msec; |
1137 | } | 1044 | } |
1138 | 1045 | ||
1139 | if (state_change) { | ||
1140 | /* | ||
1141 | * Make sure the rates above this have higher rssi thresholds. | ||
1142 | * (Note: Monotonicity is kept within the OFDM rates and | ||
1143 | * within the CCK rates. However, no adjustment is | ||
1144 | * made to keep the rssi thresholds monotonically | ||
1145 | * increasing between the CCK and OFDM rates.) | ||
1146 | */ | ||
1147 | for (rate = tx_rate; rate < size - 1; rate++) { | ||
1148 | if (rate_table->info[rate+1].phy != | ||
1149 | rate_table->info[tx_rate].phy) | ||
1150 | break; | ||
1151 | |||
1152 | if (CHK_RSSI(rate)) { | ||
1153 | ath_rc_priv->state[rate+1].rssi_thres = | ||
1154 | ath_rc_priv->state[rate].rssi_thres + | ||
1155 | rate_table->info[rate].rssi_ack_deltamin; | ||
1156 | } | ||
1157 | } | ||
1158 | |||
1159 | /* Make sure the rates below this have lower rssi thresholds. */ | ||
1160 | for (rate = tx_rate - 1; rate >= 0; rate--) { | ||
1161 | if (rate_table->info[rate].phy != | ||
1162 | rate_table->info[tx_rate].phy) | ||
1163 | break; | ||
1164 | |||
1165 | if (CHK_RSSI(rate)) { | ||
1166 | if (ath_rc_priv->state[rate+1].rssi_thres < | ||
1167 | rate_table->info[rate].rssi_ack_deltamin) | ||
1168 | ath_rc_priv->state[rate].rssi_thres = 0; | ||
1169 | else { | ||
1170 | ath_rc_priv->state[rate].rssi_thres = | ||
1171 | ath_rc_priv->state[rate+1].rssi_thres - | ||
1172 | rate_table->info[rate].rssi_ack_deltamin; | ||
1173 | } | ||
1174 | |||
1175 | if (ath_rc_priv->state[rate].rssi_thres < | ||
1176 | rate_table->info[rate].rssi_ack_validmin) { | ||
1177 | ath_rc_priv->state[rate].rssi_thres = | ||
1178 | rate_table->info[rate].rssi_ack_validmin; | ||
1179 | } | ||
1180 | } | ||
1181 | } | ||
1182 | } | ||
1183 | |||
1184 | /* Make sure the rates below this have lower PER */ | 1046 | /* Make sure the rates below this have lower PER */ |
1185 | /* Monotonicity is kept only for rates below the current rate. */ | 1047 | /* Monotonicity is kept only for rates below the current rate. */ |
1186 | if (ath_rc_priv->state[tx_rate].per < last_per) { | 1048 | if (ath_rc_priv->state[tx_rate].per < last_per) { |
@@ -1205,19 +1067,6 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1205 | ath_rc_priv->state[rate].per; | 1067 | ath_rc_priv->state[rate].per; |
1206 | } | 1068 | } |
1207 | 1069 | ||
1208 | /* Every so often, we reduce the thresholds and | ||
1209 | * PER (different for CCK and OFDM). */ | ||
1210 | if (now_msec - ath_rc_priv->rssi_down_time >= | ||
1211 | rate_table->rssi_reduce_interval) { | ||
1212 | |||
1213 | for (rate = 0; rate < size; rate++) { | ||
1214 | if (ath_rc_priv->state[rate].rssi_thres > | ||
1215 | rate_table->info[rate].rssi_ack_validmin) | ||
1216 | ath_rc_priv->state[rate].rssi_thres -= 1; | ||
1217 | } | ||
1218 | ath_rc_priv->rssi_down_time = now_msec; | ||
1219 | } | ||
1220 | |||
1221 | /* Every so often, we reduce the thresholds | 1070 | /* Every so often, we reduce the thresholds |
1222 | * and PER (different for CCK and OFDM). */ | 1071 | * and PER (different for CCK and OFDM). */ |
1223 | if (now_msec - ath_rc_priv->per_down_time >= | 1072 | if (now_msec - ath_rc_priv->per_down_time >= |
@@ -1233,7 +1082,6 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1233 | ath_debug_stat_retries(sc, tx_rate, xretries, retries, | 1082 | ath_debug_stat_retries(sc, tx_rate, xretries, retries, |
1234 | ath_rc_priv->state[tx_rate].per); | 1083 | ath_rc_priv->state[tx_rate].per); |
1235 | 1084 | ||
1236 | #undef CHK_RSSI | ||
1237 | } | 1085 | } |
1238 | 1086 | ||
1239 | static int ath_rc_get_rateindex(const struct ath_rate_table *rate_table, | 1087 | static int ath_rc_get_rateindex(const struct ath_rate_table *rate_table, |
@@ -1369,8 +1217,6 @@ static void ath_rc_init(struct ath_softc *sc, | |||
1369 | 1217 | ||
1370 | /* Initialize thresholds according to the global rate table */ | 1218 | /* Initialize thresholds according to the global rate table */ |
1371 | for (i = 0 ; i < ath_rc_priv->rate_table_size; i++) { | 1219 | for (i = 0 ; i < ath_rc_priv->rate_table_size; i++) { |
1372 | ath_rc_priv->state[i].rssi_thres = | ||
1373 | rate_table->info[i].rssi_ack_validmin; | ||
1374 | ath_rc_priv->state[i].per = 0; | 1220 | ath_rc_priv->state[i].per = 0; |
1375 | } | 1221 | } |
1376 | 1222 | ||
@@ -1631,7 +1477,6 @@ static void *ath_rate_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp | |||
1631 | return NULL; | 1477 | return NULL; |
1632 | } | 1478 | } |
1633 | 1479 | ||
1634 | rate_priv->rssi_down_time = jiffies_to_msecs(jiffies); | ||
1635 | rate_priv->tx_triglevel_max = sc->sc_ah->caps.tx_triglevel_max; | 1480 | rate_priv->tx_triglevel_max = sc->sc_ah->caps.tx_triglevel_max; |
1636 | 1481 | ||
1637 | return rate_priv; | 1482 | return rate_priv; |