aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00.h
diff options
context:
space:
mode:
authorLars Ericsson <Lars_Ericsson@telia.com>2009-08-08 17:54:51 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-08-14 09:13:52 -0400
commit66679a65efffffb62dc2650960b3aff758d575f9 (patch)
tree75f3f323331e89fd7c4a8cc87339cceb1959037b /drivers/net/wireless/rt2x00/rt2x00.h
parent193df183b15cda78f6b2373f576e243327ea0d8f (diff)
rt2x00: Fix rounding errors in RSSI average calculation
Small changes in signal level was not detected up by the MOVING_AVERAGE() due to a rounding error, using 'int' type. rt2x00lib_antenna_diversity_eval: rssi: -62 -62 -62 -62 -62 -62 -62 -62 -62 -62 -62 -62 -62 -62 -62 rssi_avg: -57 -57 -57 -57 -57 -57 -57 -57 -57 -57 -57 -57 -57 -57 -57 The signal level reported back could be significantly (5dBm) different from the actual value. A level +3dBm is the same as double the AP output power. Signed-off-by: Lars Ericsson <Lars_Ericsson@telia.com> Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00.h')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 704e94474b1d..e6e73be31e37 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -134,6 +134,17 @@
134 GET_DURATION(IEEE80211_HEADER + ACK_SIZE, 10) ) 134 GET_DURATION(IEEE80211_HEADER + ACK_SIZE, 10) )
135 135
136/* 136/*
137 * Structure for average calculation
138 * The avg field contains the actual average value,
139 * but avg_weight is internally used during calculations
140 * to prevent rounding errors.
141 */
142struct avg_val {
143 int avg;
144 int avg_weight;
145};
146
147/*
137 * Chipset identification 148 * Chipset identification
138 * The chipset on the device is composed of a RT and RF chip. 149 * The chipset on the device is composed of a RT and RF chip.
139 * The chipset combination is important for determining device capabilities. 150 * The chipset combination is important for determining device capabilities.
@@ -256,7 +267,7 @@ struct link_ant {
256 * Similar to the avg_rssi in the link_qual structure 267 * Similar to the avg_rssi in the link_qual structure
257 * this value is updated by using the walking average. 268 * this value is updated by using the walking average.
258 */ 269 */
259 int rssi_ant; 270 struct avg_val rssi_ant;
260}; 271};
261 272
262/* 273/*
@@ -285,7 +296,7 @@ struct link {
285 /* 296 /*
286 * Currently active average RSSI value 297 * Currently active average RSSI value
287 */ 298 */
288 int avg_rssi; 299 struct avg_val avg_rssi;
289 300
290 /* 301 /*
291 * Currently precalculated percentages of successful 302 * Currently precalculated percentages of successful