Skip to content

Commit

Permalink
ath9k: Fix invalid noisefloor reading due to channel update
Browse files Browse the repository at this point in the history
While switching b/w HT20/40, the current channel's nf values
are updated into history buffer. Since the current channel's
channel type, channel flag got updated before reading
nf value from hw. This channel type mismatch is causing invalid
readings when hw is on ht20 but getnf tries to read on extn chains.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Rajkumar Manoharan authored and John W. Linville committed Aug 24, 2011
1 parent 6b3d348 commit e338a85
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions drivers/net/wireless/ath/ath9k/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1672,6 +1672,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)

if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
struct ieee80211_channel *curchan = hw->conf.channel;
struct ath9k_channel old_chan;
int pos = curchan->hw_value;
int old_pos = -1;
unsigned long flags;
Expand All @@ -1688,14 +1689,24 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
"Set channel: %d MHz type: %d\n",
curchan->center_freq, conf->channel_type);

ath9k_cmn_update_ichannel(&sc->sc_ah->channels[pos],
curchan, conf->channel_type);

/* update survey stats for the old channel before switching */
spin_lock_irqsave(&common->cc_lock, flags);
ath_update_survey_stats(sc);
spin_unlock_irqrestore(&common->cc_lock, flags);

/*
* Preserve the current channel values, before updating
* the same channel
*/
if (old_pos == pos) {
memcpy(&old_chan, &sc->sc_ah->channels[pos],
sizeof(struct ath9k_channel));
ah->curchan = &old_chan;
}

ath9k_cmn_update_ichannel(&sc->sc_ah->channels[pos],
curchan, conf->channel_type);

/*
* If the operating channel changes, change the survey in-use flags
* along with it.
Expand Down

0 comments on commit e338a85

Please sign in to comment.