diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-11-03 21:20:26 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-11-11 17:09:06 -0500 |
commit | 21b22738068366d7740b4b7cf55ce270f479543a (patch) | |
tree | 59c25ff4203f4c6e1103a4395a5e4c89d3a02485 /drivers/net/wireless/ath/ath9k/recv.c | |
parent | 9878841e1360266fa4522fbdc2448fcdce95e0dd (diff) |
ath9k: move qual processing into a helper
This moves the qual computing into a small helper,
ath9k_compute_qual()
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/recv.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/recv.c | 74 |
1 files changed, 42 insertions, 32 deletions
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index 9eae9467c275..d357b9adcf49 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -190,6 +190,47 @@ static u8 ath9k_process_rate(struct ath_common *common, | |||
190 | } | 190 | } |
191 | 191 | ||
192 | /* | 192 | /* |
193 | * Theory for reporting quality: | ||
194 | * | ||
195 | * At a hardware RSSI of 45 you will be able to use MCS 7 reliably. | ||
196 | * At a hardware RSSI of 45 you will be able to use MCS 15 reliably. | ||
197 | * At a hardware RSSI of 35 you should be able use 54 Mbps reliably. | ||
198 | * | ||
199 | * MCS 7 is the highets MCS index usable by a 1-stream device. | ||
200 | * MCS 15 is the highest MCS index usable by a 2-stream device. | ||
201 | * | ||
202 | * All ath9k devices are either 1-stream or 2-stream. | ||
203 | * | ||
204 | * How many bars you see is derived from the qual reporting. | ||
205 | * | ||
206 | * A more elaborate scheme can be used here but it requires tables | ||
207 | * of SNR/throughput for each possible mode used. For the MCS table | ||
208 | * you can refer to the wireless wiki: | ||
209 | * | ||
210 | * http://wireless.kernel.org/en/developers/Documentation/ieee80211/802.11n | ||
211 | * | ||
212 | */ | ||
213 | static int ath9k_compute_qual(struct ieee80211_hw *hw, | ||
214 | struct ath_rx_status *rx_stats) | ||
215 | { | ||
216 | int qual; | ||
217 | |||
218 | if (conf_is_ht(&hw->conf)) | ||
219 | qual = rx_stats->rs_rssi * 100 / 45; | ||
220 | else | ||
221 | qual = rx_stats->rs_rssi * 100 / 35; | ||
222 | |||
223 | /* | ||
224 | * rssi can be more than 45 though, anything above that | ||
225 | * should be considered at 100% | ||
226 | */ | ||
227 | if (qual > 100) | ||
228 | qual = 100; | ||
229 | |||
230 | return qual; | ||
231 | } | ||
232 | |||
233 | /* | ||
193 | * For Decrypt or Demic errors, we only mark packet status here and always push | 234 | * For Decrypt or Demic errors, we only mark packet status here and always push |
194 | * up the frame up to let mac80211 handle the actual error case, be it no | 235 | * up the frame up to let mac80211 handle the actual error case, be it no |
195 | * decryption key or real decryption error. This let us keep statistics there. | 236 | * decryption key or real decryption error. This let us keep statistics there. |
@@ -247,38 +288,7 @@ static int ath_rx_prepare(struct ath_common *common, | |||
247 | rx_status->noise = common->ani.noise_floor; | 288 | rx_status->noise = common->ani.noise_floor; |
248 | rx_status->signal = ATH_DEFAULT_NOISE_FLOOR + rx_stats->rs_rssi; | 289 | rx_status->signal = ATH_DEFAULT_NOISE_FLOOR + rx_stats->rs_rssi; |
249 | rx_status->antenna = rx_stats->rs_antenna; | 290 | rx_status->antenna = rx_stats->rs_antenna; |
250 | 291 | rx_status->qual = ath9k_compute_qual(hw, rx_stats); | |
251 | /* | ||
252 | * Theory for reporting quality: | ||
253 | * | ||
254 | * At a hardware RSSI of 45 you will be able to use MCS 7 reliably. | ||
255 | * At a hardware RSSI of 45 you will be able to use MCS 15 reliably. | ||
256 | * At a hardware RSSI of 35 you should be able use 54 Mbps reliably. | ||
257 | * | ||
258 | * MCS 7 is the highets MCS index usable by a 1-stream device. | ||
259 | * MCS 15 is the highest MCS index usable by a 2-stream device. | ||
260 | * | ||
261 | * All ath9k devices are either 1-stream or 2-stream. | ||
262 | * | ||
263 | * How many bars you see is derived from the qual reporting. | ||
264 | * | ||
265 | * A more elaborate scheme can be used here but it requires tables | ||
266 | * of SNR/throughput for each possible mode used. For the MCS table | ||
267 | * you can refer to the wireless wiki: | ||
268 | * | ||
269 | * http://wireless.kernel.org/en/developers/Documentation/ieee80211/802.11n | ||
270 | * | ||
271 | */ | ||
272 | if (conf_is_ht(&hw->conf)) | ||
273 | rx_status->qual = rx_stats->rs_rssi * 100 / 45; | ||
274 | else | ||
275 | rx_status->qual = rx_stats->rs_rssi * 100 / 35; | ||
276 | |||
277 | /* rssi can be more than 45 though, anything above that | ||
278 | * should be considered at 100% */ | ||
279 | if (rx_status->qual > 100) | ||
280 | rx_status->qual = 100; | ||
281 | |||
282 | rx_status->flag |= RX_FLAG_TSFT; | 292 | rx_status->flag |= RX_FLAG_TSFT; |
283 | 293 | ||
284 | return 1; | 294 | return 1; |