diff options
author | Ivo van Doorn <ivdoorn@gmail.com> | 2007-10-13 10:26:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:02:49 -0500 |
commit | ebcf26dae9f10e247ea41ef66f89b336ba456097 (patch) | |
tree | 27913a0d00a754d37702ec29a979c3ce5d358524 /drivers/net/wireless/rt2x00/rt2x00.h | |
parent | 191df5737e3047de8b7d8ea4e17df241cf8eefca (diff) |
[PATCH] rt2x00: Move quality statistics into seperate structure
Move all link quality statistics variables into
the link_qual structure. This cleans up the link
structure and allows us to use it for more then
just statistics.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00.h')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00.h | 61 |
1 files changed, 39 insertions, 22 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index c8f16f161c28..cec604b1b093 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -180,18 +180,9 @@ struct rf_channel { | |||
180 | }; | 180 | }; |
181 | 181 | ||
182 | /* | 182 | /* |
183 | * To optimize the quality of the link we need to store | 183 | * Quality statistics about the currently active link. |
184 | * the quality of received frames and periodically | ||
185 | * optimize the link. | ||
186 | */ | 184 | */ |
187 | struct link { | 185 | struct link_qual { |
188 | /* | ||
189 | * Link tuner counter | ||
190 | * The number of times the link has been tuned | ||
191 | * since the radio has been switched on. | ||
192 | */ | ||
193 | u32 count; | ||
194 | |||
195 | /* | 186 | /* |
196 | * Statistics required for Link tuning. | 187 | * Statistics required for Link tuning. |
197 | * For the average RSSI value we use the "Walking average" approach. | 188 | * For the average RSSI value we use the "Walking average" approach. |
@@ -211,7 +202,6 @@ struct link { | |||
211 | * the new values correctly allowing a effective link tuning. | 202 | * the new values correctly allowing a effective link tuning. |
212 | */ | 203 | */ |
213 | int avg_rssi; | 204 | int avg_rssi; |
214 | int vgc_level; | ||
215 | int false_cca; | 205 | int false_cca; |
216 | 206 | ||
217 | /* | 207 | /* |
@@ -240,6 +230,30 @@ struct link { | |||
240 | #define WEIGHT_RSSI 20 | 230 | #define WEIGHT_RSSI 20 |
241 | #define WEIGHT_RX 40 | 231 | #define WEIGHT_RX 40 |
242 | #define WEIGHT_TX 40 | 232 | #define WEIGHT_TX 40 |
233 | }; | ||
234 | |||
235 | /* | ||
236 | * To optimize the quality of the link we need to store | ||
237 | * the quality of received frames and periodically | ||
238 | * optimize the link. | ||
239 | */ | ||
240 | struct link { | ||
241 | /* | ||
242 | * Link tuner counter | ||
243 | * The number of times the link has been tuned | ||
244 | * since the radio has been switched on. | ||
245 | */ | ||
246 | u32 count; | ||
247 | |||
248 | /* | ||
249 | * Quality measurement values. | ||
250 | */ | ||
251 | struct link_qual qual; | ||
252 | |||
253 | /* | ||
254 | * Active VGC level | ||
255 | */ | ||
256 | int vgc_level; | ||
243 | 257 | ||
244 | /* | 258 | /* |
245 | * Work structure for scheduling periodic link tuning. | 259 | * Work structure for scheduling periodic link tuning. |
@@ -249,25 +263,25 @@ struct link { | |||
249 | 263 | ||
250 | /* | 264 | /* |
251 | * Clear all counters inside the link structure. | 265 | * Clear all counters inside the link structure. |
252 | * This can be easiest achieved by memsetting everything | ||
253 | * except for the work structure at the end. | ||
254 | */ | 266 | */ |
255 | static inline void rt2x00_clear_link(struct link *link) | 267 | static inline void rt2x00_clear_link(struct link *link) |
256 | { | 268 | { |
257 | memset(link, 0x00, sizeof(*link) - sizeof(link->work)); | 269 | link->count = 0; |
258 | link->rx_percentage = 50; | 270 | memset(&link->qual, 0, sizeof(link->qual)); |
259 | link->tx_percentage = 50; | 271 | link->qual.rx_percentage = 50; |
272 | link->qual.tx_percentage = 50; | ||
260 | } | 273 | } |
261 | 274 | ||
275 | |||
262 | /* | 276 | /* |
263 | * Update the rssi using the walking average approach. | 277 | * Update the rssi using the walking average approach. |
264 | */ | 278 | */ |
265 | static inline void rt2x00_update_link_rssi(struct link *link, int rssi) | 279 | static inline void rt2x00_update_link_rssi(struct link *link, int rssi) |
266 | { | 280 | { |
267 | if (!link->avg_rssi) | 281 | if (!link->qual.avg_rssi) |
268 | link->avg_rssi = rssi; | 282 | link->qual.avg_rssi = rssi; |
269 | else | 283 | else |
270 | link->avg_rssi = ((link->avg_rssi * 7) + rssi) / 8; | 284 | link->qual.avg_rssi = ((link->qual.avg_rssi * 7) + rssi) / 8; |
271 | } | 285 | } |
272 | 286 | ||
273 | /* | 287 | /* |
@@ -277,7 +291,9 @@ static inline void rt2x00_update_link_rssi(struct link *link, int rssi) | |||
277 | */ | 291 | */ |
278 | static inline int rt2x00_get_link_rssi(struct link *link) | 292 | static inline int rt2x00_get_link_rssi(struct link *link) |
279 | { | 293 | { |
280 | return (link->avg_rssi && link->rx_success) ? link->avg_rssi : -128; | 294 | if (link->qual.avg_rssi && link->qual.rx_success) |
295 | return link->qual.avg_rssi; | ||
296 | return -128; | ||
281 | } | 297 | } |
282 | 298 | ||
283 | /* | 299 | /* |
@@ -402,7 +418,8 @@ struct rt2x00lib_ops { | |||
402 | int (*set_device_state) (struct rt2x00_dev *rt2x00dev, | 418 | int (*set_device_state) (struct rt2x00_dev *rt2x00dev, |
403 | enum dev_state state); | 419 | enum dev_state state); |
404 | int (*rfkill_poll) (struct rt2x00_dev *rt2x00dev); | 420 | int (*rfkill_poll) (struct rt2x00_dev *rt2x00dev); |
405 | void (*link_stats) (struct rt2x00_dev *rt2x00dev); | 421 | void (*link_stats) (struct rt2x00_dev *rt2x00dev, |
422 | struct link_qual *qual); | ||
406 | void (*reset_tuner) (struct rt2x00_dev *rt2x00dev); | 423 | void (*reset_tuner) (struct rt2x00_dev *rt2x00dev); |
407 | void (*link_tuner) (struct rt2x00_dev *rt2x00dev); | 424 | void (*link_tuner) (struct rt2x00_dev *rt2x00dev); |
408 | 425 | ||