blob: 29abfdeb0b65bdaba82dde873c10fb5a5113ad57 [file] [log] [blame]
Ivo van Doorn84e31962008-12-20 10:53:29 +01001/*
Gertjan van Wingerde9c9a0d12009-11-08 16:39:55 +01002 Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
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/*
Lars Ericsson66679a62009-08-08 23:54:51 +020039 * Helper struct and macro to work with moving/walking averages.
Ivo van Doorn5352ff62008-12-20 10:54:54 +010040 * When adding a value to the average value the following calculation
41 * is needed:
42 *
43 * avg_rssi = ((avg_rssi * 7) + rssi) / 8;
44 *
45 * The advantage of this approach is that we only need 1 variable
46 * to store the average in (No need for a count and a total).
47 * But more importantly, normal average values will over time
48 * move less and less towards newly added values this results
49 * that with link tuning, the device can have a very good RSSI
50 * for a few minutes but when the device is moved away from the AP
51 * the average will not decrease fast enough to compensate.
52 * The walking average compensates this and will move towards
Lars Ericsson66679a62009-08-08 23:54:51 +020053 * the new values correctly allowing a effective link tuning,
54 * the speed of the average moving towards other values depends
55 * on the value for the number of samples. The higher the number
56 * of samples, the slower the average will move.
57 * We use two variables to keep track of the average value to
58 * compensate for the rounding errors. This can be a significant
59 * error (>5dBm) if the factor is too low.
Ivo van Doorn5352ff62008-12-20 10:54:54 +010060 */
Lars Ericsson66679a62009-08-08 23:54:51 +020061#define AVG_SAMPLES 8
62#define AVG_FACTOR 1000
63#define MOVING_AVERAGE(__avg, __val) \
64({ \
65 struct avg_val __new; \
66 __new.avg_weight = \
67 (__avg).avg_weight ? \
68 ((((__avg).avg_weight * ((AVG_SAMPLES) - 1)) + \
69 ((__val) * (AVG_FACTOR))) / \
Mark Einon027e8fd2010-11-06 15:47:09 +010070 (AVG_SAMPLES)) : \
Lars Ericsson66679a62009-08-08 23:54:51 +020071 ((__val) * (AVG_FACTOR)); \
72 __new.avg = __new.avg_weight / (AVG_FACTOR); \
73 __new; \
74})
Ivo van Doorn5352ff62008-12-20 10:54:54 +010075
Ivo van Doorn84e31962008-12-20 10:53:29 +010076static int rt2x00link_antenna_get_link_rssi(struct rt2x00_dev *rt2x00dev)
77{
78 struct link_ant *ant = &rt2x00dev->link.ant;
79
Lars Ericsson66679a62009-08-08 23:54:51 +020080 if (ant->rssi_ant.avg && rt2x00dev->link.qual.rx_success)
81 return ant->rssi_ant.avg;
Ivo van Doorn84e31962008-12-20 10:53:29 +010082 return DEFAULT_RSSI;
83}
84
Lars Ericsson193df182009-08-08 23:54:24 +020085static int rt2x00link_antenna_get_rssi_history(struct rt2x00_dev *rt2x00dev)
Ivo van Doorn84e31962008-12-20 10:53:29 +010086{
87 struct link_ant *ant = &rt2x00dev->link.ant;
88
Lars Ericsson193df182009-08-08 23:54:24 +020089 if (ant->rssi_history)
90 return ant->rssi_history;
Ivo van Doorn84e31962008-12-20 10:53:29 +010091 return DEFAULT_RSSI;
92}
Ivo van Doorn84e31962008-12-20 10:53:29 +010093
94static void rt2x00link_antenna_update_rssi_history(struct rt2x00_dev *rt2x00dev,
Ivo van Doorn84e31962008-12-20 10:53:29 +010095 int rssi)
96{
97 struct link_ant *ant = &rt2x00dev->link.ant;
Lars Ericsson193df182009-08-08 23:54:24 +020098 ant->rssi_history = rssi;
Ivo van Doorn84e31962008-12-20 10:53:29 +010099}
Ivo van Doorn84e31962008-12-20 10:53:29 +0100100
101static void rt2x00link_antenna_reset(struct rt2x00_dev *rt2x00dev)
102{
Lars Ericsson66679a62009-08-08 23:54:51 +0200103 rt2x00dev->link.ant.rssi_ant.avg = 0;
104 rt2x00dev->link.ant.rssi_ant.avg_weight = 0;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100105}
106
107static void rt2x00lib_antenna_diversity_sample(struct rt2x00_dev *rt2x00dev)
108{
109 struct link_ant *ant = &rt2x00dev->link.ant;
110 struct antenna_setup new_ant;
Lars Ericsson193df182009-08-08 23:54:24 +0200111 int other_antenna;
112
113 int sample_current = rt2x00link_antenna_get_link_rssi(rt2x00dev);
114 int sample_other = rt2x00link_antenna_get_rssi_history(rt2x00dev);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100115
116 memcpy(&new_ant, &ant->active, sizeof(new_ant));
117
118 /*
119 * We are done sampling. Now we should evaluate the results.
120 */
121 ant->flags &= ~ANTENNA_MODE_SAMPLE;
122
123 /*
124 * During the last period we have sampled the RSSI
Luis Correia49513482009-07-17 21:39:19 +0200125 * from both antennas. It now is time to determine
Ivo van Doorn84e31962008-12-20 10:53:29 +0100126 * which antenna demonstrated the best performance.
127 * When we are already on the antenna with the best
Lars Ericsson193df182009-08-08 23:54:24 +0200128 * performance, just create a good starting point
129 * for the history and we are done.
Ivo van Doorn84e31962008-12-20 10:53:29 +0100130 */
Lars Ericsson193df182009-08-08 23:54:24 +0200131 if (sample_current >= sample_other) {
132 rt2x00link_antenna_update_rssi_history(rt2x00dev,
133 sample_current);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100134 return;
Lars Ericsson193df182009-08-08 23:54:24 +0200135 }
136
137 other_antenna = (ant->active.rx == ANTENNA_A) ? ANTENNA_B : ANTENNA_A;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100138
139 if (ant->flags & ANTENNA_RX_DIVERSITY)
Lars Ericsson193df182009-08-08 23:54:24 +0200140 new_ant.rx = other_antenna;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100141
142 if (ant->flags & ANTENNA_TX_DIVERSITY)
Lars Ericsson193df182009-08-08 23:54:24 +0200143 new_ant.tx = other_antenna;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100144
Lars Ericssoneb87eaa2009-07-18 20:21:52 +0200145 rt2x00lib_config_antenna(rt2x00dev, new_ant);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100146}
147
148static void rt2x00lib_antenna_diversity_eval(struct rt2x00_dev *rt2x00dev)
149{
150 struct link_ant *ant = &rt2x00dev->link.ant;
151 struct antenna_setup new_ant;
152 int rssi_curr;
153 int rssi_old;
154
155 memcpy(&new_ant, &ant->active, sizeof(new_ant));
156
157 /*
158 * Get current RSSI value along with the historical value,
159 * after that update the history with the current value.
160 */
161 rssi_curr = rt2x00link_antenna_get_link_rssi(rt2x00dev);
Lars Ericsson193df182009-08-08 23:54:24 +0200162 rssi_old = rt2x00link_antenna_get_rssi_history(rt2x00dev);
163 rt2x00link_antenna_update_rssi_history(rt2x00dev, rssi_curr);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100164
165 /*
166 * Legacy driver indicates that we should swap antenna's
167 * when the difference in RSSI is greater that 5. This
168 * also should be done when the RSSI was actually better
169 * then the previous sample.
170 * When the difference exceeds the threshold we should
171 * sample the rssi from the other antenna to make a valid
172 * comparison between the 2 antennas.
173 */
174 if (abs(rssi_curr - rssi_old) < 5)
175 return;
176
177 ant->flags |= ANTENNA_MODE_SAMPLE;
178
179 if (ant->flags & ANTENNA_RX_DIVERSITY)
180 new_ant.rx = (new_ant.rx == ANTENNA_A) ? ANTENNA_B : ANTENNA_A;
181
182 if (ant->flags & ANTENNA_TX_DIVERSITY)
183 new_ant.tx = (new_ant.tx == ANTENNA_A) ? ANTENNA_B : ANTENNA_A;
184
Lars Ericssoneb87eaa2009-07-18 20:21:52 +0200185 rt2x00lib_config_antenna(rt2x00dev, new_ant);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100186}
187
Lars Ericsson193df182009-08-08 23:54:24 +0200188static bool rt2x00lib_antenna_diversity(struct rt2x00_dev *rt2x00dev)
Ivo van Doorn84e31962008-12-20 10:53:29 +0100189{
190 struct link_ant *ant = &rt2x00dev->link.ant;
191
192 /*
193 * Determine if software diversity is enabled for
194 * either the TX or RX antenna (or both).
195 * Always perform this check since within the link
196 * tuner interval the configuration might have changed.
197 */
Lars Ericsson85f4d642010-09-08 20:55:36 +0200198 ant->flags &= ~ANTENNA_RX_DIVERSITY;
199 ant->flags &= ~ANTENNA_TX_DIVERSITY;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100200
201 if (rt2x00dev->default_ant.rx == ANTENNA_SW_DIVERSITY)
Lars Ericsson85f4d642010-09-08 20:55:36 +0200202 ant->flags |= ANTENNA_RX_DIVERSITY;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100203 if (rt2x00dev->default_ant.tx == ANTENNA_SW_DIVERSITY)
Lars Ericsson85f4d642010-09-08 20:55:36 +0200204 ant->flags |= ANTENNA_TX_DIVERSITY;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100205
206 if (!(ant->flags & ANTENNA_RX_DIVERSITY) &&
207 !(ant->flags & ANTENNA_TX_DIVERSITY)) {
208 ant->flags = 0;
Lars Ericsson193df182009-08-08 23:54:24 +0200209 return true;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100210 }
211
212 /*
213 * If we have only sampled the data over the last period
214 * we should now harvest the data. Otherwise just evaluate
215 * the data. The latter should only be performed once
216 * every 2 seconds.
217 */
Lars Ericsson193df182009-08-08 23:54:24 +0200218 if (ant->flags & ANTENNA_MODE_SAMPLE) {
Ivo van Doorn84e31962008-12-20 10:53:29 +0100219 rt2x00lib_antenna_diversity_sample(rt2x00dev);
Lars Ericsson193df182009-08-08 23:54:24 +0200220 return true;
221 } else if (rt2x00dev->link.count & 1) {
Ivo van Doorn84e31962008-12-20 10:53:29 +0100222 rt2x00lib_antenna_diversity_eval(rt2x00dev);
Lars Ericsson193df182009-08-08 23:54:24 +0200223 return true;
224 }
225
226 return false;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100227}
228
229void rt2x00link_update_stats(struct rt2x00_dev *rt2x00dev,
230 struct sk_buff *skb,
231 struct rxdone_entry_desc *rxdesc)
232{
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100233 struct link *link = &rt2x00dev->link;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100234 struct link_qual *qual = &rt2x00dev->link.qual;
235 struct link_ant *ant = &rt2x00dev->link.ant;
236 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100237
238 /*
Helmut Schaaa23c2202010-10-09 13:33:16 +0200239 * No need to update the stats for !=STA interfaces
240 */
241 if (!rt2x00dev->intf_sta_count)
242 return;
243
244 /*
Ivo van Doorn84e31962008-12-20 10:53:29 +0100245 * Frame was received successfully since non-succesfull
246 * frames would have been dropped by the hardware.
247 */
248 qual->rx_success++;
249
250 /*
251 * We are only interested in quality statistics from
252 * beacons which came from the BSS which we are
253 * associated with.
254 */
255 if (!ieee80211_is_beacon(hdr->frame_control) ||
256 !(rxdesc->dev_flags & RXDONE_MY_BSS))
257 return;
258
259 /*
260 * Update global RSSI
261 */
Lars Ericsson66679a62009-08-08 23:54:51 +0200262 link->avg_rssi = MOVING_AVERAGE(link->avg_rssi, rxdesc->rssi);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100263
264 /*
265 * Update antenna RSSI
266 */
Lars Ericsson66679a62009-08-08 23:54:51 +0200267 ant->rssi_ant = MOVING_AVERAGE(ant->rssi_ant, rxdesc->rssi);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100268}
269
Ivo van Doorn84e31962008-12-20 10:53:29 +0100270void rt2x00link_start_tuner(struct rt2x00_dev *rt2x00dev)
271{
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100272 struct link *link = &rt2x00dev->link;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100273
274 /*
275 * Link tuning should only be performed when
Helmut Schaa8654b792010-06-29 21:47:37 +0200276 * an active sta interface exists. AP interfaces
277 * don't need link tuning and monitor mode interfaces
278 * should never have to work with link tuners.
Ivo van Doorn84e31962008-12-20 10:53:29 +0100279 */
Helmut Schaa8654b792010-06-29 21:47:37 +0200280 if (!rt2x00dev->intf_sta_count)
Ivo van Doorn84e31962008-12-20 10:53:29 +0100281 return;
282
Ivo van Doornd8147f92010-07-11 12:24:47 +0200283 /**
284 * While scanning, link tuning is disabled. By default
285 * the most sensitive settings will be used to make sure
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300286 * that all beacons and probe responses will be received
Ivo van Doornd8147f92010-07-11 12:24:47 +0200287 * during the scan.
288 */
289 if (test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags))
290 return;
291
Ivo van Doorn84e31962008-12-20 10:53:29 +0100292 rt2x00link_reset_tuner(rt2x00dev, false);
293
Sean Cross66f84d62009-11-05 20:22:03 +0100294 if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
295 ieee80211_queue_delayed_work(rt2x00dev->hw,
296 &link->work, LINK_TUNE_INTERVAL);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100297}
298
299void rt2x00link_stop_tuner(struct rt2x00_dev *rt2x00dev)
300{
301 cancel_delayed_work_sync(&rt2x00dev->link.work);
302}
303
304void rt2x00link_reset_tuner(struct rt2x00_dev *rt2x00dev, bool antenna)
305{
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100306 struct link_qual *qual = &rt2x00dev->link.qual;
Ivo van Doorn223dcc22010-07-11 12:25:17 +0200307 u8 vgc_level = qual->vgc_level_reg;
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100308
Ivo van Doorn84e31962008-12-20 10:53:29 +0100309 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
310 return;
311
312 /*
313 * Reset link information.
314 * Both the currently active vgc level as well as
315 * the link tuner counter should be reset. Resetting
316 * the counter is important for devices where the
317 * device should only perform link tuning during the
318 * first minute after being enabled.
319 */
320 rt2x00dev->link.count = 0;
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100321 memset(qual, 0, sizeof(*qual));
Ivo van Doorn84e31962008-12-20 10:53:29 +0100322
323 /*
Ivo van Doorn223dcc22010-07-11 12:25:17 +0200324 * Restore the VGC level as stored in the registers,
325 * the driver can use this to determine if the register
326 * must be updated during reset or not.
327 */
328 qual->vgc_level_reg = vgc_level;
329
330 /*
Ivo van Doorn84e31962008-12-20 10:53:29 +0100331 * Reset the link tuner.
332 */
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100333 rt2x00dev->ops->lib->reset_tuner(rt2x00dev, qual);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100334
335 if (antenna)
336 rt2x00link_antenna_reset(rt2x00dev);
337}
338
Ivo van Doorna57e2e82009-03-28 20:51:41 +0100339static void rt2x00link_reset_qual(struct rt2x00_dev *rt2x00dev)
Ivo van Doorn64abd802009-03-01 17:42:00 +0100340{
341 struct link_qual *qual = &rt2x00dev->link.qual;
342
343 qual->rx_success = 0;
344 qual->rx_failed = 0;
345 qual->tx_success = 0;
346 qual->tx_failed = 0;
347}
348
Ivo van Doorn84e31962008-12-20 10:53:29 +0100349static void rt2x00link_tuner(struct work_struct *work)
350{
351 struct rt2x00_dev *rt2x00dev =
352 container_of(work, struct rt2x00_dev, link.work.work);
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100353 struct link *link = &rt2x00dev->link;
Ivo van Doorn84e31962008-12-20 10:53:29 +0100354 struct link_qual *qual = &rt2x00dev->link.qual;
355
356 /*
357 * When the radio is shutting down we should
358 * immediately cease all link tuning.
359 */
Ivo van Doornd8147f92010-07-11 12:24:47 +0200360 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags) ||
361 test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags))
Ivo van Doorn84e31962008-12-20 10:53:29 +0100362 return;
363
364 /*
365 * Update statistics.
366 */
367 rt2x00dev->ops->lib->link_stats(rt2x00dev, qual);
368 rt2x00dev->low_level_stats.dot11FCSErrorCount += qual->rx_failed;
369
370 /*
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100371 * Update quality RSSI for link tuning,
372 * when we have received some frames and we managed to
373 * collect the RSSI data we could use this. Otherwise we
374 * must fallback to the default RSSI value.
375 */
Lars Ericsson66679a62009-08-08 23:54:51 +0200376 if (!link->avg_rssi.avg || !qual->rx_success)
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100377 qual->rssi = DEFAULT_RSSI;
378 else
Lars Ericsson66679a62009-08-08 23:54:51 +0200379 qual->rssi = link->avg_rssi.avg;
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100380
381 /*
Ivo van Doorn27df2a92010-07-11 12:24:22 +0200382 * Check if link tuning is supported by the hardware, some hardware
383 * do not support link tuning at all, while other devices can disable
384 * the feature from the EEPROM.
Ivo van Doorn84e31962008-12-20 10:53:29 +0100385 */
Ivo van Doorn27df2a92010-07-11 12:24:22 +0200386 if (test_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags))
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100387 rt2x00dev->ops->lib->link_tuner(rt2x00dev, qual, link->count);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100388
389 /*
Ivo van Doorn84e31962008-12-20 10:53:29 +0100390 * Send a signal to the led to update the led signal strength.
391 */
Lars Ericsson66679a62009-08-08 23:54:51 +0200392 rt2x00leds_led_quality(rt2x00dev, qual->rssi);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100393
394 /*
Lars Ericsson193df182009-08-08 23:54:24 +0200395 * Evaluate antenna setup, make this the last step when
396 * rt2x00lib_antenna_diversity made changes the quality
397 * statistics will be reset.
Ivo van Doorn84e31962008-12-20 10:53:29 +0100398 */
Lars Ericsson193df182009-08-08 23:54:24 +0200399 if (rt2x00lib_antenna_diversity(rt2x00dev))
400 rt2x00link_reset_qual(rt2x00dev);
Ivo van Doorn64abd802009-03-01 17:42:00 +0100401
402 /*
Ivo van Doorn84e31962008-12-20 10:53:29 +0100403 * Increase tuner counter, and reschedule the next link tuner run.
404 */
Ivo van Doorn5352ff62008-12-20 10:54:54 +0100405 link->count++;
Sean Cross66f84d62009-11-05 20:22:03 +0100406
407 if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
408 ieee80211_queue_delayed_work(rt2x00dev->hw,
409 &link->work, LINK_TUNE_INTERVAL);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100410}
411
Ivo van Doornc965c742010-07-11 12:25:46 +0200412void rt2x00link_start_watchdog(struct rt2x00_dev *rt2x00dev)
413{
414 struct link *link = &rt2x00dev->link;
415
416 if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) ||
417 !test_bit(DRIVER_SUPPORT_WATCHDOG, &rt2x00dev->flags))
418 return;
419
Ivo van Doorn0439f532011-01-30 13:24:05 +0100420 ieee80211_queue_delayed_work(rt2x00dev->hw,
421 &link->watchdog_work, WATCHDOG_INTERVAL);
Ivo van Doornc965c742010-07-11 12:25:46 +0200422}
423
424void rt2x00link_stop_watchdog(struct rt2x00_dev *rt2x00dev)
425{
426 cancel_delayed_work_sync(&rt2x00dev->link.watchdog_work);
427}
428
429static void rt2x00link_watchdog(struct work_struct *work)
430{
431 struct rt2x00_dev *rt2x00dev =
432 container_of(work, struct rt2x00_dev, link.watchdog_work.work);
433 struct link *link = &rt2x00dev->link;
434
435 /*
436 * When the radio is shutting down we should
437 * immediately cease the watchdog monitoring.
438 */
439 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
440 return;
441
442 rt2x00dev->ops->lib->watchdog(rt2x00dev);
443
444 if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
Ivo van Doorn0439f532011-01-30 13:24:05 +0100445 ieee80211_queue_delayed_work(rt2x00dev->hw,
446 &link->watchdog_work,
447 WATCHDOG_INTERVAL);
Ivo van Doornc965c742010-07-11 12:25:46 +0200448}
449
Ivo van Doorn84e31962008-12-20 10:53:29 +0100450void rt2x00link_register(struct rt2x00_dev *rt2x00dev)
451{
Ivo van Doornc965c742010-07-11 12:25:46 +0200452 INIT_DELAYED_WORK(&rt2x00dev->link.watchdog_work, rt2x00link_watchdog);
Ivo van Doorn84e31962008-12-20 10:53:29 +0100453 INIT_DELAYED_WORK(&rt2x00dev->link.work, rt2x00link_tuner);
454}