Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 134041
b: refs/heads/master
c: 030bb49
h: refs/heads/master
i:
  134039: 2db29b9
v: v3
  • Loading branch information
Luis R. Rodriguez authored and John W. Linville committed Jan 29, 2009
1 parent 534895f commit 342171e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 33 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 10c806b32db1c9f010945e92043ef2a3f6fffc3f
refs/heads/master: 030bb495c0c34aa74903ab8cf9c35e4f2f0aedea
72 changes: 40 additions & 32 deletions trunk/drivers/net/wireless/ath9k/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,41 +59,47 @@ static void bus_read_cachesize(struct ath_softc *sc, int *csz)
*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
* 11g, otherwise at 1Mb/s.
* XXX select protection rate index from rate table.
*/
sc->sc_protrix = (mode == ATH9K_MODE_11G ? 1 : 0);
}

static enum wireless_mode ath_chan2mode(struct ath9k_channel *chan)
{
if (chan->chanmode == CHANNEL_A)
return ATH9K_MODE_11A;
else if (chan->chanmode == CHANNEL_G)
return ATH9K_MODE_11G;
else if (chan->chanmode == CHANNEL_B)
return ATH9K_MODE_11B;
else if (chan->chanmode == CHANNEL_A_HT20)
return ATH9K_MODE_11NA_HT20;
else if (chan->chanmode == CHANNEL_G_HT20)
return ATH9K_MODE_11NG_HT20;
else if (chan->chanmode == CHANNEL_A_HT40PLUS)
return ATH9K_MODE_11NA_HT40PLUS;
else if (chan->chanmode == CHANNEL_A_HT40MINUS)
return ATH9K_MODE_11NA_HT40MINUS;
else if (chan->chanmode == CHANNEL_G_HT40PLUS)
return ATH9K_MODE_11NG_HT40PLUS;
else if (chan->chanmode == CHANNEL_G_HT40MINUS)
return ATH9K_MODE_11NG_HT40MINUS;

WARN_ON(1); /* should not get here */

return ATH9K_MODE_11B;
sc->sc_protrix = 0;
switch (conf->channel->band) {
case IEEE80211_BAND_2GHZ:
if (conf_is_ht20(conf))
sc->cur_rate_table =
sc->hw_rate_table[ATH9K_MODE_11NG_HT20];
else if (conf_is_ht40_minus(conf))
sc->cur_rate_table =
sc->hw_rate_table[ATH9K_MODE_11NG_HT40MINUS];
else if (conf_is_ht40_plus(conf))
sc->cur_rate_table =
sc->hw_rate_table[ATH9K_MODE_11NG_HT40PLUS];
else {
sc->sc_protrix = 1;
sc->cur_rate_table =
sc->hw_rate_table[ATH9K_MODE_11G];
}
break;
case IEEE80211_BAND_5GHZ:
if (conf_is_ht20(conf))
sc->cur_rate_table =
sc->hw_rate_table[ATH9K_MODE_11NA_HT20];
else if (conf_is_ht40_minus(conf))
sc->cur_rate_table =
sc->hw_rate_table[ATH9K_MODE_11NA_HT40MINUS];
else if (conf_is_ht40_plus(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];
break;
default:
break;
}
}

static void ath_update_txpow(struct ath_softc *sc)
Expand Down Expand Up @@ -258,6 +264,7 @@ static int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan)
{
struct ath_hal *ah = sc->sc_ah;
bool fastcc = true, stopped;
struct ieee80211_hw *hw = sc->hw;

if (sc->sc_flags & SC_OP_INVALID)
return -EIO;
Expand Down Expand Up @@ -316,7 +323,7 @@ static int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan)
return -EIO;
}

ath_setcurmode(sc, ath_chan2mode(hchan));
ath_setcurmode(sc, &hw->conf);
ath_update_txpow(sc);
ath9k_hw_set_interrupts(ah, sc->sc_imask);
}
Expand Down Expand Up @@ -1619,6 +1626,7 @@ static int ath_attach(u16 devid, struct ath_softc *sc)
int ath_reset(struct ath_softc *sc, bool retry_tx)
{
struct ath_hal *ah = sc->sc_ah;
struct ieee80211_hw *hw = sc->hw;
int status;
int error = 0;

Expand Down Expand Up @@ -1646,7 +1654,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
* that changes the channel so update any state that
* might change as a result.
*/
ath_setcurmode(sc, ath_chan2mode(sc->sc_ah->ah_curchan));
ath_setcurmode(sc, &hw->conf);

ath_update_txpow(sc);

Expand Down Expand Up @@ -1943,7 +1951,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
!sc->sc_config.swBeaconProcess)
sc->sc_imask |= ATH9K_INT_TIM;

ath_setcurmode(sc, ath_chan2mode(init_channel));
ath_setcurmode(sc, &hw->conf);

sc->sc_flags &= ~SC_OP_INVALID;

Expand Down

0 comments on commit 342171e

Please sign in to comment.