aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2009-03-01 11:42:00 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-03-05 14:39:37 -0500
commit64abd80330baba9d87df2b952a7eec5af5158470 (patch)
tree83aeeab4cdbd58d956ed1f89db729940856ae4d5 /drivers/net/wireless/rt2x00
parent14d2aac580993ac8faeac0d903207e316c0881c3 (diff)
rt2x00: Fix SW antenna diversity
Software antenna tuning is broken because of an function ordering problem during rt2x00link_tuner(). rt2x00link_precalculate_signal() rt2x00leds_led_quality() rt2x00lib_antenna_diversity() rt2x00link_precalculate_signal() will reset the quality TX/RX counters, however rt2x00lib_antenna_diversity() requires the RX counter to see what RSSI value must be used for a particular antenna. We can't change the ordering since rt2x00lib_antenna_diversity() might reset other statistics which are needed by the function called earlier. Move the reset of the quality TX/RX counters into a seperate function and move the call to after rt2x00lib_antenna_diversity(). 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')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00link.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00link.c b/drivers/net/wireless/rt2x00/rt2x00link.c
index 9223a6d1f1d0..7eb5cd7e5f32 100644
--- a/drivers/net/wireless/rt2x00/rt2x00link.c
+++ b/drivers/net/wireless/rt2x00/rt2x00link.c
@@ -302,11 +302,6 @@ static void rt2x00link_precalculate_signal(struct rt2x00_dev *rt2x00dev)
302 PERCENTAGE(qual->rx_success, qual->rx_failed + qual->rx_success); 302 PERCENTAGE(qual->rx_success, qual->rx_failed + qual->rx_success);
303 link->tx_percentage = 303 link->tx_percentage =
304 PERCENTAGE(qual->tx_success, qual->tx_failed + qual->tx_success); 304 PERCENTAGE(qual->tx_success, qual->tx_failed + qual->tx_success);
305
306 qual->rx_success = 0;
307 qual->rx_failed = 0;
308 qual->tx_success = 0;
309 qual->tx_failed = 0;
310} 305}
311 306
312int rt2x00link_calculate_signal(struct rt2x00_dev *rt2x00dev, int rssi) 307int rt2x00link_calculate_signal(struct rt2x00_dev *rt2x00dev, int rssi)
@@ -392,6 +387,16 @@ void rt2x00link_reset_tuner(struct rt2x00_dev *rt2x00dev, bool antenna)
392 rt2x00link_antenna_reset(rt2x00dev); 387 rt2x00link_antenna_reset(rt2x00dev);
393} 388}
394 389
390void rt2x00link_reset_qual(struct rt2x00_dev *rt2x00dev)
391{
392 struct link_qual *qual = &rt2x00dev->link.qual;
393
394 qual->rx_success = 0;
395 qual->rx_failed = 0;
396 qual->tx_success = 0;
397 qual->tx_failed = 0;
398}
399
395static void rt2x00link_tuner(struct work_struct *work) 400static void rt2x00link_tuner(struct work_struct *work)
396{ 401{
397 struct rt2x00_dev *rt2x00dev = 402 struct rt2x00_dev *rt2x00dev =
@@ -448,6 +453,11 @@ static void rt2x00link_tuner(struct work_struct *work)
448 rt2x00lib_antenna_diversity(rt2x00dev); 453 rt2x00lib_antenna_diversity(rt2x00dev);
449 454
450 /* 455 /*
456 * Reset the quality counters which recounted during each period.
457 */
458 rt2x00link_reset_qual(rt2x00dev);
459
460 /*
451 * Increase tuner counter, and reschedule the next link tuner run. 461 * Increase tuner counter, and reschedule the next link tuner run.
452 */ 462 */
453 link->count++; 463 link->count++;