aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2008-12-23 18:58:37 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-01-29 15:59:28 -0500
commit030bb495c0c34aa74903ab8cf9c35e4f2f0aedea (patch)
tree5df0dad9334068429d9a36bda36795259db1b36a /drivers
parent10c806b32db1c9f010945e92043ef2a3f6fffc3f (diff)
ath9k: use hw->conf on ath_setcurmode()
We don't need to use our own mode for setting the the routine tries to do, in fact lets remove ath_chan2mode() now as we can simply use the currently set band and the HT configuration provided by mac80211 through the ieee80211_conf. This works on changing channels as well as the internal ath9k_channel we use is based on the ieee80211_channel in the config. Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath9k/main.c72
1 files changed, 40 insertions, 32 deletions
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 727f067aca4f..699d248efc4c 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -59,41 +59,47 @@ static void bus_read_cachesize(struct ath_softc *sc, int *csz)
59 *csz = DEFAULT_CACHELINE >> 2; /* Use the default size */ 59 *csz = DEFAULT_CACHELINE >> 2; /* Use the default size */
60} 60}
61 61
62static void ath_setcurmode(struct ath_softc *sc, enum wireless_mode mode) 62static void ath_setcurmode(struct ath_softc *sc, struct ieee80211_conf *conf)
63{ 63{
64 sc->cur_rate_table = sc->hw_rate_table[mode];
65 /* 64 /*
66 * All protection frames are transmited at 2Mb/s for 65 * All protection frames are transmited at 2Mb/s for
67 * 11g, otherwise at 1Mb/s. 66 * 11g, otherwise at 1Mb/s.
68 * XXX select protection rate index from rate table. 67 * XXX select protection rate index from rate table.
69 */ 68 */
70 sc->sc_protrix = (mode == ATH9K_MODE_11G ? 1 : 0); 69 sc->sc_protrix = 0;
71} 70 switch (conf->channel->band) {
72 71 case IEEE80211_BAND_2GHZ:
73static enum wireless_mode ath_chan2mode(struct ath9k_channel *chan) 72 if (conf_is_ht20(conf))
74{ 73 sc->cur_rate_table =
75 if (chan->chanmode == CHANNEL_A) 74 sc->hw_rate_table[ATH9K_MODE_11NG_HT20];
76 return ATH9K_MODE_11A; 75 else if (conf_is_ht40_minus(conf))
77 else if (chan->chanmode == CHANNEL_G) 76 sc->cur_rate_table =
78 return ATH9K_MODE_11G; 77 sc->hw_rate_table[ATH9K_MODE_11NG_HT40MINUS];
79 else if (chan->chanmode == CHANNEL_B) 78 else if (conf_is_ht40_plus(conf))
80 return ATH9K_MODE_11B; 79 sc->cur_rate_table =
81 else if (chan->chanmode == CHANNEL_A_HT20) 80 sc->hw_rate_table[ATH9K_MODE_11NG_HT40PLUS];
82 return ATH9K_MODE_11NA_HT20; 81 else {
83 else if (chan->chanmode == CHANNEL_G_HT20) 82 sc->sc_protrix = 1;
84 return ATH9K_MODE_11NG_HT20; 83 sc->cur_rate_table =
85 else if (chan->chanmode == CHANNEL_A_HT40PLUS) 84 sc->hw_rate_table[ATH9K_MODE_11G];
86 return ATH9K_MODE_11NA_HT40PLUS; 85 }
87 else if (chan->chanmode == CHANNEL_A_HT40MINUS) 86 break;
88 return ATH9K_MODE_11NA_HT40MINUS; 87 case IEEE80211_BAND_5GHZ:
89 else if (chan->chanmode == CHANNEL_G_HT40PLUS) 88 if (conf_is_ht20(conf))
90 return ATH9K_MODE_11NG_HT40PLUS; 89 sc->cur_rate_table =
91 else if (chan->chanmode == CHANNEL_G_HT40MINUS) 90 sc->hw_rate_table[ATH9K_MODE_11NA_HT20];
92 return ATH9K_MODE_11NG_HT40MINUS; 91 else if (conf_is_ht40_minus(conf))
93 92 sc->cur_rate_table =
94 WARN_ON(1); /* should not get here */ 93 sc->hw_rate_table[ATH9K_MODE_11NA_HT40MINUS];
95 94 else if (conf_is_ht40_plus(conf))
96 return ATH9K_MODE_11B; 95 sc->cur_rate_table =
96 sc->hw_rate_table[ATH9K_MODE_11NA_HT40PLUS];
97 else
98 sc->cur_rate_table = sc->hw_rate_table[ATH9K_MODE_11A];
99 break;
100 default:
101 break;
102 }
97} 103}
98 104
99static void ath_update_txpow(struct ath_softc *sc) 105static void ath_update_txpow(struct ath_softc *sc)
@@ -258,6 +264,7 @@ static int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan)
258{ 264{
259 struct ath_hal *ah = sc->sc_ah; 265 struct ath_hal *ah = sc->sc_ah;
260 bool fastcc = true, stopped; 266 bool fastcc = true, stopped;
267 struct ieee80211_hw *hw = sc->hw;
261 268
262 if (sc->sc_flags & SC_OP_INVALID) 269 if (sc->sc_flags & SC_OP_INVALID)
263 return -EIO; 270 return -EIO;
@@ -316,7 +323,7 @@ static int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan)
316 return -EIO; 323 return -EIO;
317 } 324 }
318 325
319 ath_setcurmode(sc, ath_chan2mode(hchan)); 326 ath_setcurmode(sc, &hw->conf);
320 ath_update_txpow(sc); 327 ath_update_txpow(sc);
321 ath9k_hw_set_interrupts(ah, sc->sc_imask); 328 ath9k_hw_set_interrupts(ah, sc->sc_imask);
322 } 329 }
@@ -1619,6 +1626,7 @@ detach:
1619int ath_reset(struct ath_softc *sc, bool retry_tx) 1626int ath_reset(struct ath_softc *sc, bool retry_tx)
1620{ 1627{
1621 struct ath_hal *ah = sc->sc_ah; 1628 struct ath_hal *ah = sc->sc_ah;
1629 struct ieee80211_hw *hw = sc->hw;
1622 int status; 1630 int status;
1623 int error = 0; 1631 int error = 0;
1624 1632
@@ -1646,7 +1654,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
1646 * that changes the channel so update any state that 1654 * that changes the channel so update any state that
1647 * might change as a result. 1655 * might change as a result.
1648 */ 1656 */
1649 ath_setcurmode(sc, ath_chan2mode(sc->sc_ah->ah_curchan)); 1657 ath_setcurmode(sc, &hw->conf);
1650 1658
1651 ath_update_txpow(sc); 1659 ath_update_txpow(sc);
1652 1660
@@ -1943,7 +1951,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
1943 !sc->sc_config.swBeaconProcess) 1951 !sc->sc_config.swBeaconProcess)
1944 sc->sc_imask |= ATH9K_INT_TIM; 1952 sc->sc_imask |= ATH9K_INT_TIM;
1945 1953
1946 ath_setcurmode(sc, ath_chan2mode(init_channel)); 1954 ath_setcurmode(sc, &hw->conf);
1947 1955
1948 sc->sc_flags &= ~SC_OP_INVALID; 1956 sc->sc_flags &= ~SC_OP_INVALID;
1949 1957