Commit 030bb495 authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by John W. Linville

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: default avatarLuis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 10c806b3
...@@ -59,41 +59,47 @@ static void bus_read_cachesize(struct ath_softc *sc, int *csz) ...@@ -59,41 +59,47 @@ static void bus_read_cachesize(struct ath_softc *sc, int *csz)
*csz = DEFAULT_CACHELINE >> 2; /* Use the default size */ *csz = DEFAULT_CACHELINE >> 2; /* Use the default size */
} }
static void ath_setcurmode(struct ath_softc *sc, enum wireless_mode mode) static void ath_setcurmode(struct ath_softc *sc, struct ieee80211_conf *conf)
{ {
sc->cur_rate_table = sc->hw_rate_table[mode];
/* /*
* All protection frames are transmited at 2Mb/s for * All protection frames are transmited at 2Mb/s for
* 11g, otherwise at 1Mb/s. * 11g, otherwise at 1Mb/s.
* XXX select protection rate index from rate table. * XXX select protection rate index from rate table.
*/ */
sc->sc_protrix = (mode == ATH9K_MODE_11G ? 1 : 0); sc->sc_protrix = 0;
} switch (conf->channel->band) {
case IEEE80211_BAND_2GHZ:
static enum wireless_mode ath_chan2mode(struct ath9k_channel *chan) if (conf_is_ht20(conf))
{ sc->cur_rate_table =
if (chan->chanmode == CHANNEL_A) sc->hw_rate_table[ATH9K_MODE_11NG_HT20];
return ATH9K_MODE_11A; else if (conf_is_ht40_minus(conf))
else if (chan->chanmode == CHANNEL_G) sc->cur_rate_table =
return ATH9K_MODE_11G; sc->hw_rate_table[ATH9K_MODE_11NG_HT40MINUS];
else if (chan->chanmode == CHANNEL_B) else if (conf_is_ht40_plus(conf))
return ATH9K_MODE_11B; sc->cur_rate_table =
else if (chan->chanmode == CHANNEL_A_HT20) sc->hw_rate_table[ATH9K_MODE_11NG_HT40PLUS];
return ATH9K_MODE_11NA_HT20; else {
else if (chan->chanmode == CHANNEL_G_HT20) sc->sc_protrix = 1;
return ATH9K_MODE_11NG_HT20; sc->cur_rate_table =
else if (chan->chanmode == CHANNEL_A_HT40PLUS) sc->hw_rate_table[ATH9K_MODE_11G];
return ATH9K_MODE_11NA_HT40PLUS; }
else if (chan->chanmode == CHANNEL_A_HT40MINUS) break;
return ATH9K_MODE_11NA_HT40MINUS; case IEEE80211_BAND_5GHZ:
else if (chan->chanmode == CHANNEL_G_HT40PLUS) if (conf_is_ht20(conf))
return ATH9K_MODE_11NG_HT40PLUS; sc->cur_rate_table =
else if (chan->chanmode == CHANNEL_G_HT40MINUS) sc->hw_rate_table[ATH9K_MODE_11NA_HT20];
return ATH9K_MODE_11NG_HT40MINUS; else if (conf_is_ht40_minus(conf))
sc->cur_rate_table =
WARN_ON(1); /* should not get here */ sc->hw_rate_table[ATH9K_MODE_11NA_HT40MINUS];
else if (conf_is_ht40_plus(conf))
return ATH9K_MODE_11B; sc->cur_rate_table =
sc->hw_rate_table[ATH9K_MODE_11NA_HT40PLUS];
else
sc->cur_rate_table = sc->hw_rate_table[ATH9K_MODE_11A];
break;
default:
break;
}
} }
static void ath_update_txpow(struct ath_softc *sc) static 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,6 +264,7 @@ static int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan)
{ {
struct ath_hal *ah = sc->sc_ah; struct ath_hal *ah = sc->sc_ah;
bool fastcc = true, stopped; bool fastcc = true, stopped;
struct ieee80211_hw *hw = sc->hw;
if (sc->sc_flags & SC_OP_INVALID) if (sc->sc_flags & SC_OP_INVALID)
return -EIO; return -EIO;
...@@ -316,7 +323,7 @@ static int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan) ...@@ -316,7 +323,7 @@ static int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan)
return -EIO; return -EIO;
} }
ath_setcurmode(sc, ath_chan2mode(hchan)); ath_setcurmode(sc, &hw->conf);
ath_update_txpow(sc); ath_update_txpow(sc);
ath9k_hw_set_interrupts(ah, sc->sc_imask); ath9k_hw_set_interrupts(ah, sc->sc_imask);
} }
...@@ -1619,6 +1626,7 @@ static int ath_attach(u16 devid, struct ath_softc *sc) ...@@ -1619,6 +1626,7 @@ static int ath_attach(u16 devid, struct ath_softc *sc)
int ath_reset(struct ath_softc *sc, bool retry_tx) int ath_reset(struct ath_softc *sc, bool retry_tx)
{ {
struct ath_hal *ah = sc->sc_ah; struct ath_hal *ah = sc->sc_ah;
struct ieee80211_hw *hw = sc->hw;
int status; int status;
int error = 0; int error = 0;
...@@ -1646,7 +1654,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) ...@@ -1646,7 +1654,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
* that changes the channel so update any state that * that changes the channel so update any state that
* might change as a result. * might change as a result.
*/ */
ath_setcurmode(sc, ath_chan2mode(sc->sc_ah->ah_curchan)); ath_setcurmode(sc, &hw->conf);
ath_update_txpow(sc); ath_update_txpow(sc);
...@@ -1943,7 +1951,7 @@ static int ath9k_start(struct ieee80211_hw *hw) ...@@ -1943,7 +1951,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
!sc->sc_config.swBeaconProcess) !sc->sc_config.swBeaconProcess)
sc->sc_imask |= ATH9K_INT_TIM; sc->sc_imask |= ATH9K_INT_TIM;
ath_setcurmode(sc, ath_chan2mode(init_channel)); ath_setcurmode(sc, &hw->conf);
sc->sc_flags &= ~SC_OP_INVALID; sc->sc_flags &= ~SC_OP_INVALID;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment