]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/net/wireless/ath/ath9k/rc.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
[net-next-2.6.git] / drivers / net / wireless / ath / ath9k / rc.c
index 5db3a12356ec9e81d54dcf2a49e7f3924f0d3ec7..89978d71617fdaf89a70be70f28a77b199b18d98 100644 (file)
@@ -378,17 +378,6 @@ static const struct ath_rate_table ar5416_11g_ratetable = {
        0,   /* Phy rates allowed initially */
 };
 
-static const struct ath_rate_table *hw_rate_table[ATH9K_MODE_MAX] = {
-       [ATH9K_MODE_11A] = &ar5416_11a_ratetable,
-       [ATH9K_MODE_11G] = &ar5416_11g_ratetable,
-       [ATH9K_MODE_11NA_HT20] = &ar5416_11na_ratetable,
-       [ATH9K_MODE_11NG_HT20] = &ar5416_11ng_ratetable,
-       [ATH9K_MODE_11NA_HT40PLUS] = &ar5416_11na_ratetable,
-       [ATH9K_MODE_11NA_HT40MINUS] = &ar5416_11na_ratetable,
-       [ATH9K_MODE_11NG_HT40PLUS] = &ar5416_11ng_ratetable,
-       [ATH9K_MODE_11NG_HT40MINUS] = &ar5416_11ng_ratetable,
-};
-
 static int ath_rc_get_rateindex(const struct ath_rate_table *rate_table,
                                struct ieee80211_tx_rate *rate);
 
@@ -538,7 +527,7 @@ static u8 ath_rc_setvalid_rates(struct ath_rate_priv *ath_rc_priv,
        for (i = 0; i < rateset->rs_nrates; i++) {
                for (j = 0; j < rate_table->rate_cnt; j++) {
                        u32 phy = rate_table->info[j].phy;
-                       u16 rate_flags = rate_table->info[i].rate_flags;
+                       u16 rate_flags = rate_table->info[j].rate_flags;
                        u8 rate = rateset->rs_rates[i];
                        u8 dot11rate = rate_table->info[j].dot11rate;
 
@@ -791,7 +780,7 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
         */
        try_per_rate = 4;
 
-       rate_table = sc->cur_rate_table;
+       rate_table = ath_rc_priv->rate_table;
        rix = ath_rc_get_highest_rix(sc, ath_rc_priv, rate_table, &is_probe);
 
        /*
@@ -1048,7 +1037,7 @@ static void ath_rc_update_ht(struct ath_softc *sc,
        int rate;
        u8 last_per;
        bool state_change = false;
-       const struct ath_rate_table *rate_table = sc->cur_rate_table;
+       const struct ath_rate_table *rate_table = ath_rc_priv->rate_table;
        int size = ath_rc_priv->rate_table_size;
 
        if ((tx_rate < 0) || (tx_rate > rate_table->rate_cnt))
@@ -1150,7 +1139,7 @@ static void ath_rc_tx_status(struct ath_softc *sc,
        u8 flags;
        u32 i = 0, rix;
 
-       rate_table = sc->cur_rate_table;
+       rate_table = ath_rc_priv->rate_table;
 
        /*
         * If the first rate is not the final index, there
@@ -1200,39 +1189,23 @@ static void ath_rc_tx_status(struct ath_softc *sc,
 static const
 struct ath_rate_table *ath_choose_rate_table(struct ath_softc *sc,
                                             enum ieee80211_band band,
-                                            bool is_ht,
-                                            bool is_cw_40)
+                                            bool is_ht)
 {
-       int mode = 0;
        struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 
        switch(band) {
        case IEEE80211_BAND_2GHZ:
-               mode = ATH9K_MODE_11G;
                if (is_ht)
-                       mode = ATH9K_MODE_11NG_HT20;
-               if (is_cw_40)
-                       mode = ATH9K_MODE_11NG_HT40PLUS;
-               break;
+                       return &ar5416_11ng_ratetable;
+               return &ar5416_11g_ratetable;
        case IEEE80211_BAND_5GHZ:
-               mode = ATH9K_MODE_11A;
                if (is_ht)
-                       mode = ATH9K_MODE_11NA_HT20;
-               if (is_cw_40)
-                       mode = ATH9K_MODE_11NA_HT40PLUS;
-               break;
+                       return &ar5416_11na_ratetable;
+               return &ar5416_11a_ratetable;
        default:
                ath_print(common, ATH_DBG_CONFIG, "Invalid band\n");
                return NULL;
        }
-
-       BUG_ON(mode >= ATH9K_MODE_MAX);
-
-       ath_print(common, ATH_DBG_CONFIG,
-                 "Choosing rate table for mode: %d\n", mode);
-
-       sc->cur_rate_mode = mode;
-       return hw_rate_table[mode];
 }
 
 static void ath_rc_init(struct ath_softc *sc,
@@ -1303,7 +1276,6 @@ static void ath_rc_init(struct ath_softc *sc,
        ath_rc_priv->max_valid_rate = k;
        ath_rc_sort_validrates(rate_table, ath_rc_priv);
        ath_rc_priv->rate_max_phy = ath_rc_priv->valid_rate_index[k-4];
-       sc->cur_rate_table = rate_table;
        ath_rc_priv->rate_table = rate_table;
 
        ath_print(common, ATH_DBG_CONFIG,
@@ -1439,8 +1411,9 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband,
                }
        }
 
-       ath_debug_stat_rc(ath_rc_priv, ath_rc_get_rateindex(sc->cur_rate_table,
-               &tx_info->status.rates[final_ts_idx]));
+       ath_debug_stat_rc(ath_rc_priv,
+               ath_rc_get_rateindex(ath_rc_priv->rate_table,
+                       &tx_info->status.rates[final_ts_idx]));
 }
 
 static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband,
@@ -1480,14 +1453,8 @@ static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband,
 
        /* Choose rate table first */
 
-       if ((sc->sc_ah->opmode == NL80211_IFTYPE_STATION) ||
-           (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT) ||
-           (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC)) {
-               rate_table = ath_choose_rate_table(sc, sband->band,
-                                     sta->ht_cap.ht_supported, is_cw40);
-       } else {
-               rate_table = hw_rate_table[sc->cur_rate_mode];
-       }
+       rate_table = ath_choose_rate_table(sc, sband->band,
+                             sta->ht_cap.ht_supported);
 
        ath_rc_priv->ht_cap = ath_rc_build_ht_caps(sc, sta, is_cw40, is_sgi);
        ath_rc_init(sc, priv_sta, sband, sta, rate_table);
@@ -1527,8 +1494,7 @@ static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband,
 
                if ((local_cw40 != oper_cw40) || (local_sgi != oper_sgi)) {
                        rate_table = ath_choose_rate_table(sc, sband->band,
-                                                  sta->ht_cap.ht_supported,
-                                                  oper_cw40);
+                                                  sta->ht_cap.ht_supported);
                        ath_rc_priv->ht_cap = ath_rc_build_ht_caps(sc, sta,
                                                   oper_cw40, oper_sgi);
                        ath_rc_init(sc, priv_sta, sband, sta, rate_table);
@@ -1536,7 +1502,6 @@ static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband,
                        ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_CONFIG,
                                  "Operating HT Bandwidth changed to: %d\n",
                                  sc->hw->conf.channel_type);
-                       sc->cur_rate_table = hw_rate_table[sc->cur_rate_mode];
                }
        }
 }