diff options
author | Sujith <Sujith.Manoharan@atheros.com> | 2008-08-14 03:56:55 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-08-29 16:24:04 -0400 |
commit | dc2222a85fd63103b9aad0d4b77c4d87b78c58a2 (patch) | |
tree | 644f54a9be7f6a6ed63df549bf31be8e44b4200c /drivers/net/wireless/ath9k | |
parent | 927e70e9244e6ecdc7c28bc5424b0b8c11dee314 (diff) |
ath9k: Random cleanup
Remove dead code, add newlines, fix indentation.
Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k')
-rw-r--r-- | drivers/net/wireless/ath9k/core.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/hw.c | 13 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/rc.c | 159 |
3 files changed, 83 insertions, 94 deletions
diff --git a/drivers/net/wireless/ath9k/core.c b/drivers/net/wireless/ath9k/core.c index a9e8ad053a30..e3682b6ccfb2 100644 --- a/drivers/net/wireless/ath9k/core.c +++ b/drivers/net/wireless/ath9k/core.c | |||
@@ -1025,7 +1025,6 @@ int ath_init(u16 devid, struct ath_softc *sc) | |||
1025 | int status; | 1025 | int status; |
1026 | int error = 0, i; | 1026 | int error = 0, i; |
1027 | int csz = 0; | 1027 | int csz = 0; |
1028 | u32 rd; | ||
1029 | 1028 | ||
1030 | /* XXX: hardware will not be ready until ath_open() being called */ | 1029 | /* XXX: hardware will not be ready until ath_open() being called */ |
1031 | sc->sc_flags |= SC_OP_INVALID; | 1030 | sc->sc_flags |= SC_OP_INVALID; |
@@ -1091,8 +1090,6 @@ int ath_init(u16 devid, struct ath_softc *sc) | |||
1091 | * is resposible for filtering this list based on settings | 1090 | * is resposible for filtering this list based on settings |
1092 | * like the phy mode. | 1091 | * like the phy mode. |
1093 | */ | 1092 | */ |
1094 | rd = ah->ah_currentRD; | ||
1095 | |||
1096 | error = ath_setup_channels(sc); | 1093 | error = ath_setup_channels(sc); |
1097 | if (error) | 1094 | if (error) |
1098 | goto bad; | 1095 | goto bad; |
@@ -1169,7 +1166,7 @@ int ath_init(u16 devid, struct ath_softc *sc) | |||
1169 | 1166 | ||
1170 | sc->sc_rc = ath_rate_attach(ah); | 1167 | sc->sc_rc = ath_rate_attach(ah); |
1171 | if (sc->sc_rc == NULL) { | 1168 | if (sc->sc_rc == NULL) { |
1172 | error = EIO; | 1169 | error = -EIO; |
1173 | goto bad2; | 1170 | goto bad2; |
1174 | } | 1171 | } |
1175 | 1172 | ||
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c index 24b78c2eb44b..7d8c908d69d5 100644 --- a/drivers/net/wireless/ath9k/hw.c +++ b/drivers/net/wireless/ath9k/hw.c | |||
@@ -7654,8 +7654,7 @@ bool ath9k_hw_resettxqueue(struct ath_hal *ah, u32 q) | |||
7654 | REG_WRITE(ah, AR_DRETRY_LIMIT(q), | 7654 | REG_WRITE(ah, AR_DRETRY_LIMIT(q), |
7655 | SM(INIT_SSH_RETRY, AR_D_RETRY_LIMIT_STA_SH) | 7655 | SM(INIT_SSH_RETRY, AR_D_RETRY_LIMIT_STA_SH) |
7656 | | SM(INIT_SLG_RETRY, AR_D_RETRY_LIMIT_STA_LG) | 7656 | | SM(INIT_SLG_RETRY, AR_D_RETRY_LIMIT_STA_LG) |
7657 | | SM(qi->tqi_shretry, AR_D_RETRY_LIMIT_FR_SH) | 7657 | | SM(qi->tqi_shretry, AR_D_RETRY_LIMIT_FR_SH)); |
7658 | ); | ||
7659 | 7658 | ||
7660 | REG_WRITE(ah, AR_QMISC(q), AR_Q_MISC_DCU_EARLY_TERM_REQ); | 7659 | REG_WRITE(ah, AR_QMISC(q), AR_Q_MISC_DCU_EARLY_TERM_REQ); |
7661 | REG_WRITE(ah, AR_DMISC(q), | 7660 | REG_WRITE(ah, AR_DMISC(q), |
@@ -8300,15 +8299,7 @@ struct ath_hal *ath9k_hw_attach(u16 devid, | |||
8300 | *error = -ENXIO; | 8299 | *error = -ENXIO; |
8301 | break; | 8300 | break; |
8302 | } | 8301 | } |
8303 | if (ah != NULL) { | 8302 | |
8304 | ah->ah_devid = ah->ah_devid; | ||
8305 | ah->ah_subvendorid = ah->ah_subvendorid; | ||
8306 | ah->ah_macVersion = ah->ah_macVersion; | ||
8307 | ah->ah_macRev = ah->ah_macRev; | ||
8308 | ah->ah_phyRev = ah->ah_phyRev; | ||
8309 | ah->ah_analog5GhzRev = ah->ah_analog5GhzRev; | ||
8310 | ah->ah_analog2GhzRev = ah->ah_analog2GhzRev; | ||
8311 | } | ||
8312 | return ah; | 8303 | return ah; |
8313 | } | 8304 | } |
8314 | 8305 | ||
diff --git a/drivers/net/wireless/ath9k/rc.c b/drivers/net/wireless/ath9k/rc.c index 1392361ef9a6..1dd7c71daf0a 100644 --- a/drivers/net/wireless/ath9k/rc.c +++ b/drivers/net/wireless/ath9k/rc.c | |||
@@ -653,8 +653,8 @@ ath_rc_sib_init_validrates(struct ath_rate_node *ath_rc_priv, | |||
653 | rate_ctrl = (struct ath_tx_ratectrl *)(ath_rc_priv); | 653 | rate_ctrl = (struct ath_tx_ratectrl *)(ath_rc_priv); |
654 | for (i = 0; i < rate_table->rate_cnt; i++) { | 654 | for (i = 0; i < rate_table->rate_cnt; i++) { |
655 | valid = (ath_rc_priv->single_stream ? | 655 | valid = (ath_rc_priv->single_stream ? |
656 | rate_table->info[i].valid_single_stream : | 656 | rate_table->info[i].valid_single_stream : |
657 | rate_table->info[i].valid); | 657 | rate_table->info[i].valid); |
658 | if (valid == TRUE) { | 658 | if (valid == TRUE) { |
659 | u32 phy = rate_table->info[i].phy; | 659 | u32 phy = rate_table->info[i].phy; |
660 | u8 valid_rate_count = 0; | 660 | u8 valid_rate_count = 0; |
@@ -740,14 +740,14 @@ ath_rc_sib_setvalid_htrates(struct ath_rate_node *ath_rc_priv, | |||
740 | for (j = 0; j < rate_table->rate_cnt; j++) { | 740 | for (j = 0; j < rate_table->rate_cnt; j++) { |
741 | u32 phy = rate_table->info[j].phy; | 741 | u32 phy = rate_table->info[j].phy; |
742 | u32 valid = (ath_rc_priv->single_stream ? | 742 | u32 valid = (ath_rc_priv->single_stream ? |
743 | rate_table->info[j].valid_single_stream : | 743 | rate_table->info[j].valid_single_stream : |
744 | rate_table->info[j].valid); | 744 | rate_table->info[j].valid); |
745 | 745 | ||
746 | if (((((struct ath_rateset *) | 746 | if (((((struct ath_rateset *) |
747 | mcs_set)->rs_rates[i] & 0x7F) != | 747 | mcs_set)->rs_rates[i] & 0x7F) != |
748 | (rate_table->info[j].dot11rate & 0x7F)) || | 748 | (rate_table->info[j].dot11rate & 0x7F)) || |
749 | !WLAN_RC_PHY_HT(phy) || | 749 | !WLAN_RC_PHY_HT(phy) || |
750 | !WLAN_RC_PHY_HT_VALID(valid, capflag)) | 750 | !WLAN_RC_PHY_HT_VALID(valid, capflag)) |
751 | continue; | 751 | continue; |
752 | 752 | ||
753 | if (!ath_rc_valid_phyrate(phy, capflag, FALSE)) | 753 | if (!ath_rc_valid_phyrate(phy, capflag, FALSE)) |
@@ -866,10 +866,10 @@ void ath_rate_newstate(struct ath_softc *sc, struct ath_vap *avp) | |||
866 | } | 866 | } |
867 | 867 | ||
868 | static u8 ath_rc_ratefind_ht(struct ath_softc *sc, | 868 | static u8 ath_rc_ratefind_ht(struct ath_softc *sc, |
869 | struct ath_rate_node *ath_rc_priv, | 869 | struct ath_rate_node *ath_rc_priv, |
870 | const struct ath_rate_table *rate_table, | 870 | const struct ath_rate_table *rate_table, |
871 | int probe_allowed, int *is_probing, | 871 | int probe_allowed, int *is_probing, |
872 | int is_retry) | 872 | int is_retry) |
873 | { | 873 | { |
874 | u32 dt, best_thruput, this_thruput, now_msec; | 874 | u32 dt, best_thruput, this_thruput, now_msec; |
875 | u8 rate, next_rate, best_rate, maxindex, minindex; | 875 | u8 rate, next_rate, best_rate, maxindex, minindex; |
@@ -997,8 +997,8 @@ static u8 ath_rc_ratefind_ht(struct ath_softc *sc, | |||
997 | rate = rate_ctrl->rate_table_size - 1; | 997 | rate = rate_ctrl->rate_table_size - 1; |
998 | 998 | ||
999 | ASSERT((rate_table->info[rate].valid && !ath_rc_priv->single_stream) || | 999 | ASSERT((rate_table->info[rate].valid && !ath_rc_priv->single_stream) || |
1000 | (rate_table->info[rate].valid_single_stream && | 1000 | (rate_table->info[rate].valid_single_stream && |
1001 | ath_rc_priv->single_stream)); | 1001 | ath_rc_priv->single_stream)); |
1002 | 1002 | ||
1003 | return rate; | 1003 | return rate; |
1004 | } | 1004 | } |
@@ -1023,10 +1023,10 @@ static void ath_rc_rate_set_series(const struct ath_rate_table *rate_table , | |||
1023 | } | 1023 | } |
1024 | 1024 | ||
1025 | static u8 ath_rc_rate_getidx(struct ath_softc *sc, | 1025 | static u8 ath_rc_rate_getidx(struct ath_softc *sc, |
1026 | struct ath_rate_node *ath_rc_priv, | 1026 | struct ath_rate_node *ath_rc_priv, |
1027 | const struct ath_rate_table *rate_table, | 1027 | const struct ath_rate_table *rate_table, |
1028 | u8 rix, u16 stepdown, | 1028 | u8 rix, u16 stepdown, |
1029 | u16 min_rate) | 1029 | u16 min_rate) |
1030 | { | 1030 | { |
1031 | u32 j; | 1031 | u32 j; |
1032 | u8 nextindex; | 1032 | u8 nextindex; |
@@ -1066,8 +1066,8 @@ static void ath_rc_ratefind(struct ath_softc *sc, | |||
1066 | rate_table = | 1066 | rate_table = |
1067 | (struct ath_rate_table *)asc->hw_rate_table[sc->sc_curmode]; | 1067 | (struct ath_rate_table *)asc->hw_rate_table[sc->sc_curmode]; |
1068 | rix = ath_rc_ratefind_ht(sc, ath_rc_priv, rate_table, | 1068 | rix = ath_rc_ratefind_ht(sc, ath_rc_priv, rate_table, |
1069 | (rcflag & ATH_RC_PROBE_ALLOWED) ? 1 : 0, | 1069 | (rcflag & ATH_RC_PROBE_ALLOWED) ? 1 : 0, |
1070 | is_probe, is_retry); | 1070 | is_probe, is_retry); |
1071 | nrix = rix; | 1071 | nrix = rix; |
1072 | 1072 | ||
1073 | if ((rcflag & ATH_RC_PROBE_ALLOWED) && (*is_probe)) { | 1073 | if ((rcflag & ATH_RC_PROBE_ALLOWED) && (*is_probe)) { |
@@ -1099,13 +1099,13 @@ static void ath_rc_ratefind(struct ath_softc *sc, | |||
1099 | try_num = ((i + 1) == num_rates) ? | 1099 | try_num = ((i + 1) == num_rates) ? |
1100 | num_tries - (try_per_rate * i) : try_per_rate ; | 1100 | num_tries - (try_per_rate * i) : try_per_rate ; |
1101 | min_rate = (((i + 1) == num_rates) && | 1101 | min_rate = (((i + 1) == num_rates) && |
1102 | (rcflag & ATH_RC_MINRATE_LASTRATE)) ? 1 : 0; | 1102 | (rcflag & ATH_RC_MINRATE_LASTRATE)) ? 1 : 0; |
1103 | 1103 | ||
1104 | nrix = ath_rc_rate_getidx(sc, ath_rc_priv, | 1104 | nrix = ath_rc_rate_getidx(sc, ath_rc_priv, |
1105 | rate_table, nrix, 1, min_rate); | 1105 | rate_table, nrix, 1, min_rate); |
1106 | /* All other rates in the series have RTS enabled */ | 1106 | /* All other rates in the series have RTS enabled */ |
1107 | ath_rc_rate_set_series(rate_table, | 1107 | ath_rc_rate_set_series(rate_table, |
1108 | &series[i], try_num, nrix, TRUE); | 1108 | &series[i], try_num, nrix, TRUE); |
1109 | } | 1109 | } |
1110 | 1110 | ||
1111 | /* | 1111 | /* |
@@ -1124,13 +1124,13 @@ static void ath_rc_ratefind(struct ath_softc *sc, | |||
1124 | * above conditions. | 1124 | * above conditions. |
1125 | */ | 1125 | */ |
1126 | if ((sc->sc_curmode == ATH9K_MODE_11NG_HT20) || | 1126 | if ((sc->sc_curmode == ATH9K_MODE_11NG_HT20) || |
1127 | (sc->sc_curmode == ATH9K_MODE_11NG_HT40PLUS) || | 1127 | (sc->sc_curmode == ATH9K_MODE_11NG_HT40PLUS) || |
1128 | (sc->sc_curmode == ATH9K_MODE_11NG_HT40MINUS)) { | 1128 | (sc->sc_curmode == ATH9K_MODE_11NG_HT40MINUS)) { |
1129 | u8 dot11rate = rate_table->info[rix].dot11rate; | 1129 | u8 dot11rate = rate_table->info[rix].dot11rate; |
1130 | u8 phy = rate_table->info[rix].phy; | 1130 | u8 phy = rate_table->info[rix].phy; |
1131 | if (i == 4 && | 1131 | if (i == 4 && |
1132 | ((dot11rate == 2 && phy == WLAN_RC_PHY_HT_40_SS) || | 1132 | ((dot11rate == 2 && phy == WLAN_RC_PHY_HT_40_SS) || |
1133 | (dot11rate == 3 && phy == WLAN_RC_PHY_HT_20_SS))) { | 1133 | (dot11rate == 3 && phy == WLAN_RC_PHY_HT_20_SS))) { |
1134 | series[3].rix = series[2].rix; | 1134 | series[3].rix = series[2].rix; |
1135 | series[3].flags = series[2].flags; | 1135 | series[3].flags = series[2].flags; |
1136 | series[3].max_4ms_framelen = series[2].max_4ms_framelen; | 1136 | series[3].max_4ms_framelen = series[2].max_4ms_framelen; |
@@ -1152,7 +1152,8 @@ void ath_rate_findrate(struct ath_softc *sc, | |||
1152 | { | 1152 | { |
1153 | struct ath_vap *avp = ath_rc_priv->avp; | 1153 | struct ath_vap *avp = ath_rc_priv->avp; |
1154 | 1154 | ||
1155 | DPRINTF(sc, ATH_DBG_RATE, "%s", __func__); | 1155 | DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__); |
1156 | |||
1156 | if (!num_rates || !num_tries) | 1157 | if (!num_rates || !num_tries) |
1157 | return; | 1158 | return; |
1158 | 1159 | ||
@@ -1174,9 +1175,8 @@ void ath_rate_findrate(struct ath_softc *sc, | |||
1174 | unsigned int mcs; | 1175 | unsigned int mcs; |
1175 | u8 series_rix = 0; | 1176 | u8 series_rix = 0; |
1176 | 1177 | ||
1177 | series[idx].tries = | 1178 | series[idx].tries = IEEE80211_RATE_IDX_ENTRY( |
1178 | IEEE80211_RATE_IDX_ENTRY( | 1179 | avp->av_config.av_fixed_retryset, idx); |
1179 | avp->av_config.av_fixed_retryset, idx); | ||
1180 | 1180 | ||
1181 | mcs = IEEE80211_RATE_IDX_ENTRY( | 1181 | mcs = IEEE80211_RATE_IDX_ENTRY( |
1182 | avp->av_config.av_fixed_rateset, idx); | 1182 | avp->av_config.av_fixed_rateset, idx); |
@@ -1228,7 +1228,7 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1228 | u32 now_msec = jiffies_to_msecs(jiffies); | 1228 | u32 now_msec = jiffies_to_msecs(jiffies); |
1229 | int state_change = FALSE, rate, count; | 1229 | int state_change = FALSE, rate, count; |
1230 | u8 last_per; | 1230 | u8 last_per; |
1231 | struct ath_rate_softc *asc = (struct ath_rate_softc *)sc->sc_rc; | 1231 | struct ath_rate_softc *asc = (struct ath_rate_softc *)sc->sc_rc; |
1232 | struct ath_rate_table *rate_table = | 1232 | struct ath_rate_table *rate_table = |
1233 | (struct ath_rate_table *)asc->hw_rate_table[sc->sc_curmode]; | 1233 | (struct ath_rate_table *)asc->hw_rate_table[sc->sc_curmode]; |
1234 | 1234 | ||
@@ -1272,14 +1272,14 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1272 | } else { | 1272 | } else { |
1273 | /* xretries == 2 */ | 1273 | /* xretries == 2 */ |
1274 | count = sizeof(nretry_to_per_lookup) / | 1274 | count = sizeof(nretry_to_per_lookup) / |
1275 | sizeof(nretry_to_per_lookup[0]); | 1275 | sizeof(nretry_to_per_lookup[0]); |
1276 | if (retries >= count) | 1276 | if (retries >= count) |
1277 | retries = count - 1; | 1277 | retries = count - 1; |
1278 | /* new_PER = 7/8*old_PER + 1/8*(currentPER) */ | 1278 | /* new_PER = 7/8*old_PER + 1/8*(currentPER) */ |
1279 | rate_ctrl->state[tx_rate].per = | 1279 | rate_ctrl->state[tx_rate].per = |
1280 | (u8)(rate_ctrl->state[tx_rate].per - | 1280 | (u8)(rate_ctrl->state[tx_rate].per - |
1281 | (rate_ctrl->state[tx_rate].per >> 3) + | 1281 | (rate_ctrl->state[tx_rate].per >> 3) + |
1282 | ((100) >> 3)); | 1282 | ((100) >> 3)); |
1283 | } | 1283 | } |
1284 | 1284 | ||
1285 | /* xretries == 1 or 2 */ | 1285 | /* xretries == 1 or 2 */ |
@@ -1295,8 +1295,7 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1295 | if (retries >= count) | 1295 | if (retries >= count) |
1296 | retries = count - 1; | 1296 | retries = count - 1; |
1297 | if (info_priv->n_bad_frames) { | 1297 | if (info_priv->n_bad_frames) { |
1298 | /* new_PER = 7/8*old_PER + 1/8*(currentPER) */ | 1298 | /* new_PER = 7/8*old_PER + 1/8*(currentPER) |
1299 | /* | ||
1300 | * Assuming that n_frames is not 0. The current PER | 1299 | * Assuming that n_frames is not 0. The current PER |
1301 | * from the retries is 100 * retries / (retries+1), | 1300 | * from the retries is 100 * retries / (retries+1), |
1302 | * since the first retries attempts failed, and the | 1301 | * since the first retries attempts failed, and the |
@@ -1386,7 +1385,7 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1386 | * rssi_ack values. | 1385 | * rssi_ack values. |
1387 | */ | 1386 | */ |
1388 | if (tx_rate == rate_ctrl->rate_max_phy && | 1387 | if (tx_rate == rate_ctrl->rate_max_phy && |
1389 | rate_ctrl->hw_maxretry_pktcnt < 255) { | 1388 | rate_ctrl->hw_maxretry_pktcnt < 255) { |
1390 | rate_ctrl->hw_maxretry_pktcnt++; | 1389 | rate_ctrl->hw_maxretry_pktcnt++; |
1391 | } | 1390 | } |
1392 | 1391 | ||
@@ -1418,7 +1417,7 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1418 | /* Now reduce the current | 1417 | /* Now reduce the current |
1419 | * rssi threshold. */ | 1418 | * rssi threshold. */ |
1420 | if ((rssi_ackAvg < rssi_thres + 2) && | 1419 | if ((rssi_ackAvg < rssi_thres + 2) && |
1421 | (rssi_thres > rssi_ack_vmin)) { | 1420 | (rssi_thres > rssi_ack_vmin)) { |
1422 | rate_ctrl->state[tx_rate]. | 1421 | rate_ctrl->state[tx_rate]. |
1423 | rssi_thres--; | 1422 | rssi_thres--; |
1424 | } | 1423 | } |
@@ -1436,10 +1435,10 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1436 | * a while (except if we are probing). | 1435 | * a while (except if we are probing). |
1437 | */ | 1436 | */ |
1438 | if (rate_ctrl->state[tx_rate].per >= 55 && tx_rate > 0 && | 1437 | if (rate_ctrl->state[tx_rate].per >= 55 && tx_rate > 0 && |
1439 | rate_table->info[tx_rate].ratekbps <= | 1438 | rate_table->info[tx_rate].ratekbps <= |
1440 | rate_table->info[rate_ctrl->rate_max_phy].ratekbps) { | 1439 | rate_table->info[rate_ctrl->rate_max_phy].ratekbps) { |
1441 | ath_rc_get_nextlowervalid_txrate(rate_table, rate_ctrl, | 1440 | ath_rc_get_nextlowervalid_txrate(rate_table, rate_ctrl, |
1442 | (u8) tx_rate, &rate_ctrl->rate_max_phy); | 1441 | (u8) tx_rate, &rate_ctrl->rate_max_phy); |
1443 | 1442 | ||
1444 | /* Don't probe for a little while. */ | 1443 | /* Don't probe for a little while. */ |
1445 | rate_ctrl->probe_time = now_msec; | 1444 | rate_ctrl->probe_time = now_msec; |
@@ -1460,43 +1459,43 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1460 | break; | 1459 | break; |
1461 | 1460 | ||
1462 | if (rate_ctrl->state[rate].rssi_thres + | 1461 | if (rate_ctrl->state[rate].rssi_thres + |
1463 | rate_table->info[rate].rssi_ack_deltamin > | 1462 | rate_table->info[rate].rssi_ack_deltamin > |
1464 | rate_ctrl->state[rate+1].rssi_thres) { | 1463 | rate_ctrl->state[rate+1].rssi_thres) { |
1465 | rate_ctrl->state[rate+1].rssi_thres = | 1464 | rate_ctrl->state[rate+1].rssi_thres = |
1466 | rate_ctrl->state[rate]. | 1465 | rate_ctrl->state[rate]. |
1467 | rssi_thres + | 1466 | rssi_thres + |
1468 | rate_table->info[rate]. | 1467 | rate_table->info[rate]. |
1469 | rssi_ack_deltamin; | 1468 | rssi_ack_deltamin; |
1470 | } | 1469 | } |
1471 | } | 1470 | } |
1472 | 1471 | ||
1473 | /* Make sure the rates below this have lower rssi thresholds. */ | 1472 | /* Make sure the rates below this have lower rssi thresholds. */ |
1474 | for (rate = tx_rate - 1; rate >= 0; rate--) { | 1473 | for (rate = tx_rate - 1; rate >= 0; rate--) { |
1475 | if (rate_table->info[rate].phy != | 1474 | if (rate_table->info[rate].phy != |
1476 | rate_table->info[tx_rate].phy) | 1475 | rate_table->info[tx_rate].phy) |
1477 | break; | 1476 | break; |
1478 | 1477 | ||
1479 | if (rate_ctrl->state[rate].rssi_thres + | 1478 | if (rate_ctrl->state[rate].rssi_thres + |
1480 | rate_table->info[rate].rssi_ack_deltamin > | 1479 | rate_table->info[rate].rssi_ack_deltamin > |
1481 | rate_ctrl->state[rate+1].rssi_thres) { | 1480 | rate_ctrl->state[rate+1].rssi_thres) { |
1482 | if (rate_ctrl->state[rate+1].rssi_thres < | 1481 | if (rate_ctrl->state[rate+1].rssi_thres < |
1483 | rate_table->info[rate]. | 1482 | rate_table->info[rate]. |
1484 | rssi_ack_deltamin) | 1483 | rssi_ack_deltamin) |
1485 | rate_ctrl->state[rate].rssi_thres = 0; | 1484 | rate_ctrl->state[rate].rssi_thres = 0; |
1486 | else { | 1485 | else { |
1487 | rate_ctrl->state[rate].rssi_thres = | 1486 | rate_ctrl->state[rate].rssi_thres = |
1488 | rate_ctrl->state[rate+1]. | 1487 | rate_ctrl->state[rate+1]. |
1489 | rssi_thres - | 1488 | rssi_thres - |
1490 | rate_table->info[rate]. | 1489 | rate_table->info[rate]. |
1491 | rssi_ack_deltamin; | 1490 | rssi_ack_deltamin; |
1492 | } | 1491 | } |
1493 | 1492 | ||
1494 | if (rate_ctrl->state[rate].rssi_thres < | 1493 | if (rate_ctrl->state[rate].rssi_thres < |
1495 | rate_table->info[rate]. | 1494 | rate_table->info[rate]. |
1496 | rssi_ack_validmin) { | 1495 | rssi_ack_validmin) { |
1497 | rate_ctrl->state[rate].rssi_thres = | 1496 | rate_ctrl->state[rate].rssi_thres = |
1498 | rate_table->info[rate]. | 1497 | rate_table->info[rate]. |
1499 | rssi_ack_validmin; | 1498 | rssi_ack_validmin; |
1500 | } | 1499 | } |
1501 | } | 1500 | } |
1502 | } | 1501 | } |
@@ -1507,11 +1506,11 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1507 | if (rate_ctrl->state[tx_rate].per < last_per) { | 1506 | if (rate_ctrl->state[tx_rate].per < last_per) { |
1508 | for (rate = tx_rate - 1; rate >= 0; rate--) { | 1507 | for (rate = tx_rate - 1; rate >= 0; rate--) { |
1509 | if (rate_table->info[rate].phy != | 1508 | if (rate_table->info[rate].phy != |
1510 | rate_table->info[tx_rate].phy) | 1509 | rate_table->info[tx_rate].phy) |
1511 | break; | 1510 | break; |
1512 | 1511 | ||
1513 | if (rate_ctrl->state[rate].per > | 1512 | if (rate_ctrl->state[rate].per > |
1514 | rate_ctrl->state[rate+1].per) { | 1513 | rate_ctrl->state[rate+1].per) { |
1515 | rate_ctrl->state[rate].per = | 1514 | rate_ctrl->state[rate].per = |
1516 | rate_ctrl->state[rate+1].per; | 1515 | rate_ctrl->state[rate+1].per; |
1517 | } | 1516 | } |
@@ -1528,11 +1527,11 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1528 | /* Every so often, we reduce the thresholds and | 1527 | /* Every so often, we reduce the thresholds and |
1529 | * PER (different for CCK and OFDM). */ | 1528 | * PER (different for CCK and OFDM). */ |
1530 | if (now_msec - rate_ctrl->rssi_down_time >= | 1529 | if (now_msec - rate_ctrl->rssi_down_time >= |
1531 | rate_table->rssi_reduce_interval) { | 1530 | rate_table->rssi_reduce_interval) { |
1532 | 1531 | ||
1533 | for (rate = 0; rate < rate_ctrl->rate_table_size; rate++) { | 1532 | for (rate = 0; rate < rate_ctrl->rate_table_size; rate++) { |
1534 | if (rate_ctrl->state[rate].rssi_thres > | 1533 | if (rate_ctrl->state[rate].rssi_thres > |
1535 | rate_table->info[rate].rssi_ack_validmin) | 1534 | rate_table->info[rate].rssi_ack_validmin) |
1536 | rate_ctrl->state[rate].rssi_thres -= 1; | 1535 | rate_ctrl->state[rate].rssi_thres -= 1; |
1537 | } | 1536 | } |
1538 | rate_ctrl->rssi_down_time = now_msec; | 1537 | rate_ctrl->rssi_down_time = now_msec; |
@@ -1541,7 +1540,7 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1541 | /* Every so often, we reduce the thresholds | 1540 | /* Every so often, we reduce the thresholds |
1542 | * and PER (different for CCK and OFDM). */ | 1541 | * and PER (different for CCK and OFDM). */ |
1543 | if (now_msec - rate_ctrl->per_down_time >= | 1542 | if (now_msec - rate_ctrl->per_down_time >= |
1544 | rate_table->rssi_reduce_interval) { | 1543 | rate_table->rssi_reduce_interval) { |
1545 | for (rate = 0; rate < rate_ctrl->rate_table_size; rate++) { | 1544 | for (rate = 0; rate < rate_ctrl->rate_table_size; rate++) { |
1546 | rate_ctrl->state[rate].per = | 1545 | rate_ctrl->state[rate].per = |
1547 | 7 * rate_ctrl->state[rate].per / 8; | 1546 | 7 * rate_ctrl->state[rate].per / 8; |
@@ -1560,7 +1559,7 @@ static void ath_rc_update(struct ath_softc *sc, | |||
1560 | struct ath_tx_info_priv *info_priv, int final_ts_idx, | 1559 | struct ath_tx_info_priv *info_priv, int final_ts_idx, |
1561 | int xretries, int long_retry) | 1560 | int xretries, int long_retry) |
1562 | { | 1561 | { |
1563 | struct ath_rate_softc *asc = (struct ath_rate_softc *)sc->sc_rc; | 1562 | struct ath_rate_softc *asc = (struct ath_rate_softc *)sc->sc_rc; |
1564 | struct ath_rate_table *rate_table; | 1563 | struct ath_rate_table *rate_table; |
1565 | struct ath_tx_ratectrl *rate_ctrl; | 1564 | struct ath_tx_ratectrl *rate_ctrl; |
1566 | struct ath_rc_series rcs[4]; | 1565 | struct ath_rc_series rcs[4]; |
@@ -1637,7 +1636,6 @@ static void ath_rc_update(struct ath_softc *sc, | |||
1637 | xretries, long_retry); | 1636 | xretries, long_retry); |
1638 | } | 1637 | } |
1639 | 1638 | ||
1640 | |||
1641 | /* | 1639 | /* |
1642 | * Process a tx descriptor for a completed transmit (success or failure). | 1640 | * Process a tx descriptor for a completed transmit (success or failure). |
1643 | */ | 1641 | */ |
@@ -1651,13 +1649,13 @@ static void ath_rate_tx_complete(struct ath_softc *sc, | |||
1651 | struct ath_vap *avp; | 1649 | struct ath_vap *avp; |
1652 | 1650 | ||
1653 | avp = rc_priv->avp; | 1651 | avp = rc_priv->avp; |
1654 | if ((avp->av_config.av_fixed_rateset != IEEE80211_FIXED_RATE_NONE) | 1652 | if ((avp->av_config.av_fixed_rateset != IEEE80211_FIXED_RATE_NONE) || |
1655 | || info_priv->tx.ts_status & ATH9K_TXERR_FILT) | 1653 | (info_priv->tx.ts_status & ATH9K_TXERR_FILT)) |
1656 | return; | 1654 | return; |
1657 | 1655 | ||
1658 | if (info_priv->tx.ts_rssi > 0) { | 1656 | if (info_priv->tx.ts_rssi > 0) { |
1659 | ATH_RSSI_LPF(an->an_chainmask_sel.tx_avgrssi, | 1657 | ATH_RSSI_LPF(an->an_chainmask_sel.tx_avgrssi, |
1660 | info_priv->tx.ts_rssi); | 1658 | info_priv->tx.ts_rssi); |
1661 | } | 1659 | } |
1662 | 1660 | ||
1663 | /* | 1661 | /* |
@@ -1682,7 +1680,6 @@ static void ath_rate_tx_complete(struct ath_softc *sc, | |||
1682 | info_priv->tx.ts_longretry); | 1680 | info_priv->tx.ts_longretry); |
1683 | } | 1681 | } |
1684 | 1682 | ||
1685 | |||
1686 | /* | 1683 | /* |
1687 | * Update the SIB's rate control information | 1684 | * Update the SIB's rate control information |
1688 | * | 1685 | * |
@@ -1701,8 +1698,8 @@ static void ath_rc_sib_update(struct ath_softc *sc, | |||
1701 | struct ath_rate_softc *asc = (struct ath_rate_softc *)sc->sc_rc; | 1698 | struct ath_rate_softc *asc = (struct ath_rate_softc *)sc->sc_rc; |
1702 | struct ath_rateset *rateset = negotiated_rates; | 1699 | struct ath_rateset *rateset = negotiated_rates; |
1703 | u8 *ht_mcs = (u8 *)negotiated_htrates; | 1700 | u8 *ht_mcs = (u8 *)negotiated_htrates; |
1704 | struct ath_tx_ratectrl *rate_ctrl = (struct ath_tx_ratectrl *) | 1701 | struct ath_tx_ratectrl *rate_ctrl = |
1705 | (ath_rc_priv); | 1702 | (struct ath_tx_ratectrl *)ath_rc_priv; |
1706 | u8 i, j, k, hi = 0, hthi = 0; | 1703 | u8 i, j, k, hi = 0, hthi = 0; |
1707 | 1704 | ||
1708 | rate_table = (struct ath_rate_table *) | 1705 | rate_table = (struct ath_rate_table *) |
@@ -1824,7 +1821,8 @@ static void ath_setup_rates(struct ieee80211_local *local, struct sta_info *sta) | |||
1824 | struct ath_rate_node *rc_priv = sta->rate_ctrl_priv; | 1821 | struct ath_rate_node *rc_priv = sta->rate_ctrl_priv; |
1825 | int i, j = 0; | 1822 | int i, j = 0; |
1826 | 1823 | ||
1827 | DPRINTF(sc, ATH_DBG_RATE, "%s", __func__); | 1824 | DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__); |
1825 | |||
1828 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 1826 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
1829 | for (i = 0; i < sband->n_bitrates; i++) { | 1827 | for (i = 0; i < sband->n_bitrates; i++) { |
1830 | if (sta->supp_rates[local->hw.conf.channel->band] & BIT(i)) { | 1828 | if (sta->supp_rates[local->hw.conf.channel->band] & BIT(i)) { |
@@ -1962,7 +1960,7 @@ static void ath_get_rate(void *priv, struct net_device *dev, | |||
1962 | tx_info_priv->min_rate = (sband->bitrates[lowest_idx].bitrate * 2) / 10; | 1960 | tx_info_priv->min_rate = (sband->bitrates[lowest_idx].bitrate * 2) / 10; |
1963 | /* lowest rate for management and multicast/broadcast frames */ | 1961 | /* lowest rate for management and multicast/broadcast frames */ |
1964 | if (!ieee80211_is_data(fc) || | 1962 | if (!ieee80211_is_data(fc) || |
1965 | is_multicast_ether_addr(hdr->addr1) || !sta) { | 1963 | is_multicast_ether_addr(hdr->addr1) || !sta) { |
1966 | sel->rate_idx = lowest_idx; | 1964 | sel->rate_idx = lowest_idx; |
1967 | return; | 1965 | return; |
1968 | } | 1966 | } |
@@ -1978,7 +1976,7 @@ static void ath_get_rate(void *priv, struct net_device *dev, | |||
1978 | false); | 1976 | false); |
1979 | if (is_probe) | 1977 | if (is_probe) |
1980 | sel->probe_idx = ((struct ath_tx_ratectrl *) | 1978 | sel->probe_idx = ((struct ath_tx_ratectrl *) |
1981 | sta->rate_ctrl_priv)->probe_rate; | 1979 | sta->rate_ctrl_priv)->probe_rate; |
1982 | 1980 | ||
1983 | /* Ratecontrol sometimes returns invalid rate index */ | 1981 | /* Ratecontrol sometimes returns invalid rate index */ |
1984 | if (tx_info_priv->rcs[0].rix != 0xff) | 1982 | if (tx_info_priv->rcs[0].rix != 0xff) |
@@ -2035,6 +2033,7 @@ static void ath_rate_init(void *priv, void *priv_sta, | |||
2035 | struct ieee80211_hw *hw = local_to_hw(local); | 2033 | struct ieee80211_hw *hw = local_to_hw(local); |
2036 | struct ieee80211_conf *conf = &local->hw.conf; | 2034 | struct ieee80211_conf *conf = &local->hw.conf; |
2037 | struct ath_softc *sc = hw->priv; | 2035 | struct ath_softc *sc = hw->priv; |
2036 | struct ath_rate_node *ath_rc_priv = priv_sta; | ||
2038 | int i, j = 0; | 2037 | int i, j = 0; |
2039 | 2038 | ||
2040 | DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__); | 2039 | DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__); |
@@ -2046,12 +2045,11 @@ static void ath_rate_init(void *priv, void *priv_sta, | |||
2046 | if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) { | 2045 | if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) { |
2047 | for (i = 0; i < MCS_SET_SIZE; i++) { | 2046 | for (i = 0; i < MCS_SET_SIZE; i++) { |
2048 | if (conf->ht_conf.supp_mcs_set[i/8] & (1<<(i%8))) | 2047 | if (conf->ht_conf.supp_mcs_set[i/8] & (1<<(i%8))) |
2049 | ((struct ath_rate_node *) | 2048 | ath_rc_priv->neg_ht_rates.rs_rates[j++] = i; |
2050 | priv_sta)->neg_ht_rates.rs_rates[j++] = i; | ||
2051 | if (j == ATH_RATE_MAX) | 2049 | if (j == ATH_RATE_MAX) |
2052 | break; | 2050 | break; |
2053 | } | 2051 | } |
2054 | ((struct ath_rate_node *)priv_sta)->neg_ht_rates.rs_nrates = j; | 2052 | ath_rc_priv->neg_ht_rates.rs_nrates = j; |
2055 | } | 2053 | } |
2056 | ath_rc_node_update(hw, priv_sta); | 2054 | ath_rc_node_update(hw, priv_sta); |
2057 | } | 2055 | } |
@@ -2066,7 +2064,7 @@ static void *ath_rate_alloc(struct ieee80211_local *local) | |||
2066 | struct ieee80211_hw *hw = local_to_hw(local); | 2064 | struct ieee80211_hw *hw = local_to_hw(local); |
2067 | struct ath_softc *sc = hw->priv; | 2065 | struct ath_softc *sc = hw->priv; |
2068 | 2066 | ||
2069 | DPRINTF(sc, ATH_DBG_RATE, "%s", __func__); | 2067 | DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__); |
2070 | return local->hw.priv; | 2068 | return local->hw.priv; |
2071 | } | 2069 | } |
2072 | 2070 | ||
@@ -2081,14 +2079,17 @@ static void *ath_rate_alloc_sta(void *priv, gfp_t gfp) | |||
2081 | struct ath_vap *avp = sc->sc_vaps[0]; | 2079 | struct ath_vap *avp = sc->sc_vaps[0]; |
2082 | struct ath_rate_node *rate_priv; | 2080 | struct ath_rate_node *rate_priv; |
2083 | 2081 | ||
2084 | DPRINTF(sc, ATH_DBG_RATE, "%s", __func__); | 2082 | DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__); |
2083 | |||
2085 | rate_priv = ath_rate_node_alloc(avp, sc->sc_rc, gfp); | 2084 | rate_priv = ath_rate_node_alloc(avp, sc->sc_rc, gfp); |
2086 | if (!rate_priv) { | 2085 | if (!rate_priv) { |
2087 | DPRINTF(sc, ATH_DBG_FATAL, "%s:Unable to allocate" | 2086 | DPRINTF(sc, ATH_DBG_FATAL, |
2088 | "private rate control structure", __func__); | 2087 | "%s: Unable to allocate private rc structure\n", |
2088 | __func__); | ||
2089 | return NULL; | 2089 | return NULL; |
2090 | } | 2090 | } |
2091 | ath_rc_sib_init(rate_priv); | 2091 | ath_rc_sib_init(rate_priv); |
2092 | |||
2092 | return rate_priv; | 2093 | return rate_priv; |
2093 | } | 2094 | } |
2094 | 2095 | ||