]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
ath9k: remove cache of rate preference when using 11g protection
authorLuis R. Rodriguez <lrodriguez@atheros.com>
Tue, 23 Dec 2008 23:58:38 +0000 (15:58 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 29 Jan 2009 20:59:28 +0000 (15:59 -0500)
No need to cache when we want to use 2Mbit/s for all protection
frames for 802.11g as we can determine that dynamically on
ath_buf_set_rate() itself.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath9k/core.h
drivers/net/wireless/ath9k/main.c
drivers/net/wireless/ath9k/xmit.c

index 4ca2aed236e090d081e6649f019cf81da86273c0..2bb35dda6b949a3dec65553b7bb6c2b5014ef924 100644 (file)
@@ -718,7 +718,6 @@ struct ath_softc {
        u32 sc_keymax;
        DECLARE_BITMAP(sc_keymap, ATH_KEYMAX);
        u8 sc_splitmic;
-       u8 sc_protrix;
        enum ath9k_int sc_imask;
        enum PROT_MODE sc_protmode;
        enum ath9k_ht_extprotspacing sc_ht_extprotspacing;
index 699d248efc4c641ce394149223a766d14cc63362..e26a9a6fbfcf1ae7656379eb2039da607623659b 100644 (file)
@@ -61,12 +61,6 @@ static void bus_read_cachesize(struct ath_softc *sc, int *csz)
 
 static void ath_setcurmode(struct ath_softc *sc, struct ieee80211_conf *conf)
 {
-       /*
-        * All protection frames are transmited at 2Mb/s for
-        * 11g, otherwise at 1Mb/s.
-        * XXX select protection rate index from rate table.
-        */
-       sc->sc_protrix = 0;
        switch (conf->channel->band) {
        case IEEE80211_BAND_2GHZ:
                if (conf_is_ht20(conf))
@@ -78,11 +72,9 @@ static void ath_setcurmode(struct ath_softc *sc, struct ieee80211_conf *conf)
                else if (conf_is_ht40_plus(conf))
                        sc->cur_rate_table =
                          sc->hw_rate_table[ATH9K_MODE_11NG_HT40PLUS];
-               else {
-                       sc->sc_protrix = 1;
+               else
                        sc->cur_rate_table =
                          sc->hw_rate_table[ATH9K_MODE_11G];
-               }
                break;
        case IEEE80211_BAND_5GHZ:
                if (conf_is_ht20(conf))
@@ -95,7 +87,8 @@ static void ath_setcurmode(struct ath_softc *sc, struct ieee80211_conf *conf)
                        sc->cur_rate_table =
                          sc->hw_rate_table[ATH9K_MODE_11NA_HT40PLUS];
                else
-                       sc->cur_rate_table = sc->hw_rate_table[ATH9K_MODE_11A];
+                       sc->cur_rate_table =
+                         sc->hw_rate_table[ATH9K_MODE_11A];
                break;
        default:
                break;
index c92f0c6e4adcd1ac64bf0975f5a1f32ed3bf0bfd..3e192fd9591cd27b61993152b9f7075759b48965 100644 (file)
@@ -546,7 +546,8 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf)
        struct ieee80211_tx_info *tx_info;
        struct ieee80211_tx_rate *rates;
        struct ieee80211_hdr *hdr;
-       int i, flags, rtsctsena = 0;
+       struct ieee80211_hw *hw = sc->hw;
+       int i, flags, rtsctsena = 0, enable_g_protection = 0;
        u32 ctsduration = 0;
        u8 rix = 0, cix, ctsrate = 0;
        __le16 fc;
@@ -578,6 +579,12 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf)
        flags = (bf->bf_flags & (ATH9K_TXDESC_RTSENA | ATH9K_TXDESC_CTSENA));
        cix = rt->info[rix].ctrl_rate;
 
+       /* All protection frames are transmited at 2Mb/s for 802.11g,
+        * otherwise we transmit them at 1Mb/s */
+       if (hw->conf.channel->band == IEEE80211_BAND_2GHZ &&
+         !conf_is_ht(&hw->conf))
+               enable_g_protection = 1;
+
        /*
         * If 802.11g protection is enabled, determine whether to use RTS/CTS or
         * just CTS.  Note that this is only done for OFDM/HT unicast frames.
@@ -590,7 +597,7 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf)
                else if (sc->sc_protmode == PROT_M_CTSONLY)
                        flags = ATH9K_TXDESC_CTSENA;
 
-               cix = rt->info[sc->sc_protrix].ctrl_rate;
+               cix = rt->info[enable_g_protection].ctrl_rate;
                rtsctsena = 1;
        }
 
@@ -608,7 +615,7 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf)
        if (sc->sc_config.ath_aggr_prot &&
            (!bf_isaggr(bf) || (bf_isaggr(bf) && bf->bf_al < 8192))) {
                flags = ATH9K_TXDESC_RTSENA;
-               cix = rt->info[sc->sc_protrix].ctrl_rate;
+               cix = rt->info[enable_g_protection].ctrl_rate;
                rtsctsena = 1;
        }