Skip to content

Commit

Permalink
ath9k: Allow user to change tx power when asked
Browse files Browse the repository at this point in the history
We were also changing tx power even when we were not asked to,
this enforces the change only when we are asked nicely. When
not asked we simply try to use the max power, we don't tx power
at all for rate control.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Luis R. Rodriguez authored and John W. Linville committed Oct 31, 2008
1 parent f97e400 commit 5c020dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion drivers/net/wireless/ath9k/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,8 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
sc->sc_ah->ah_channels[pos].chanmode =
ath_get_extchanmode(sc, curchan);

sc->sc_config.txpowlimit = 2 * conf->power_level;
if (changed & IEEE80211_CONF_CHANGE_POWER)
sc->sc_config.txpowlimit = 2 * conf->power_level;

/* set h/w channel */
if (ath_set_channel(sc, &sc->sc_ah->ah_channels[pos]) < 0)
Expand Down
8 changes: 7 additions & 1 deletion drivers/net/wireless/ath9k/xmit.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,13 @@ static int ath_tx_prepare(struct ath_softc *sc,

txctl->if_id = 0;
txctl->frmlen = skb->len + FCS_LEN - (hdrlen & 3);
txctl->txpower = MAX_RATE_POWER; /* FIXME */

/* Always try at highest power possible unless the the device
* was configured by the user to use another power. */
if (likely(sc->sc_config.txpowlimit == ATH_TXPOWER_MAX))
txctl->txpower = ATH_TXPOWER_MAX;
else
txctl->txpower = sc->sc_config.txpowlimit;

/* Fill Key related fields */

Expand Down

0 comments on commit 5c020dc

Please sign in to comment.