diff options
author | Ivo van Doorn <ivdoorn@gmail.com> | 2008-02-25 17:15:13 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-02-28 09:13:10 -0500 |
commit | 53b3f8e47a38f39836da1c9f9d2ea9a9c164c8f4 (patch) | |
tree | aa393f45d18a68eff497534dfa39fa07596e9440 /drivers/net/wireless/rt2x00/rt2x00dev.c | |
parent | 05253c93feb40901d80a0d6f239a0bc78860c679 (diff) |
rt2x00: Fix rt2x00lib_reset_link_tuner()
rt2x00lib_reset_link_tuner() can be called from within
the link tuner itself. This means that it should
_not_ call rt2x00lib_stop_link_tuner() since that will
cause the thread to hang.
Reorder the things that should be done during a
link tuner reset and during a link tuner start.
Also make antenna tuning the last step of the link
tuner since it could possibly reset some statistical
information which we need for average calculation.
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/rt2x00dev.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00dev.c | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 7294c75272d0..0d51f478bcdf 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -61,11 +61,33 @@ EXPORT_SYMBOL_GPL(rt2x00lib_get_ring); | |||
61 | /* | 61 | /* |
62 | * Link tuning handlers | 62 | * Link tuning handlers |
63 | */ | 63 | */ |
64 | static void rt2x00lib_start_link_tuner(struct rt2x00_dev *rt2x00dev) | 64 | void rt2x00lib_reset_link_tuner(struct rt2x00_dev *rt2x00dev) |
65 | { | 65 | { |
66 | if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags)) | ||
67 | return; | ||
68 | |||
69 | /* | ||
70 | * Reset link information. | ||
71 | * Both the currently active vgc level as well as | ||
72 | * the link tuner counter should be reset. Resetting | ||
73 | * the counter is important for devices where the | ||
74 | * device should only perform link tuning during the | ||
75 | * first minute after being enabled. | ||
76 | */ | ||
66 | rt2x00dev->link.count = 0; | 77 | rt2x00dev->link.count = 0; |
67 | rt2x00dev->link.vgc_level = 0; | 78 | rt2x00dev->link.vgc_level = 0; |
68 | 79 | ||
80 | /* | ||
81 | * Reset the link tuner. | ||
82 | */ | ||
83 | rt2x00dev->ops->lib->reset_tuner(rt2x00dev); | ||
84 | } | ||
85 | |||
86 | static void rt2x00lib_start_link_tuner(struct rt2x00_dev *rt2x00dev) | ||
87 | { | ||
88 | /* | ||
89 | * Clear all (possibly) pre-existing quality statistics. | ||
90 | */ | ||
69 | memset(&rt2x00dev->link.qual, 0, sizeof(rt2x00dev->link.qual)); | 91 | memset(&rt2x00dev->link.qual, 0, sizeof(rt2x00dev->link.qual)); |
70 | 92 | ||
71 | /* | 93 | /* |
@@ -79,10 +101,7 @@ static void rt2x00lib_start_link_tuner(struct rt2x00_dev *rt2x00dev) | |||
79 | rt2x00dev->link.qual.rx_percentage = 50; | 101 | rt2x00dev->link.qual.rx_percentage = 50; |
80 | rt2x00dev->link.qual.tx_percentage = 50; | 102 | rt2x00dev->link.qual.tx_percentage = 50; |
81 | 103 | ||
82 | /* | 104 | rt2x00lib_reset_link_tuner(rt2x00dev); |
83 | * Reset the link tuner. | ||
84 | */ | ||
85 | rt2x00dev->ops->lib->reset_tuner(rt2x00dev); | ||
86 | 105 | ||
87 | queue_delayed_work(rt2x00dev->hw->workqueue, | 106 | queue_delayed_work(rt2x00dev->hw->workqueue, |
88 | &rt2x00dev->link.work, LINK_TUNE_INTERVAL); | 107 | &rt2x00dev->link.work, LINK_TUNE_INTERVAL); |
@@ -93,15 +112,6 @@ static void rt2x00lib_stop_link_tuner(struct rt2x00_dev *rt2x00dev) | |||
93 | cancel_delayed_work_sync(&rt2x00dev->link.work); | 112 | cancel_delayed_work_sync(&rt2x00dev->link.work); |
94 | } | 113 | } |
95 | 114 | ||
96 | void rt2x00lib_reset_link_tuner(struct rt2x00_dev *rt2x00dev) | ||
97 | { | ||
98 | if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags)) | ||
99 | return; | ||
100 | |||
101 | rt2x00lib_stop_link_tuner(rt2x00dev); | ||
102 | rt2x00lib_start_link_tuner(rt2x00dev); | ||
103 | } | ||
104 | |||
105 | /* | 115 | /* |
106 | * Ring initialization | 116 | * Ring initialization |
107 | */ | 117 | */ |
@@ -433,17 +443,18 @@ static void rt2x00lib_link_tuner(struct work_struct *work) | |||
433 | rt2x00dev->ops->lib->link_tuner(rt2x00dev); | 443 | rt2x00dev->ops->lib->link_tuner(rt2x00dev); |
434 | 444 | ||
435 | /* | 445 | /* |
436 | * Evaluate antenna setup. | ||
437 | */ | ||
438 | rt2x00lib_evaluate_antenna(rt2x00dev); | ||
439 | |||
440 | /* | ||
441 | * Precalculate a portion of the link signal which is | 446 | * Precalculate a portion of the link signal which is |
442 | * in based on the tx/rx success/failure counters. | 447 | * in based on the tx/rx success/failure counters. |
443 | */ | 448 | */ |
444 | rt2x00lib_precalculate_link_signal(&rt2x00dev->link.qual); | 449 | rt2x00lib_precalculate_link_signal(&rt2x00dev->link.qual); |
445 | 450 | ||
446 | /* | 451 | /* |
452 | * Evaluate antenna setup, make this the last step since this could | ||
453 | * possibly reset some statistics. | ||
454 | */ | ||
455 | rt2x00lib_evaluate_antenna(rt2x00dev); | ||
456 | |||
457 | /* | ||
447 | * Increase tuner counter, and reschedule the next link tuner run. | 458 | * Increase tuner counter, and reschedule the next link tuner run. |
448 | */ | 459 | */ |
449 | rt2x00dev->link.count++; | 460 | rt2x00dev->link.count++; |