diff options
author | Christian Lamparter <chunkeey@googlemail.com> | 2011-08-15 13:50:48 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-08-24 14:41:42 -0400 |
commit | acf1771221f2877ab5d36487930cd6a2ecaa73e6 (patch) | |
tree | cbe4f29eb2b7c5a78a63f99bdffdbaaac141ef33 /drivers/net/wireless/ath/carl9170/cmd.c | |
parent | f5e2289a142c714732aef67cadbb0a8843565507 (diff) |
carl9170: improve site survey
The firmware keeps track of channel usage. This data can
be used by the automatic channel selection to find the
*best* channel.
Survey data from wlan22
frequency: 2412 MHz [in use]
noise: -86 dBm
channel active time: 3339608 ms
channel busy time: 270982 ms
channel transmit time: 121515 ms
Survey data from wlan22
frequency: 2417 MHz
noise: -86 dBm
channel active time: 70 ms
channel busy time: 2 ms
channel transmit time: 1 ms
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/carl9170/cmd.c')
-rw-r--r-- | drivers/net/wireless/ath/carl9170/cmd.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/carl9170/cmd.c b/drivers/net/wireless/ath/carl9170/cmd.c index cdfc94c371b4..9970bf8edc40 100644 --- a/drivers/net/wireless/ath/carl9170/cmd.c +++ b/drivers/net/wireless/ath/carl9170/cmd.c | |||
@@ -165,6 +165,37 @@ int carl9170_bcn_ctrl(struct ar9170 *ar, const unsigned int vif_id, | |||
165 | return __carl9170_exec_cmd(ar, cmd, true); | 165 | return __carl9170_exec_cmd(ar, cmd, true); |
166 | } | 166 | } |
167 | 167 | ||
168 | int carl9170_collect_tally(struct ar9170 *ar) | ||
169 | { | ||
170 | struct carl9170_tally_rsp tally; | ||
171 | struct survey_info *info; | ||
172 | unsigned int tick; | ||
173 | int err; | ||
174 | |||
175 | err = carl9170_exec_cmd(ar, CARL9170_CMD_TALLY, 0, NULL, | ||
176 | sizeof(tally), (u8 *)&tally); | ||
177 | if (err) | ||
178 | return err; | ||
179 | |||
180 | tick = le32_to_cpu(tally.tick); | ||
181 | if (tick) { | ||
182 | ar->tally.active += le32_to_cpu(tally.active) / tick; | ||
183 | ar->tally.cca += le32_to_cpu(tally.cca) / tick; | ||
184 | ar->tally.tx_time += le32_to_cpu(tally.tx_time) / tick; | ||
185 | ar->tally.rx_total += le32_to_cpu(tally.rx_total); | ||
186 | ar->tally.rx_overrun += le32_to_cpu(tally.rx_overrun); | ||
187 | |||
188 | if (ar->channel) { | ||
189 | info = &ar->survey[ar->channel->hw_value]; | ||
190 | |||
191 | info->channel_time = ar->tally.active / 1000; | ||
192 | info->channel_time_busy = ar->tally.cca / 1000; | ||
193 | info->channel_time_tx = ar->tally.tx_time / 1000; | ||
194 | } | ||
195 | } | ||
196 | return 0; | ||
197 | } | ||
198 | |||
168 | int carl9170_powersave(struct ar9170 *ar, const bool ps) | 199 | int carl9170_powersave(struct ar9170 *ar, const bool ps) |
169 | { | 200 | { |
170 | struct carl9170_cmd *cmd; | 201 | struct carl9170_cmd *cmd; |