提交 dc2222a8 编写于 作者: S Sujith 提交者: John W. Linville

ath9k: Random cleanup

Remove dead code, add newlines, fix indentation.
Signed-off-by: NSujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 927e70e9
...@@ -1025,7 +1025,6 @@ int ath_init(u16 devid, struct ath_softc *sc) ...@@ -1025,7 +1025,6 @@ int ath_init(u16 devid, struct ath_softc *sc)
int status; int status;
int error = 0, i; int error = 0, i;
int csz = 0; int csz = 0;
u32 rd;
/* XXX: hardware will not be ready until ath_open() being called */ /* XXX: hardware will not be ready until ath_open() being called */
sc->sc_flags |= SC_OP_INVALID; sc->sc_flags |= SC_OP_INVALID;
...@@ -1091,8 +1090,6 @@ int ath_init(u16 devid, struct ath_softc *sc) ...@@ -1091,8 +1090,6 @@ int ath_init(u16 devid, struct ath_softc *sc)
* is resposible for filtering this list based on settings * is resposible for filtering this list based on settings
* like the phy mode. * like the phy mode.
*/ */
rd = ah->ah_currentRD;
error = ath_setup_channels(sc); error = ath_setup_channels(sc);
if (error) if (error)
goto bad; goto bad;
...@@ -1169,7 +1166,7 @@ int ath_init(u16 devid, struct ath_softc *sc) ...@@ -1169,7 +1166,7 @@ int ath_init(u16 devid, struct ath_softc *sc)
sc->sc_rc = ath_rate_attach(ah); sc->sc_rc = ath_rate_attach(ah);
if (sc->sc_rc == NULL) { if (sc->sc_rc == NULL) {
error = EIO; error = -EIO;
goto bad2; goto bad2;
} }
......
...@@ -7654,8 +7654,7 @@ bool ath9k_hw_resettxqueue(struct ath_hal *ah, u32 q) ...@@ -7654,8 +7654,7 @@ bool ath9k_hw_resettxqueue(struct ath_hal *ah, u32 q)
REG_WRITE(ah, AR_DRETRY_LIMIT(q), REG_WRITE(ah, AR_DRETRY_LIMIT(q),
SM(INIT_SSH_RETRY, AR_D_RETRY_LIMIT_STA_SH) SM(INIT_SSH_RETRY, AR_D_RETRY_LIMIT_STA_SH)
| SM(INIT_SLG_RETRY, AR_D_RETRY_LIMIT_STA_LG) | SM(INIT_SLG_RETRY, AR_D_RETRY_LIMIT_STA_LG)
| SM(qi->tqi_shretry, AR_D_RETRY_LIMIT_FR_SH) | SM(qi->tqi_shretry, AR_D_RETRY_LIMIT_FR_SH));
);
REG_WRITE(ah, AR_QMISC(q), AR_Q_MISC_DCU_EARLY_TERM_REQ); REG_WRITE(ah, AR_QMISC(q), AR_Q_MISC_DCU_EARLY_TERM_REQ);
REG_WRITE(ah, AR_DMISC(q), REG_WRITE(ah, AR_DMISC(q),
...@@ -8300,15 +8299,7 @@ struct ath_hal *ath9k_hw_attach(u16 devid, ...@@ -8300,15 +8299,7 @@ struct ath_hal *ath9k_hw_attach(u16 devid,
*error = -ENXIO; *error = -ENXIO;
break; break;
} }
if (ah != NULL) {
ah->ah_devid = ah->ah_devid;
ah->ah_subvendorid = ah->ah_subvendorid;
ah->ah_macVersion = ah->ah_macVersion;
ah->ah_macRev = ah->ah_macRev;
ah->ah_phyRev = ah->ah_phyRev;
ah->ah_analog5GhzRev = ah->ah_analog5GhzRev;
ah->ah_analog2GhzRev = ah->ah_analog2GhzRev;
}
return ah; return ah;
} }
......
...@@ -653,8 +653,8 @@ ath_rc_sib_init_validrates(struct ath_rate_node *ath_rc_priv, ...@@ -653,8 +653,8 @@ ath_rc_sib_init_validrates(struct ath_rate_node *ath_rc_priv,
rate_ctrl = (struct ath_tx_ratectrl *)(ath_rc_priv); rate_ctrl = (struct ath_tx_ratectrl *)(ath_rc_priv);
for (i = 0; i < rate_table->rate_cnt; i++) { for (i = 0; i < rate_table->rate_cnt; i++) {
valid = (ath_rc_priv->single_stream ? valid = (ath_rc_priv->single_stream ?
rate_table->info[i].valid_single_stream : rate_table->info[i].valid_single_stream :
rate_table->info[i].valid); rate_table->info[i].valid);
if (valid == TRUE) { if (valid == TRUE) {
u32 phy = rate_table->info[i].phy; u32 phy = rate_table->info[i].phy;
u8 valid_rate_count = 0; u8 valid_rate_count = 0;
...@@ -740,14 +740,14 @@ ath_rc_sib_setvalid_htrates(struct ath_rate_node *ath_rc_priv, ...@@ -740,14 +740,14 @@ ath_rc_sib_setvalid_htrates(struct ath_rate_node *ath_rc_priv,
for (j = 0; j < rate_table->rate_cnt; j++) { for (j = 0; j < rate_table->rate_cnt; j++) {
u32 phy = rate_table->info[j].phy; u32 phy = rate_table->info[j].phy;
u32 valid = (ath_rc_priv->single_stream ? u32 valid = (ath_rc_priv->single_stream ?
rate_table->info[j].valid_single_stream : rate_table->info[j].valid_single_stream :
rate_table->info[j].valid); rate_table->info[j].valid);
if (((((struct ath_rateset *) if (((((struct ath_rateset *)
mcs_set)->rs_rates[i] & 0x7F) != mcs_set)->rs_rates[i] & 0x7F) !=
(rate_table->info[j].dot11rate & 0x7F)) || (rate_table->info[j].dot11rate & 0x7F)) ||
!WLAN_RC_PHY_HT(phy) || !WLAN_RC_PHY_HT(phy) ||
!WLAN_RC_PHY_HT_VALID(valid, capflag)) !WLAN_RC_PHY_HT_VALID(valid, capflag))
continue; continue;
if (!ath_rc_valid_phyrate(phy, capflag, FALSE)) 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,10 +866,10 @@ void ath_rate_newstate(struct ath_softc *sc, struct ath_vap *avp)
} }
static u8 ath_rc_ratefind_ht(struct ath_softc *sc, static u8 ath_rc_ratefind_ht(struct ath_softc *sc,
struct ath_rate_node *ath_rc_priv, struct ath_rate_node *ath_rc_priv,
const struct ath_rate_table *rate_table, const struct ath_rate_table *rate_table,
int probe_allowed, int *is_probing, int probe_allowed, int *is_probing,
int is_retry) int is_retry)
{ {
u32 dt, best_thruput, this_thruput, now_msec; u32 dt, best_thruput, this_thruput, now_msec;
u8 rate, next_rate, best_rate, maxindex, minindex; u8 rate, next_rate, best_rate, maxindex, minindex;
...@@ -997,8 +997,8 @@ static u8 ath_rc_ratefind_ht(struct ath_softc *sc, ...@@ -997,8 +997,8 @@ static u8 ath_rc_ratefind_ht(struct ath_softc *sc,
rate = rate_ctrl->rate_table_size - 1; rate = rate_ctrl->rate_table_size - 1;
ASSERT((rate_table->info[rate].valid && !ath_rc_priv->single_stream) || ASSERT((rate_table->info[rate].valid && !ath_rc_priv->single_stream) ||
(rate_table->info[rate].valid_single_stream && (rate_table->info[rate].valid_single_stream &&
ath_rc_priv->single_stream)); ath_rc_priv->single_stream));
return rate; return rate;
} }
...@@ -1023,10 +1023,10 @@ static void ath_rc_rate_set_series(const struct ath_rate_table *rate_table , ...@@ -1023,10 +1023,10 @@ static void ath_rc_rate_set_series(const struct ath_rate_table *rate_table ,
} }
static u8 ath_rc_rate_getidx(struct ath_softc *sc, static u8 ath_rc_rate_getidx(struct ath_softc *sc,
struct ath_rate_node *ath_rc_priv, struct ath_rate_node *ath_rc_priv,
const struct ath_rate_table *rate_table, const struct ath_rate_table *rate_table,
u8 rix, u16 stepdown, u8 rix, u16 stepdown,
u16 min_rate) u16 min_rate)
{ {
u32 j; u32 j;
u8 nextindex; u8 nextindex;
...@@ -1066,8 +1066,8 @@ static void ath_rc_ratefind(struct ath_softc *sc, ...@@ -1066,8 +1066,8 @@ static void ath_rc_ratefind(struct ath_softc *sc,
rate_table = rate_table =
(struct ath_rate_table *)asc->hw_rate_table[sc->sc_curmode]; (struct ath_rate_table *)asc->hw_rate_table[sc->sc_curmode];
rix = ath_rc_ratefind_ht(sc, ath_rc_priv, rate_table, rix = ath_rc_ratefind_ht(sc, ath_rc_priv, rate_table,
(rcflag & ATH_RC_PROBE_ALLOWED) ? 1 : 0, (rcflag & ATH_RC_PROBE_ALLOWED) ? 1 : 0,
is_probe, is_retry); is_probe, is_retry);
nrix = rix; nrix = rix;
if ((rcflag & ATH_RC_PROBE_ALLOWED) && (*is_probe)) { if ((rcflag & ATH_RC_PROBE_ALLOWED) && (*is_probe)) {
...@@ -1099,13 +1099,13 @@ static void ath_rc_ratefind(struct ath_softc *sc, ...@@ -1099,13 +1099,13 @@ static void ath_rc_ratefind(struct ath_softc *sc,
try_num = ((i + 1) == num_rates) ? try_num = ((i + 1) == num_rates) ?
num_tries - (try_per_rate * i) : try_per_rate ; num_tries - (try_per_rate * i) : try_per_rate ;
min_rate = (((i + 1) == num_rates) && min_rate = (((i + 1) == num_rates) &&
(rcflag & ATH_RC_MINRATE_LASTRATE)) ? 1 : 0; (rcflag & ATH_RC_MINRATE_LASTRATE)) ? 1 : 0;
nrix = ath_rc_rate_getidx(sc, ath_rc_priv, nrix = ath_rc_rate_getidx(sc, ath_rc_priv,
rate_table, nrix, 1, min_rate); rate_table, nrix, 1, min_rate);
/* All other rates in the series have RTS enabled */ /* All other rates in the series have RTS enabled */
ath_rc_rate_set_series(rate_table, ath_rc_rate_set_series(rate_table,
&series[i], try_num, nrix, TRUE); &series[i], try_num, nrix, TRUE);
} }
/* /*
...@@ -1124,13 +1124,13 @@ static void ath_rc_ratefind(struct ath_softc *sc, ...@@ -1124,13 +1124,13 @@ static void ath_rc_ratefind(struct ath_softc *sc,
* above conditions. * above conditions.
*/ */
if ((sc->sc_curmode == ATH9K_MODE_11NG_HT20) || if ((sc->sc_curmode == ATH9K_MODE_11NG_HT20) ||
(sc->sc_curmode == ATH9K_MODE_11NG_HT40PLUS) || (sc->sc_curmode == ATH9K_MODE_11NG_HT40PLUS) ||
(sc->sc_curmode == ATH9K_MODE_11NG_HT40MINUS)) { (sc->sc_curmode == ATH9K_MODE_11NG_HT40MINUS)) {
u8 dot11rate = rate_table->info[rix].dot11rate; u8 dot11rate = rate_table->info[rix].dot11rate;
u8 phy = rate_table->info[rix].phy; u8 phy = rate_table->info[rix].phy;
if (i == 4 && if (i == 4 &&
((dot11rate == 2 && phy == WLAN_RC_PHY_HT_40_SS) || ((dot11rate == 2 && phy == WLAN_RC_PHY_HT_40_SS) ||
(dot11rate == 3 && phy == WLAN_RC_PHY_HT_20_SS))) { (dot11rate == 3 && phy == WLAN_RC_PHY_HT_20_SS))) {
series[3].rix = series[2].rix; series[3].rix = series[2].rix;
series[3].flags = series[2].flags; series[3].flags = series[2].flags;
series[3].max_4ms_framelen = series[2].max_4ms_framelen; series[3].max_4ms_framelen = series[2].max_4ms_framelen;
...@@ -1152,7 +1152,8 @@ void ath_rate_findrate(struct ath_softc *sc, ...@@ -1152,7 +1152,8 @@ void ath_rate_findrate(struct ath_softc *sc,
{ {
struct ath_vap *avp = ath_rc_priv->avp; struct ath_vap *avp = ath_rc_priv->avp;
DPRINTF(sc, ATH_DBG_RATE, "%s", __func__); DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__);
if (!num_rates || !num_tries) if (!num_rates || !num_tries)
return; return;
...@@ -1174,9 +1175,8 @@ void ath_rate_findrate(struct ath_softc *sc, ...@@ -1174,9 +1175,8 @@ void ath_rate_findrate(struct ath_softc *sc,
unsigned int mcs; unsigned int mcs;
u8 series_rix = 0; u8 series_rix = 0;
series[idx].tries = series[idx].tries = IEEE80211_RATE_IDX_ENTRY(
IEEE80211_RATE_IDX_ENTRY( avp->av_config.av_fixed_retryset, idx);
avp->av_config.av_fixed_retryset, idx);
mcs = IEEE80211_RATE_IDX_ENTRY( mcs = IEEE80211_RATE_IDX_ENTRY(
avp->av_config.av_fixed_rateset, idx); avp->av_config.av_fixed_rateset, idx);
...@@ -1228,7 +1228,7 @@ static void ath_rc_update_ht(struct ath_softc *sc, ...@@ -1228,7 +1228,7 @@ static void ath_rc_update_ht(struct ath_softc *sc,
u32 now_msec = jiffies_to_msecs(jiffies); u32 now_msec = jiffies_to_msecs(jiffies);
int state_change = FALSE, rate, count; int state_change = FALSE, rate, count;
u8 last_per; u8 last_per;
struct ath_rate_softc *asc = (struct ath_rate_softc *)sc->sc_rc; struct ath_rate_softc *asc = (struct ath_rate_softc *)sc->sc_rc;
struct ath_rate_table *rate_table = struct ath_rate_table *rate_table =
(struct ath_rate_table *)asc->hw_rate_table[sc->sc_curmode]; (struct ath_rate_table *)asc->hw_rate_table[sc->sc_curmode];
...@@ -1272,14 +1272,14 @@ static void ath_rc_update_ht(struct ath_softc *sc, ...@@ -1272,14 +1272,14 @@ static void ath_rc_update_ht(struct ath_softc *sc,
} else { } else {
/* xretries == 2 */ /* xretries == 2 */
count = sizeof(nretry_to_per_lookup) / count = sizeof(nretry_to_per_lookup) /
sizeof(nretry_to_per_lookup[0]); sizeof(nretry_to_per_lookup[0]);
if (retries >= count) if (retries >= count)
retries = count - 1; retries = count - 1;
/* new_PER = 7/8*old_PER + 1/8*(currentPER) */ /* new_PER = 7/8*old_PER + 1/8*(currentPER) */
rate_ctrl->state[tx_rate].per = rate_ctrl->state[tx_rate].per =
(u8)(rate_ctrl->state[tx_rate].per - (u8)(rate_ctrl->state[tx_rate].per -
(rate_ctrl->state[tx_rate].per >> 3) + (rate_ctrl->state[tx_rate].per >> 3) +
((100) >> 3)); ((100) >> 3));
} }
/* xretries == 1 or 2 */ /* xretries == 1 or 2 */
...@@ -1295,8 +1295,7 @@ static void ath_rc_update_ht(struct ath_softc *sc, ...@@ -1295,8 +1295,7 @@ static void ath_rc_update_ht(struct ath_softc *sc,
if (retries >= count) if (retries >= count)
retries = count - 1; retries = count - 1;
if (info_priv->n_bad_frames) { if (info_priv->n_bad_frames) {
/* new_PER = 7/8*old_PER + 1/8*(currentPER) */ /* new_PER = 7/8*old_PER + 1/8*(currentPER)
/*
* Assuming that n_frames is not 0. The current PER * Assuming that n_frames is not 0. The current PER
* from the retries is 100 * retries / (retries+1), * from the retries is 100 * retries / (retries+1),
* since the first retries attempts failed, and the * since the first retries attempts failed, and the
...@@ -1386,7 +1385,7 @@ static void ath_rc_update_ht(struct ath_softc *sc, ...@@ -1386,7 +1385,7 @@ static void ath_rc_update_ht(struct ath_softc *sc,
* rssi_ack values. * rssi_ack values.
*/ */
if (tx_rate == rate_ctrl->rate_max_phy && if (tx_rate == rate_ctrl->rate_max_phy &&
rate_ctrl->hw_maxretry_pktcnt < 255) { rate_ctrl->hw_maxretry_pktcnt < 255) {
rate_ctrl->hw_maxretry_pktcnt++; rate_ctrl->hw_maxretry_pktcnt++;
} }
...@@ -1418,7 +1417,7 @@ static void ath_rc_update_ht(struct ath_softc *sc, ...@@ -1418,7 +1417,7 @@ static void ath_rc_update_ht(struct ath_softc *sc,
/* Now reduce the current /* Now reduce the current
* rssi threshold. */ * rssi threshold. */
if ((rssi_ackAvg < rssi_thres + 2) && if ((rssi_ackAvg < rssi_thres + 2) &&
(rssi_thres > rssi_ack_vmin)) { (rssi_thres > rssi_ack_vmin)) {
rate_ctrl->state[tx_rate]. rate_ctrl->state[tx_rate].
rssi_thres--; rssi_thres--;
} }
...@@ -1436,10 +1435,10 @@ static void ath_rc_update_ht(struct ath_softc *sc, ...@@ -1436,10 +1435,10 @@ static void ath_rc_update_ht(struct ath_softc *sc,
* a while (except if we are probing). * a while (except if we are probing).
*/ */
if (rate_ctrl->state[tx_rate].per >= 55 && tx_rate > 0 && if (rate_ctrl->state[tx_rate].per >= 55 && tx_rate > 0 &&
rate_table->info[tx_rate].ratekbps <= rate_table->info[tx_rate].ratekbps <=
rate_table->info[rate_ctrl->rate_max_phy].ratekbps) { rate_table->info[rate_ctrl->rate_max_phy].ratekbps) {
ath_rc_get_nextlowervalid_txrate(rate_table, rate_ctrl, ath_rc_get_nextlowervalid_txrate(rate_table, rate_ctrl,
(u8) tx_rate, &rate_ctrl->rate_max_phy); (u8) tx_rate, &rate_ctrl->rate_max_phy);
/* Don't probe for a little while. */ /* Don't probe for a little while. */
rate_ctrl->probe_time = now_msec; rate_ctrl->probe_time = now_msec;
...@@ -1460,43 +1459,43 @@ static void ath_rc_update_ht(struct ath_softc *sc, ...@@ -1460,43 +1459,43 @@ static void ath_rc_update_ht(struct ath_softc *sc,
break; break;
if (rate_ctrl->state[rate].rssi_thres + if (rate_ctrl->state[rate].rssi_thres +
rate_table->info[rate].rssi_ack_deltamin > rate_table->info[rate].rssi_ack_deltamin >
rate_ctrl->state[rate+1].rssi_thres) { rate_ctrl->state[rate+1].rssi_thres) {
rate_ctrl->state[rate+1].rssi_thres = rate_ctrl->state[rate+1].rssi_thres =
rate_ctrl->state[rate]. rate_ctrl->state[rate].
rssi_thres + rssi_thres +
rate_table->info[rate]. rate_table->info[rate].
rssi_ack_deltamin; rssi_ack_deltamin;
} }
} }
/* Make sure the rates below this have lower rssi thresholds. */ /* Make sure the rates below this have lower rssi thresholds. */
for (rate = tx_rate - 1; rate >= 0; rate--) { for (rate = tx_rate - 1; rate >= 0; rate--) {
if (rate_table->info[rate].phy != if (rate_table->info[rate].phy !=
rate_table->info[tx_rate].phy) rate_table->info[tx_rate].phy)
break; break;
if (rate_ctrl->state[rate].rssi_thres + if (rate_ctrl->state[rate].rssi_thres +
rate_table->info[rate].rssi_ack_deltamin > rate_table->info[rate].rssi_ack_deltamin >
rate_ctrl->state[rate+1].rssi_thres) { rate_ctrl->state[rate+1].rssi_thres) {
if (rate_ctrl->state[rate+1].rssi_thres < if (rate_ctrl->state[rate+1].rssi_thres <
rate_table->info[rate]. rate_table->info[rate].
rssi_ack_deltamin) rssi_ack_deltamin)
rate_ctrl->state[rate].rssi_thres = 0; rate_ctrl->state[rate].rssi_thres = 0;
else { else {
rate_ctrl->state[rate].rssi_thres = rate_ctrl->state[rate].rssi_thres =
rate_ctrl->state[rate+1]. rate_ctrl->state[rate+1].
rssi_thres - rssi_thres -
rate_table->info[rate]. rate_table->info[rate].
rssi_ack_deltamin; rssi_ack_deltamin;
} }
if (rate_ctrl->state[rate].rssi_thres < if (rate_ctrl->state[rate].rssi_thres <
rate_table->info[rate]. rate_table->info[rate].
rssi_ack_validmin) { rssi_ack_validmin) {
rate_ctrl->state[rate].rssi_thres = rate_ctrl->state[rate].rssi_thres =
rate_table->info[rate]. rate_table->info[rate].
rssi_ack_validmin; rssi_ack_validmin;
} }
} }
} }
...@@ -1507,11 +1506,11 @@ static void ath_rc_update_ht(struct ath_softc *sc, ...@@ -1507,11 +1506,11 @@ static void ath_rc_update_ht(struct ath_softc *sc,
if (rate_ctrl->state[tx_rate].per < last_per) { if (rate_ctrl->state[tx_rate].per < last_per) {
for (rate = tx_rate - 1; rate >= 0; rate--) { for (rate = tx_rate - 1; rate >= 0; rate--) {
if (rate_table->info[rate].phy != if (rate_table->info[rate].phy !=
rate_table->info[tx_rate].phy) rate_table->info[tx_rate].phy)
break; break;
if (rate_ctrl->state[rate].per > if (rate_ctrl->state[rate].per >
rate_ctrl->state[rate+1].per) { rate_ctrl->state[rate+1].per) {
rate_ctrl->state[rate].per = rate_ctrl->state[rate].per =
rate_ctrl->state[rate+1].per; rate_ctrl->state[rate+1].per;
} }
...@@ -1528,11 +1527,11 @@ static void ath_rc_update_ht(struct ath_softc *sc, ...@@ -1528,11 +1527,11 @@ static void ath_rc_update_ht(struct ath_softc *sc,
/* Every so often, we reduce the thresholds and /* Every so often, we reduce the thresholds and
* PER (different for CCK and OFDM). */ * PER (different for CCK and OFDM). */
if (now_msec - rate_ctrl->rssi_down_time >= if (now_msec - rate_ctrl->rssi_down_time >=
rate_table->rssi_reduce_interval) { rate_table->rssi_reduce_interval) {
for (rate = 0; rate < rate_ctrl->rate_table_size; rate++) { for (rate = 0; rate < rate_ctrl->rate_table_size; rate++) {
if (rate_ctrl->state[rate].rssi_thres > if (rate_ctrl->state[rate].rssi_thres >
rate_table->info[rate].rssi_ack_validmin) rate_table->info[rate].rssi_ack_validmin)
rate_ctrl->state[rate].rssi_thres -= 1; rate_ctrl->state[rate].rssi_thres -= 1;
} }
rate_ctrl->rssi_down_time = now_msec; rate_ctrl->rssi_down_time = now_msec;
...@@ -1541,7 +1540,7 @@ static void ath_rc_update_ht(struct ath_softc *sc, ...@@ -1541,7 +1540,7 @@ static void ath_rc_update_ht(struct ath_softc *sc,
/* Every so often, we reduce the thresholds /* Every so often, we reduce the thresholds
* and PER (different for CCK and OFDM). */ * and PER (different for CCK and OFDM). */
if (now_msec - rate_ctrl->per_down_time >= if (now_msec - rate_ctrl->per_down_time >=
rate_table->rssi_reduce_interval) { rate_table->rssi_reduce_interval) {
for (rate = 0; rate < rate_ctrl->rate_table_size; rate++) { for (rate = 0; rate < rate_ctrl->rate_table_size; rate++) {
rate_ctrl->state[rate].per = rate_ctrl->state[rate].per =
7 * rate_ctrl->state[rate].per / 8; 7 * rate_ctrl->state[rate].per / 8;
...@@ -1560,7 +1559,7 @@ static void ath_rc_update(struct ath_softc *sc, ...@@ -1560,7 +1559,7 @@ static void ath_rc_update(struct ath_softc *sc,
struct ath_tx_info_priv *info_priv, int final_ts_idx, struct ath_tx_info_priv *info_priv, int final_ts_idx,
int xretries, int long_retry) int xretries, int long_retry)
{ {
struct ath_rate_softc *asc = (struct ath_rate_softc *)sc->sc_rc; struct ath_rate_softc *asc = (struct ath_rate_softc *)sc->sc_rc;
struct ath_rate_table *rate_table; struct ath_rate_table *rate_table;
struct ath_tx_ratectrl *rate_ctrl; struct ath_tx_ratectrl *rate_ctrl;
struct ath_rc_series rcs[4]; struct ath_rc_series rcs[4];
...@@ -1637,7 +1636,6 @@ static void ath_rc_update(struct ath_softc *sc, ...@@ -1637,7 +1636,6 @@ static void ath_rc_update(struct ath_softc *sc,
xretries, long_retry); xretries, long_retry);
} }
/* /*
* Process a tx descriptor for a completed transmit (success or failure). * Process a tx descriptor for a completed transmit (success or failure).
*/ */
...@@ -1651,13 +1649,13 @@ static void ath_rate_tx_complete(struct ath_softc *sc, ...@@ -1651,13 +1649,13 @@ static void ath_rate_tx_complete(struct ath_softc *sc,
struct ath_vap *avp; struct ath_vap *avp;
avp = rc_priv->avp; avp = rc_priv->avp;
if ((avp->av_config.av_fixed_rateset != IEEE80211_FIXED_RATE_NONE) if ((avp->av_config.av_fixed_rateset != IEEE80211_FIXED_RATE_NONE) ||
|| info_priv->tx.ts_status & ATH9K_TXERR_FILT) (info_priv->tx.ts_status & ATH9K_TXERR_FILT))
return; return;
if (info_priv->tx.ts_rssi > 0) { if (info_priv->tx.ts_rssi > 0) {
ATH_RSSI_LPF(an->an_chainmask_sel.tx_avgrssi, ATH_RSSI_LPF(an->an_chainmask_sel.tx_avgrssi,
info_priv->tx.ts_rssi); info_priv->tx.ts_rssi);
} }
/* /*
...@@ -1682,7 +1680,6 @@ static void ath_rate_tx_complete(struct ath_softc *sc, ...@@ -1682,7 +1680,6 @@ static void ath_rate_tx_complete(struct ath_softc *sc,
info_priv->tx.ts_longretry); info_priv->tx.ts_longretry);
} }
/* /*
* Update the SIB's rate control information * Update the SIB's rate control information
* *
...@@ -1701,8 +1698,8 @@ static void ath_rc_sib_update(struct ath_softc *sc, ...@@ -1701,8 +1698,8 @@ static void ath_rc_sib_update(struct ath_softc *sc,
struct ath_rate_softc *asc = (struct ath_rate_softc *)sc->sc_rc; struct ath_rate_softc *asc = (struct ath_rate_softc *)sc->sc_rc;
struct ath_rateset *rateset = negotiated_rates; struct ath_rateset *rateset = negotiated_rates;
u8 *ht_mcs = (u8 *)negotiated_htrates; u8 *ht_mcs = (u8 *)negotiated_htrates;
struct ath_tx_ratectrl *rate_ctrl = (struct ath_tx_ratectrl *) struct ath_tx_ratectrl *rate_ctrl =
(ath_rc_priv); (struct ath_tx_ratectrl *)ath_rc_priv;
u8 i, j, k, hi = 0, hthi = 0; u8 i, j, k, hi = 0, hthi = 0;
rate_table = (struct ath_rate_table *) rate_table = (struct ath_rate_table *)
...@@ -1824,7 +1821,8 @@ static void ath_setup_rates(struct ieee80211_local *local, struct sta_info *sta) ...@@ -1824,7 +1821,8 @@ static void ath_setup_rates(struct ieee80211_local *local, struct sta_info *sta)
struct ath_rate_node *rc_priv = sta->rate_ctrl_priv; struct ath_rate_node *rc_priv = sta->rate_ctrl_priv;
int i, j = 0; int i, j = 0;
DPRINTF(sc, ATH_DBG_RATE, "%s", __func__); DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__);
sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
for (i = 0; i < sband->n_bitrates; i++) { for (i = 0; i < sband->n_bitrates; i++) {
if (sta->supp_rates[local->hw.conf.channel->band] & BIT(i)) { 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,7 +1960,7 @@ static void ath_get_rate(void *priv, struct net_device *dev,
tx_info_priv->min_rate = (sband->bitrates[lowest_idx].bitrate * 2) / 10; tx_info_priv->min_rate = (sband->bitrates[lowest_idx].bitrate * 2) / 10;
/* lowest rate for management and multicast/broadcast frames */ /* lowest rate for management and multicast/broadcast frames */
if (!ieee80211_is_data(fc) || if (!ieee80211_is_data(fc) ||
is_multicast_ether_addr(hdr->addr1) || !sta) { is_multicast_ether_addr(hdr->addr1) || !sta) {
sel->rate_idx = lowest_idx; sel->rate_idx = lowest_idx;
return; return;
} }
...@@ -1978,7 +1976,7 @@ static void ath_get_rate(void *priv, struct net_device *dev, ...@@ -1978,7 +1976,7 @@ static void ath_get_rate(void *priv, struct net_device *dev,
false); false);
if (is_probe) if (is_probe)
sel->probe_idx = ((struct ath_tx_ratectrl *) sel->probe_idx = ((struct ath_tx_ratectrl *)
sta->rate_ctrl_priv)->probe_rate; sta->rate_ctrl_priv)->probe_rate;
/* Ratecontrol sometimes returns invalid rate index */ /* Ratecontrol sometimes returns invalid rate index */
if (tx_info_priv->rcs[0].rix != 0xff) if (tx_info_priv->rcs[0].rix != 0xff)
...@@ -2035,6 +2033,7 @@ static void ath_rate_init(void *priv, void *priv_sta, ...@@ -2035,6 +2033,7 @@ static void ath_rate_init(void *priv, void *priv_sta,
struct ieee80211_hw *hw = local_to_hw(local); struct ieee80211_hw *hw = local_to_hw(local);
struct ieee80211_conf *conf = &local->hw.conf; struct ieee80211_conf *conf = &local->hw.conf;
struct ath_softc *sc = hw->priv; struct ath_softc *sc = hw->priv;
struct ath_rate_node *ath_rc_priv = priv_sta;
int i, j = 0; int i, j = 0;
DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__); DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__);
...@@ -2046,12 +2045,11 @@ static void ath_rate_init(void *priv, void *priv_sta, ...@@ -2046,12 +2045,11 @@ static void ath_rate_init(void *priv, void *priv_sta,
if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) { if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) {
for (i = 0; i < MCS_SET_SIZE; i++) { for (i = 0; i < MCS_SET_SIZE; i++) {
if (conf->ht_conf.supp_mcs_set[i/8] & (1<<(i%8))) if (conf->ht_conf.supp_mcs_set[i/8] & (1<<(i%8)))
((struct ath_rate_node *) ath_rc_priv->neg_ht_rates.rs_rates[j++] = i;
priv_sta)->neg_ht_rates.rs_rates[j++] = i;
if (j == ATH_RATE_MAX) if (j == ATH_RATE_MAX)
break; break;
} }
((struct ath_rate_node *)priv_sta)->neg_ht_rates.rs_nrates = j; ath_rc_priv->neg_ht_rates.rs_nrates = j;
} }
ath_rc_node_update(hw, priv_sta); ath_rc_node_update(hw, priv_sta);
} }
...@@ -2066,7 +2064,7 @@ static void *ath_rate_alloc(struct ieee80211_local *local) ...@@ -2066,7 +2064,7 @@ static void *ath_rate_alloc(struct ieee80211_local *local)
struct ieee80211_hw *hw = local_to_hw(local); struct ieee80211_hw *hw = local_to_hw(local);
struct ath_softc *sc = hw->priv; struct ath_softc *sc = hw->priv;
DPRINTF(sc, ATH_DBG_RATE, "%s", __func__); DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__);
return local->hw.priv; return local->hw.priv;
} }
...@@ -2081,14 +2079,17 @@ static void *ath_rate_alloc_sta(void *priv, gfp_t gfp) ...@@ -2081,14 +2079,17 @@ static void *ath_rate_alloc_sta(void *priv, gfp_t gfp)
struct ath_vap *avp = sc->sc_vaps[0]; struct ath_vap *avp = sc->sc_vaps[0];
struct ath_rate_node *rate_priv; struct ath_rate_node *rate_priv;
DPRINTF(sc, ATH_DBG_RATE, "%s", __func__); DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__);
rate_priv = ath_rate_node_alloc(avp, sc->sc_rc, gfp); rate_priv = ath_rate_node_alloc(avp, sc->sc_rc, gfp);
if (!rate_priv) { if (!rate_priv) {
DPRINTF(sc, ATH_DBG_FATAL, "%s:Unable to allocate" DPRINTF(sc, ATH_DBG_FATAL,
"private rate control structure", __func__); "%s: Unable to allocate private rc structure\n",
__func__);
return NULL; return NULL;
} }
ath_rc_sib_init(rate_priv); ath_rc_sib_init(rate_priv);
return rate_priv; return rate_priv;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册