diff options
| author | Sujith Manoharan <c_manoha@qca.qualcomm.com> | 2012-08-10 07:16:24 -0400 |
|---|---|---|
| committer | John W. Linville <linville@tuxdriver.com> | 2012-08-10 15:27:10 -0400 |
| commit | fc8d023834f6462e1675a28a15da251b3cb28b9a (patch) | |
| tree | a973461a45d6a771bfb5b906889ffa0120dbf0da | |
| parent | dacde3570865202fedcfa7c642d6c2ffde0dd0af (diff) | |
ath9k: Cleanup index retrieval routines
Trim API and remove unused variables.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
| -rw-r--r-- | drivers/net/wireless/ath/ath9k/rc.c | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c index 69745ad6e171..2e517c0edccd 100644 --- a/drivers/net/wireless/ath/ath9k/rc.c +++ b/drivers/net/wireless/ath/ath9k/rc.c | |||
| @@ -471,8 +471,7 @@ static int ath_rc_valid_phyrate(u32 phy, u32 capflag, int ignore_cw) | |||
| 471 | } | 471 | } |
| 472 | 472 | ||
| 473 | static inline int | 473 | static inline int |
| 474 | ath_rc_get_lower_rix(const struct ath_rate_table *rate_table, | 474 | ath_rc_get_lower_rix(struct ath_rate_priv *ath_rc_priv, |
| 475 | struct ath_rate_priv *ath_rc_priv, | ||
| 476 | u8 cur_valid_txrate, u8 *next_idx) | 475 | u8 cur_valid_txrate, u8 *next_idx) |
| 477 | { | 476 | { |
| 478 | int8_t i; | 477 | int8_t i; |
| @@ -582,13 +581,11 @@ static u8 ath_rc_setvalid_htrates(struct ath_rate_priv *ath_rc_priv) | |||
| 582 | return hi; | 581 | return hi; |
| 583 | } | 582 | } |
| 584 | 583 | ||
| 585 | /* Finds the highest rate index we can use */ | 584 | static u8 ath_rc_get_highest_rix(struct ath_rate_priv *ath_rc_priv, |
| 586 | static u8 ath_rc_get_highest_rix(struct ath_softc *sc, | ||
| 587 | struct ath_rate_priv *ath_rc_priv, | ||
| 588 | const struct ath_rate_table *rate_table, | ||
| 589 | int *is_probing, | 585 | int *is_probing, |
| 590 | bool legacy) | 586 | bool legacy) |
| 591 | { | 587 | { |
| 588 | const struct ath_rate_table *rate_table = ath_rc_priv->rate_table; | ||
| 592 | u32 best_thruput, this_thruput, now_msec; | 589 | u32 best_thruput, this_thruput, now_msec; |
| 593 | u8 rate, next_rate, best_rate, maxindex, minindex; | 590 | u8 rate, next_rate, best_rate, maxindex, minindex; |
| 594 | int8_t index = 0; | 591 | int8_t index = 0; |
| @@ -773,14 +770,8 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, | |||
| 773 | try_per_rate = 4; | 770 | try_per_rate = 4; |
| 774 | 771 | ||
| 775 | rate_table = ath_rc_priv->rate_table; | 772 | rate_table = ath_rc_priv->rate_table; |
| 776 | rix = ath_rc_get_highest_rix(sc, ath_rc_priv, rate_table, | 773 | rix = ath_rc_get_highest_rix(ath_rc_priv, &is_probe, false); |
| 777 | &is_probe, false); | ||
| 778 | 774 | ||
| 779 | /* | ||
| 780 | * If we're in HT mode and both us and our peer supports LDPC. | ||
| 781 | * We don't need to check our own device's capabilities as our own | ||
| 782 | * ht capabilities would have already been intersected with our peer's. | ||
| 783 | */ | ||
| 784 | if (conf_is_ht(&sc->hw->conf) && | 775 | if (conf_is_ht(&sc->hw->conf) && |
| 785 | (sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING)) | 776 | (sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING)) |
| 786 | tx_info->flags |= IEEE80211_TX_CTL_LDPC; | 777 | tx_info->flags |= IEEE80211_TX_CTL_LDPC; |
| @@ -790,35 +781,42 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, | |||
| 790 | tx_info->flags |= (1 << IEEE80211_TX_CTL_STBC_SHIFT); | 781 | tx_info->flags |= (1 << IEEE80211_TX_CTL_STBC_SHIFT); |
| 791 | 782 | ||
| 792 | if (is_probe) { | 783 | if (is_probe) { |
| 793 | /* set one try for probe rates. For the | 784 | /* |
| 794 | * probes don't enable rts */ | 785 | * Set one try for probe rates. For the |
| 786 | * probes don't enable RTS. | ||
| 787 | */ | ||
| 795 | ath_rc_rate_set_series(rate_table, &rates[i++], txrc, | 788 | ath_rc_rate_set_series(rate_table, &rates[i++], txrc, |
| 796 | 1, rix, 0); | 789 | 1, rix, 0); |
| 797 | 790 | /* | |
| 798 | /* Get the next tried/allowed rate. No RTS for the next series | 791 | * Get the next tried/allowed rate. |
| 799 | * after the probe rate | 792 | * No RTS for the next series after the probe rate. |
| 800 | */ | 793 | */ |
| 801 | ath_rc_get_lower_rix(rate_table, ath_rc_priv, rix, &rix); | 794 | ath_rc_get_lower_rix(ath_rc_priv, rix, &rix); |
| 802 | ath_rc_rate_set_series(rate_table, &rates[i++], txrc, | 795 | ath_rc_rate_set_series(rate_table, &rates[i++], txrc, |
| 803 | try_per_rate, rix, 0); | 796 | try_per_rate, rix, 0); |
| 804 | 797 | ||
| 805 | tx_info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; | 798 | tx_info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; |
| 806 | } else { | 799 | } else { |
| 807 | /* Set the chosen rate. No RTS for first series entry. */ | 800 | /* |
| 801 | * Set the chosen rate. No RTS for first series entry. | ||
| 802 | */ | ||
| 808 | ath_rc_rate_set_series(rate_table, &rates[i++], txrc, | 803 | ath_rc_rate_set_series(rate_table, &rates[i++], txrc, |
| 809 | try_per_rate, rix, 0); | 804 | try_per_rate, rix, 0); |
| 810 | } | 805 | } |
| 811 | 806 | ||
| 812 | /* Fill in the other rates for multirate retry */ | ||
| 813 | for ( ; i < 3; i++) { | 807 | for ( ; i < 3; i++) { |
| 808 | ath_rc_get_lower_rix(ath_rc_priv, rix, &rix); | ||
| 814 | 809 | ||
| 815 | ath_rc_get_lower_rix(rate_table, ath_rc_priv, rix, &rix); | 810 | /* |
| 816 | /* All other rates in the series have RTS enabled */ | 811 | * All other rates in the series have RTS enabled. |
| 812 | */ | ||
| 817 | ath_rc_rate_set_series(rate_table, &rates[i], txrc, | 813 | ath_rc_rate_set_series(rate_table, &rates[i], txrc, |
| 818 | try_per_rate, rix, 1); | 814 | try_per_rate, rix, 1); |
| 819 | } | 815 | } |
| 820 | 816 | ||
| 821 | /* Use twice the number of tries for the last MRR segment. */ | 817 | /* |
| 818 | * Use twice the number of tries for the last MRR segment. | ||
| 819 | */ | ||
| 822 | try_per_rate = 8; | 820 | try_per_rate = 8; |
| 823 | 821 | ||
| 824 | /* | 822 | /* |
| @@ -827,11 +825,11 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, | |||
| 827 | * as last retry to ensure that the frame is tried in both | 825 | * as last retry to ensure that the frame is tried in both |
| 828 | * MCS and legacy rate. | 826 | * MCS and legacy rate. |
| 829 | */ | 827 | */ |
| 830 | ath_rc_get_lower_rix(rate_table, ath_rc_priv, rix, &rix); | 828 | ath_rc_get_lower_rix(ath_rc_priv, rix, &rix); |
| 829 | |||
| 831 | if (WLAN_RC_PHY_HT(rate_table->info[rix].phy) && | 830 | if (WLAN_RC_PHY_HT(rate_table->info[rix].phy) && |
| 832 | (ath_rc_priv->per[rix] > 45)) | 831 | (ath_rc_priv->per[rix] > 45)) |
| 833 | rix = ath_rc_get_highest_rix(sc, ath_rc_priv, rate_table, | 832 | rix = ath_rc_get_highest_rix(ath_rc_priv, &is_probe, true); |
| 834 | &is_probe, true); | ||
| 835 | 833 | ||
| 836 | /* All other rates in the series have RTS enabled */ | 834 | /* All other rates in the series have RTS enabled */ |
| 837 | ath_rc_rate_set_series(rate_table, &rates[i], txrc, | 835 | ath_rc_rate_set_series(rate_table, &rates[i], txrc, |
| @@ -1061,8 +1059,8 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
| 1061 | if (ath_rc_priv->per[tx_rate] >= 55 && tx_rate > 0 && | 1059 | if (ath_rc_priv->per[tx_rate] >= 55 && tx_rate > 0 && |
| 1062 | rate_table->info[tx_rate].ratekbps <= | 1060 | rate_table->info[tx_rate].ratekbps <= |
| 1063 | rate_table->info[ath_rc_priv->rate_max_phy].ratekbps) { | 1061 | rate_table->info[ath_rc_priv->rate_max_phy].ratekbps) { |
| 1064 | ath_rc_get_lower_rix(rate_table, ath_rc_priv, | 1062 | ath_rc_get_lower_rix(ath_rc_priv, (u8)tx_rate, |
| 1065 | (u8)tx_rate, &ath_rc_priv->rate_max_phy); | 1063 | &ath_rc_priv->rate_max_phy); |
| 1066 | 1064 | ||
| 1067 | /* Don't probe for a little while. */ | 1065 | /* Don't probe for a little while. */ |
| 1068 | ath_rc_priv->probe_time = now_msec; | 1066 | ath_rc_priv->probe_time = now_msec; |
