blob: c64db0ba7f4085568c707b9010a66aefb4208f36 [file] [log] [blame]
Ivo van Doorn84e31962008-12-20 10:53:29 +01001/*
Ivo van Doorn4e54c712009-01-17 20:42:32 +01002 Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
Ivo van Doorn84e31962008-12-20 10:53:29 +01003 <http://rt2x00.serialmonkey.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the
17 Free Software Foundation, Inc.,
18 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21/*
22 Module: rt2x00lib
23 Abstract: rt2x00 generic link tuning routines.
24 */
25
26#include <linux/kernel.h>
27#include <linux/module.h>
28
29#include "rt2x00.h"
30#include "rt2x00lib.h"
31
Ivo van Doorn5352ff62008-12-20 10:54:54 +010032/*
33 * When we lack RSSI information return something less then -80 to
34 * tell the driver to tune the device to maximum sensitivity.
35 */
36#define DEFAULT_RSSI -128
37
38/*
39 * When no TX/RX percentage could be calculated due to lack of
40 * frames on the air, we fallback to a percentage of 50%.
41 * This will assure we will get at least get some decent value
42 * when the link tuner starts.
43 * The value will be dropped and overwritten with the correct (measured)
44 * value anyway during the first run of the link tuner.
45 */
46#define DEFAULT_PERCENTAGE 50
47
48/*
Lars Ericsson66679a62009-08-08 23:54:51 +020049 * Small helper macro for percentage calculation
50 * This is a very simple macro with the only catch that it will
51 * produce a default value in case no total value was provided.
52 */
53#define PERCENTAGE(__value, __total) \
54 ( (__total) ? (((__value) * 100) / (__total)) : (DEFAULT_PERCENTAGE) )
55
56/*
57 * Helper struct and macro to work with moving/walking averages.
Ivo van Doorn5352ff62008-12-20 10:54:54 +010058 * When adding a value to the average value the following calculation
59 * is needed:
60 *
61 * avg_rssi = ((avg_rssi * 7) + rssi) / 8;
62 *
63 * The advantage of this approach is that we only need 1 variable
64 * to store the average in (No need for a count and a total).
65 * But more importantly, normal average values will over time
66 * move less and less towards newly added values this results
67 * that with link tuning, the device can have a very good RSSI
68 * for a few minutes but when the device is moved away from the AP
69 * the average will not decrease fast enough to compensate.
70 * The walking average compensates this and will move towards
Lars Ericsson66679a62009-08-08 23:54:51 +020071 * the new values correctly allowing a effective link tuning,
72 * the speed of the average moving towards other values depends
73 * on the value for the number of samples. The higher the number
74 * of samples, the slower the average will move.
75 * We use two variables to keep track of the average value to
76 * compensate for the rounding errors. This can be a significant
77 * error (>5dBm) if the factor is too low.
Ivo van Doorn5352ff62008-12-20 10:54:54 +010078 */
Lars Ericsson66679a62009-08-08 23:54:51 +020079#define AVG_SAMPLES 8
80#define AVG_FACTOR 1000
81#define MOVING_AVERAGE(__avg, __val) \
82({ \
83 struct avg_val __new; \
84 __new.avg_weight = \
85 (__avg).avg_weight ? \
86 ((((__avg).avg_weight * ((AVG_SAMPLES) - 1)) + \
87 ((__val) * (AVG_FACTOR))) / \
88 (AVG_SAMPLES) ) : \
89 ((__val) * (AVG_FACTOR)); \
90 __new.avg = __new.avg_weight / (AVG_FACTOR); \
91 __new; \
92})
Ivo van Doorn5352ff62008-12-20 10:54:54 +010093
94/*
95 * For calculating the Signal quality we have determined
96 * the total number of success and failed RX and TX frames.
97 * With the addition of the average RSSI value we can determine
98 * the link quality using the following algorithm:
99 *
100 * rssi_percentage = (avg_rssi * 100) / rssi_offset
101 * rx_percentage = (rx_success * 100) / rx_total
102 * tx_percentage = (tx_success * 100) / tx_total
103 * avg_signal = ((WEIGHT_RSSI * avg_rssi) +
104 * (WEIGHT_TX * tx_percentage) +
105 * (WEIGHT_RX * rx_percentage)) / 100
106 *
107 * This value should then be checked to not be greater then 100.
108 * This means the values of WEIGHT_RSSI, WEIGHT_RX, WEIGHT_TX must
109 * sum up to 100 as well.
110 */
111#define WEIGHT_RSSI 20
112#define WEIGHT_RX 40
113#define WEIGHT_TX 40
114
Ivo van Doorn84e31962008-12-20 10:53:29 +0100115static int rt2x00link_antenna_get_link_rssi(struct rt2x00_dev *rt2x00dev)
116{
117 struct link_ant *ant = &rt2x00dev->link.ant;
118
Lars Ericsson66679a62009-08-08 23:54:51 +0200119 if (ant->rssi_ant.avg && rt2x00dev->link.qual.rx_success)
120 return ant->rssi_ant.avg;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100121 return DEFAULT_RSSI;
122}
123
Lars Ericsson193df182009-08-08 23:54:24 +0200124static int rt2x00link_antenna_get_rssi_history(struct rt2x00_dev *rt2x00dev)
Ivo van Doorn84e31962008-12-20 10:53:29 +0100125{
126 struct link_ant *ant = &rt2x00dev->link.ant;
127
Lars Ericsson193df182009-08-08 23:54:24 +0200128 if (ant->rssi_history)
129 return ant->rssi_history;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100130 return DEFAULT_RSSI;
131}
Ivo van Doorn84e31962008-12-20 10:53:29 +0100132
133static void rt2x00link_antenna_update_rssi_history(struct rt2x00_dev *rt2x00dev,
Ivo van Doorn84e31962008-12-20 10:53:29 +0100134 int rssi)
135{
136 struct link_ant *ant = &rt2x00dev->link.ant;
Lars Ericsson193df182009-08-08 23:54:24 +0200137 ant->rssi_history = rssi;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100138}
Ivo van Doorn84e31962008-12-20 10:53:29 +0100139
140static void rt2x00link_antenna_reset(struct rt2x00_dev *rt2x00dev)
141{
Lars Ericsson66679a62009-08-08 23:54:51 +0200142 rt2x00dev->link.ant.rssi_ant.avg = 0;
143 rt2x00dev->link.ant.rssi_ant.avg_weight = 0;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100144}
145
146static void rt2x00lib_antenna_diversity_sample(struct rt2x00_dev *rt2x00dev)
147{
148 struct link_ant *ant = &rt2x00dev->link.ant;
149 struct antenna_setup new_ant;
Lars Ericsson193df182009-08-08 23:54:24 +0200150 int other_antenna;
151
152 int sample_current = rt2x00link_antenna_get_link_rssi(rt2x00dev);
153 int sample_other = rt2x00link_antenna_get_rssi_history(rt2x00dev);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100154
155 memcpy(&new_ant, &ant->active, sizeof(new_ant));
156
157 /*
158 * We are done sampling. Now we should evaluate the results.
159 */
160 ant->flags &= ~ANTENNA_MODE_SAMPLE;
161
162 /*
163 * During the last period we have sampled the RSSI
Luis Correia49513482009-07-17 21:39:19 +0200164 * from both antennas. It now is time to determine
Ivo van Doorn84e31962008-12-20 10:53:29 +0100165 * which antenna demonstrated the best performance.
166 * When we are already on the antenna with the best
Lars Ericsson193df182009-08-08 23:54:24 +0200167 * performance, just create a good starting point
168 * for the history and we are done.
Ivo van Doorn84e31962008-12-20 10:53:29 +0100169 */
Lars Ericsson193df182009-08-08 23:54:24 +0200170 if (sample_current >= sample_other) {
171 rt2x00link_antenna_update_rssi_history(rt2x00dev,
172 sample_current);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100173 return;
Lars Ericsson193df182009-08-08 23:54:24 +0200174 }
175
176 other_antenna = (ant->active.rx == ANTENNA_A) ? ANTENNA_B : ANTENNA_A;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100177
178 if (ant->flags & ANTENNA_RX_DIVERSITY)
Lars Ericsson193df182009-08-08 23:54:24 +0200179 new_ant.rx = other_antenna;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100180
181 if (ant->flags & ANTENNA_TX_DIVERSITY)
Lars Ericsson193df182009-08-08 23:54:24 +0200182 new_ant.tx = other_antenna;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100183
Lars Ericssoneb87eaa2009-07-18 20:21:52 +0200184 rt2x00lib_config_antenna(rt2x00dev, new_ant);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100185}
186
187static void rt2x00lib_antenna_diversity_eval(struct rt2x00_dev *rt2x00dev)
188{
189 struct link_ant *ant = &rt2x00dev->link.ant;
190 struct antenna_setup new_ant;
191 int rssi_curr;
192 int rssi_old;
193
194 memcpy(&new_ant, &ant->active, sizeof(new_ant));
195
196 /*
197 * Get current RSSI value along with the historical value,
198 * after that update the history with the current value.
199 */
200 rssi_curr = rt2x00link_antenna_get_link_rssi(rt2x00dev);
Lars Ericsson193df182009-08-08 23:54:24 +0200201 rssi_old = rt2x00link_antenna_get_rssi_history(rt2x00dev);
202 rt2x00link_antenna_update_rssi_history(rt2x00dev, rssi_curr);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100203
204 /*
205 * Legacy driver indicates that we should swap antenna's
206 * when the difference in RSSI is greater that 5. This
207 * also should be done when the RSSI was actually better
208 * then the previous sample.
209 * When the difference exceeds the threshold we should
210 * sample the rssi from the other antenna to make a valid
211 * comparison between the 2 antennas.
212 */
213 if (abs(rssi_curr - rssi_old) < 5)
214 return;
215
216 ant->flags |= ANTENNA_MODE_SAMPLE;
217
218 if (ant->flags & ANTENNA_RX_DIVERSITY)
219 new_ant.rx = (new_ant.rx == ANTENNA_A) ? ANTENNA_B : ANTENNA_A;
220
221 if (ant->flags & ANTENNA_TX_DIVERSITY)
222 new_ant.tx = (new_ant.tx == ANTENNA_A) ? ANTENNA_B : ANTENNA_A;
223
Lars Ericssoneb87eaa2009-07-18 20:21:52 +0200224 rt2x00lib_config_antenna(rt2x00dev, new_ant);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100225}
226
Lars Ericsson193df182009-08-08 23:54:24 +0200227static bool rt2x00lib_antenna_diversity(struct rt2x00_dev *rt2x00dev)
Ivo van Doorn84e31962008-12-20 10:53:29 +0100228{
229 struct link_ant *ant = &rt2x00dev->link.ant;
Ivo van Doornbdfa5002009-08-08 23:53:04 +0200230 unsigned int flags = ant->flags;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100231
232 /*
233 * Determine if software diversity is enabled for
234 * either the TX or RX antenna (or both).
235 * Always perform this check since within the link
236 * tuner interval the configuration might have changed.
237 */
Ivo van Doornbdfa5002009-08-08 23:53:04 +0200238 flags &= ~ANTENNA_RX_DIVERSITY;
239 flags &= ~ANTENNA_TX_DIVERSITY;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100240
241 if (rt2x00dev->default_ant.rx == ANTENNA_SW_DIVERSITY)
Ivo van Doornbdfa5002009-08-08 23:53:04 +0200242 flags |= ANTENNA_RX_DIVERSITY;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100243 if (rt2x00dev->default_ant.tx == ANTENNA_SW_DIVERSITY)
Ivo van Doornbdfa5002009-08-08 23:53:04 +0200244 flags |= ANTENNA_TX_DIVERSITY;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100245
246 if (!(ant->flags & ANTENNA_RX_DIVERSITY) &&
247 !(ant->flags & ANTENNA_TX_DIVERSITY)) {
248 ant->flags = 0;
Lars Ericsson193df182009-08-08 23:54:24 +0200249 return true;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100250 }
251
Ivo van Doornbdfa5002009-08-08 23:53:04 +0200252 /* Update flags */
253 ant->flags = flags;
254
Ivo van Doorn84e31962008-12-20 10:53:29 +0100255 /*
256 * If we have only sampled the data over the last period
257 * we should now harvest the data. Otherwise just evaluate
258 * the data. The latter should only be performed once
259 * every 2 seconds.
260 */
Lars Ericsson193df182009-08-08 23:54:24 +0200261 if (ant->flags & ANTENNA_MODE_SAMPLE) {
Ivo van Doorn84e31962008-12-20 10:53:29 +0100262 rt2x00lib_antenna_diversity_sample(rt2x00dev);
Lars Ericsson193df182009-08-08 23:54:24 +0200263 return true;
264 } else if (rt2x00dev->link.count & 1) {
Ivo van Doorn84e31962008-12-20 10:53:29 +0100265 rt2x00lib_antenna_diversity_eval(rt2x00dev);
Lars Ericsson193df182009-08-08 23:54:24 +0200266 return true;
267 }
268
269 return false;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100270}
271
272void rt2x00link_update_stats(struct rt2x00_dev *rt2x00dev,
273 struct sk_buff *skb,
274 struct rxdone_entry_desc *rxdesc)
275{
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100276 struct link *link = &rt2x00dev->link;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100277 struct link_qual *qual = &rt2x00dev->link.qual;
278 struct link_ant *ant = &rt2x00dev->link.ant;
279 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100280
281 /*
282 * Frame was received successfully since non-succesfull
283 * frames would have been dropped by the hardware.
284 */
285 qual->rx_success++;
286
287 /*
288 * We are only interested in quality statistics from
289 * beacons which came from the BSS which we are
290 * associated with.
291 */
292 if (!ieee80211_is_beacon(hdr->frame_control) ||
293 !(rxdesc->dev_flags & RXDONE_MY_BSS))
294 return;
295
296 /*
297 * Update global RSSI
298 */
Lars Ericsson66679a62009-08-08 23:54:51 +0200299 link->avg_rssi = MOVING_AVERAGE(link->avg_rssi, rxdesc->rssi);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100300
301 /*
302 * Update antenna RSSI
303 */
Lars Ericsson66679a62009-08-08 23:54:51 +0200304 ant->rssi_ant = MOVING_AVERAGE(ant->rssi_ant, rxdesc->rssi);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100305}
306
307static void rt2x00link_precalculate_signal(struct rt2x00_dev *rt2x00dev)
308{
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100309 struct link *link = &rt2x00dev->link;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100310 struct link_qual *qual = &rt2x00dev->link.qual;
311
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100312 link->rx_percentage =
313 PERCENTAGE(qual->rx_success, qual->rx_failed + qual->rx_success);
314 link->tx_percentage =
315 PERCENTAGE(qual->tx_success, qual->tx_failed + qual->tx_success);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100316}
317
318int rt2x00link_calculate_signal(struct rt2x00_dev *rt2x00dev, int rssi)
319{
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100320 struct link *link = &rt2x00dev->link;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100321 int rssi_percentage = 0;
322 int signal;
323
324 /*
325 * We need a positive value for the RSSI.
326 */
327 if (rssi < 0)
328 rssi += rt2x00dev->rssi_offset;
329
330 /*
331 * Calculate the different percentages,
332 * which will be used for the signal.
333 */
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100334 rssi_percentage = PERCENTAGE(rssi, rt2x00dev->rssi_offset);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100335
336 /*
337 * Add the individual percentages and use the WEIGHT
338 * defines to calculate the current link signal.
339 */
340 signal = ((WEIGHT_RSSI * rssi_percentage) +
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100341 (WEIGHT_TX * link->tx_percentage) +
342 (WEIGHT_RX * link->rx_percentage)) / 100;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100343
344 return max_t(int, signal, 100);
345}
346
347void rt2x00link_start_tuner(struct rt2x00_dev *rt2x00dev)
348{
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100349 struct link *link = &rt2x00dev->link;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100350
351 /*
352 * Link tuning should only be performed when
353 * an active sta or master interface exists.
354 * Single monitor mode interfaces should never have
355 * work with link tuners.
356 */
357 if (!rt2x00dev->intf_ap_count && !rt2x00dev->intf_sta_count)
358 return;
359
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100360 link->rx_percentage = DEFAULT_PERCENTAGE;
361 link->tx_percentage = DEFAULT_PERCENTAGE;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100362
363 rt2x00link_reset_tuner(rt2x00dev, false);
364
Luis R. Rodriguez42935ec2009-07-29 20:08:07 -0400365 ieee80211_queue_delayed_work(rt2x00dev->hw,
366 &link->work, LINK_TUNE_INTERVAL);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100367}
368
369void rt2x00link_stop_tuner(struct rt2x00_dev *rt2x00dev)
370{
371 cancel_delayed_work_sync(&rt2x00dev->link.work);
372}
373
374void rt2x00link_reset_tuner(struct rt2x00_dev *rt2x00dev, bool antenna)
375{
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100376 struct link_qual *qual = &rt2x00dev->link.qual;
377
Ivo van Doorn84e31962008-12-20 10:53:29 +0100378 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
379 return;
380
381 /*
382 * Reset link information.
383 * Both the currently active vgc level as well as
384 * the link tuner counter should be reset. Resetting
385 * the counter is important for devices where the
386 * device should only perform link tuning during the
387 * first minute after being enabled.
388 */
389 rt2x00dev->link.count = 0;
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100390 memset(qual, 0, sizeof(*qual));
Ivo van Doorn84e31962008-12-20 10:53:29 +0100391
392 /*
393 * Reset the link tuner.
394 */
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100395 rt2x00dev->ops->lib->reset_tuner(rt2x00dev, qual);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100396
397 if (antenna)
398 rt2x00link_antenna_reset(rt2x00dev);
399}
400
Ivo van Doorna57e2e82009-03-28 20:51:41 +0100401static void rt2x00link_reset_qual(struct rt2x00_dev *rt2x00dev)
Ivo van Doorn64abd802009-03-01 17:42:00 +0100402{
403 struct link_qual *qual = &rt2x00dev->link.qual;
404
405 qual->rx_success = 0;
406 qual->rx_failed = 0;
407 qual->tx_success = 0;
408 qual->tx_failed = 0;
409}
410
Ivo van Doorn84e31962008-12-20 10:53:29 +0100411static void rt2x00link_tuner(struct work_struct *work)
412{
413 struct rt2x00_dev *rt2x00dev =
414 container_of(work, struct rt2x00_dev, link.work.work);
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100415 struct link *link = &rt2x00dev->link;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100416 struct link_qual *qual = &rt2x00dev->link.qual;
417
418 /*
419 * When the radio is shutting down we should
420 * immediately cease all link tuning.
421 */
422 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
423 return;
424
425 /*
426 * Update statistics.
427 */
428 rt2x00dev->ops->lib->link_stats(rt2x00dev, qual);
429 rt2x00dev->low_level_stats.dot11FCSErrorCount += qual->rx_failed;
430
431 /*
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100432 * Update quality RSSI for link tuning,
433 * when we have received some frames and we managed to
434 * collect the RSSI data we could use this. Otherwise we
435 * must fallback to the default RSSI value.
436 */
Lars Ericsson66679a62009-08-08 23:54:51 +0200437 if (!link->avg_rssi.avg || !qual->rx_success)
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100438 qual->rssi = DEFAULT_RSSI;
439 else
Lars Ericsson66679a62009-08-08 23:54:51 +0200440 qual->rssi = link->avg_rssi.avg;
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100441
442 /*
Ivo van Doorn84e31962008-12-20 10:53:29 +0100443 * Only perform the link tuning when Link tuning
444 * has been enabled (This could have been disabled from the EEPROM).
445 */
446 if (!test_bit(CONFIG_DISABLE_LINK_TUNING, &rt2x00dev->flags))
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100447 rt2x00dev->ops->lib->link_tuner(rt2x00dev, qual, link->count);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100448
449 /*
450 * Precalculate a portion of the link signal which is
451 * in based on the tx/rx success/failure counters.
452 */
453 rt2x00link_precalculate_signal(rt2x00dev);
454
455 /*
456 * Send a signal to the led to update the led signal strength.
457 */
Lars Ericsson66679a62009-08-08 23:54:51 +0200458 rt2x00leds_led_quality(rt2x00dev, qual->rssi);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100459
460 /*
Lars Ericsson193df182009-08-08 23:54:24 +0200461 * Evaluate antenna setup, make this the last step when
462 * rt2x00lib_antenna_diversity made changes the quality
463 * statistics will be reset.
Ivo van Doorn84e31962008-12-20 10:53:29 +0100464 */
Lars Ericsson193df182009-08-08 23:54:24 +0200465 if (rt2x00lib_antenna_diversity(rt2x00dev))
466 rt2x00link_reset_qual(rt2x00dev);
Ivo van Doorn64abd802009-03-01 17:42:00 +0100467
468 /*
Ivo van Doorn84e31962008-12-20 10:53:29 +0100469 * Increase tuner counter, and reschedule the next link tuner run.
470 */
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100471 link->count++;
Luis R. Rodriguez42935ec2009-07-29 20:08:07 -0400472 ieee80211_queue_delayed_work(rt2x00dev->hw,
473 &link->work, LINK_TUNE_INTERVAL);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100474}
475
476void rt2x00link_register(struct rt2x00_dev *rt2x00dev)
477{
478 INIT_DELAYED_WORK(&rt2x00dev->link.work, rt2x00link_tuner);
479}