diff options
author | Bruno Randolf <br1@einfach.org> | 2010-10-19 03:56:54 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-11-09 16:13:26 -0500 |
commit | edb40a23c8dc5b5be219bf4561074b6233bba65f (patch) | |
tree | c5f22914ac7f8463ed112cea163780680ae77a5e /drivers/net/wireless/ath/ath5k/base.c | |
parent | 3dd0923de491d72a041f82a9d0aaccc473fd2c42 (diff) |
ath5k: Add channel time to survey data
Include the channel utilization (busy, rx, tx) in the survey results.
Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/base.c')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/base.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index 8251946842e6..484aad5b11b5 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -3206,14 +3206,32 @@ static int ath5k_get_survey(struct ieee80211_hw *hw, int idx, | |||
3206 | { | 3206 | { |
3207 | struct ath5k_softc *sc = hw->priv; | 3207 | struct ath5k_softc *sc = hw->priv; |
3208 | struct ieee80211_conf *conf = &hw->conf; | 3208 | struct ieee80211_conf *conf = &hw->conf; |
3209 | struct ath_common *common = ath5k_hw_common(sc->ah); | ||
3210 | struct ath_cycle_counters *cc = &common->cc_survey; | ||
3211 | unsigned int div = common->clockrate * 1000; | ||
3209 | 3212 | ||
3210 | if (idx != 0) | 3213 | if (idx != 0) |
3211 | return -ENOENT; | 3214 | return -ENOENT; |
3212 | 3215 | ||
3213 | survey->channel = conf->channel; | 3216 | survey->channel = conf->channel; |
3214 | survey->filled = SURVEY_INFO_NOISE_DBM; | 3217 | survey->filled = SURVEY_INFO_NOISE_DBM; |
3215 | survey->noise = sc->ah->ah_noise_floor; | 3218 | survey->noise = sc->ah->ah_noise_floor; |
3216 | 3219 | ||
3220 | spin_lock_bh(&common->cc_lock); | ||
3221 | ath_hw_cycle_counters_update(common); | ||
3222 | if (cc->cycles > 0) { | ||
3223 | survey->filled |= SURVEY_INFO_CHANNEL_TIME | | ||
3224 | SURVEY_INFO_CHANNEL_TIME_BUSY | | ||
3225 | SURVEY_INFO_CHANNEL_TIME_RX | | ||
3226 | SURVEY_INFO_CHANNEL_TIME_TX; | ||
3227 | survey->channel_time += cc->cycles / div; | ||
3228 | survey->channel_time_busy += cc->rx_busy / div; | ||
3229 | survey->channel_time_rx += cc->rx_frame / div; | ||
3230 | survey->channel_time_tx += cc->tx_frame / div; | ||
3231 | } | ||
3232 | memset(cc, 0, sizeof(*cc)); | ||
3233 | spin_unlock_bh(&common->cc_lock); | ||
3234 | |||
3217 | return 0; | 3235 | return 0; |
3218 | } | 3236 | } |
3219 | 3237 | ||