1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25#ifndef RT2X00LIB_H
26#define RT2X00LIB_H
27
28
29
30
31#define WATCHDOG_INTERVAL round_jiffies_relative(HZ)
32#define LINK_TUNE_SECONDS 1
33#define LINK_TUNE_INTERVAL round_jiffies_relative(LINK_TUNE_SECONDS * HZ)
34#define AGC_SECONDS 4
35#define VCO_SECONDS 10
36
37
38
39
40struct rt2x00_rate {
41 unsigned short flags;
42#define DEV_RATE_CCK 0x0001
43#define DEV_RATE_OFDM 0x0002
44#define DEV_RATE_SHORT_PREAMBLE 0x0004
45
46 unsigned short bitrate;
47 unsigned short ratemask;
48
49 unsigned short plcp;
50 unsigned short mcs;
51};
52
53extern const struct rt2x00_rate rt2x00_supported_rates[12];
54
55static inline const struct rt2x00_rate *rt2x00_get_rate(const u16 hw_value)
56{
57 return &rt2x00_supported_rates[hw_value & 0xff];
58}
59
60#define RATE_MCS(__mode, __mcs) \
61 ((((__mode) & 0x00ff) << 8) | ((__mcs) & 0x00ff))
62
63static inline int rt2x00_get_rate_mcs(const u16 mcs_value)
64{
65 return (mcs_value & 0x00ff);
66}
67
68
69
70
71int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev);
72void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev);
73
74
75
76
77int rt2x00lib_start(struct rt2x00_dev *rt2x00dev);
78void rt2x00lib_stop(struct rt2x00_dev *rt2x00dev);
79
80
81
82
83void rt2x00lib_config_intf(struct rt2x00_dev *rt2x00dev,
84 struct rt2x00_intf *intf,
85 enum nl80211_iftype type,
86 const u8 *mac, const u8 *bssid);
87void rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev,
88 struct rt2x00_intf *intf,
89 struct ieee80211_bss_conf *conf,
90 u32 changed);
91void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
92 struct antenna_setup ant);
93void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
94 struct ieee80211_conf *conf,
95 const unsigned int changed_flags);
96
97
98
99
100
101
102
103
104
105struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry, gfp_t gfp);
106
107
108
109
110
111void rt2x00queue_free_skb(struct queue_entry *entry);
112
113
114
115
116
117
118
119
120void rt2x00queue_align_frame(struct sk_buff *skb);
121
122
123
124
125
126
127
128
129void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int header_length);
130
131
132
133
134
135
136
137
138
139void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int header_length);
140
141
142
143
144
145
146
147int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
148 struct ieee80211_sta *sta, bool local);
149
150
151
152
153
154
155
156int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
157 struct ieee80211_vif *vif);
158
159
160
161
162
163
164
165int rt2x00queue_update_beacon_locked(struct rt2x00_dev *rt2x00dev,
166 struct ieee80211_vif *vif);
167
168
169
170
171
172
173int rt2x00queue_clear_beacon(struct rt2x00_dev *rt2x00dev,
174 struct ieee80211_vif *vif);
175
176
177
178
179
180
181
182
183
184
185void rt2x00queue_index_inc(struct queue_entry *entry, enum queue_index index);
186
187
188
189
190
191
192
193
194
195void rt2x00queue_init_queues(struct rt2x00_dev *rt2x00dev);
196
197int rt2x00queue_initialize(struct rt2x00_dev *rt2x00dev);
198void rt2x00queue_uninitialize(struct rt2x00_dev *rt2x00dev);
199int rt2x00queue_allocate(struct rt2x00_dev *rt2x00dev);
200void rt2x00queue_free(struct rt2x00_dev *rt2x00dev);
201
202
203
204
205
206
207
208
209
210
211void rt2x00link_update_stats(struct rt2x00_dev *rt2x00dev,
212 struct sk_buff *skb,
213 struct rxdone_entry_desc *rxdesc);
214
215
216
217
218
219
220
221
222
223void rt2x00link_start_tuner(struct rt2x00_dev *rt2x00dev);
224
225
226
227
228
229
230
231
232void rt2x00link_stop_tuner(struct rt2x00_dev *rt2x00dev);
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253void rt2x00link_reset_tuner(struct rt2x00_dev *rt2x00dev, bool antenna);
254
255
256
257
258
259
260
261
262
263void rt2x00link_start_watchdog(struct rt2x00_dev *rt2x00dev);
264
265
266
267
268
269
270
271
272void rt2x00link_stop_watchdog(struct rt2x00_dev *rt2x00dev);
273
274
275
276
277
278
279
280
281void rt2x00link_register(struct rt2x00_dev *rt2x00dev);
282
283
284
285
286#ifdef CONFIG_RT2X00_LIB_FIRMWARE
287int rt2x00lib_load_firmware(struct rt2x00_dev *rt2x00dev);
288void rt2x00lib_free_firmware(struct rt2x00_dev *rt2x00dev);
289#else
290static inline int rt2x00lib_load_firmware(struct rt2x00_dev *rt2x00dev)
291{
292 return 0;
293}
294static inline void rt2x00lib_free_firmware(struct rt2x00_dev *rt2x00dev)
295{
296}
297#endif
298
299
300
301
302#ifdef CONFIG_RT2X00_LIB_DEBUGFS
303void rt2x00debug_register(struct rt2x00_dev *rt2x00dev);
304void rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev);
305void rt2x00debug_update_crypto(struct rt2x00_dev *rt2x00dev,
306 struct rxdone_entry_desc *rxdesc);
307#else
308static inline void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)
309{
310}
311
312static inline void rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev)
313{
314}
315
316static inline void rt2x00debug_update_crypto(struct rt2x00_dev *rt2x00dev,
317 struct rxdone_entry_desc *rxdesc)
318{
319}
320#endif
321
322
323
324
325#ifdef CONFIG_RT2X00_LIB_CRYPTO
326enum cipher rt2x00crypto_key_to_cipher(struct ieee80211_key_conf *key);
327void rt2x00crypto_create_tx_descriptor(struct rt2x00_dev *rt2x00dev,
328 struct sk_buff *skb,
329 struct txentry_desc *txdesc);
330unsigned int rt2x00crypto_tx_overhead(struct rt2x00_dev *rt2x00dev,
331 struct sk_buff *skb);
332void rt2x00crypto_tx_copy_iv(struct sk_buff *skb,
333 struct txentry_desc *txdesc);
334void rt2x00crypto_tx_remove_iv(struct sk_buff *skb,
335 struct txentry_desc *txdesc);
336void rt2x00crypto_tx_insert_iv(struct sk_buff *skb, unsigned int header_length);
337void rt2x00crypto_rx_insert_iv(struct sk_buff *skb,
338 unsigned int header_length,
339 struct rxdone_entry_desc *rxdesc);
340#else
341static inline enum cipher rt2x00crypto_key_to_cipher(struct ieee80211_key_conf *key)
342{
343 return CIPHER_NONE;
344}
345
346static inline void rt2x00crypto_create_tx_descriptor(struct rt2x00_dev *rt2x00dev,
347 struct sk_buff *skb,
348 struct txentry_desc *txdesc)
349{
350}
351
352static inline unsigned int rt2x00crypto_tx_overhead(struct rt2x00_dev *rt2x00dev,
353 struct sk_buff *skb)
354{
355 return 0;
356}
357
358static inline void rt2x00crypto_tx_copy_iv(struct sk_buff *skb,
359 struct txentry_desc *txdesc)
360{
361}
362
363static inline void rt2x00crypto_tx_remove_iv(struct sk_buff *skb,
364 struct txentry_desc *txdesc)
365{
366}
367
368static inline void rt2x00crypto_tx_insert_iv(struct sk_buff *skb,
369 unsigned int header_length)
370{
371}
372
373static inline void rt2x00crypto_rx_insert_iv(struct sk_buff *skb,
374 unsigned int header_length,
375 struct rxdone_entry_desc *rxdesc)
376{
377}
378#endif
379
380
381
382
383static inline void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev)
384{
385 if (test_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags))
386 wiphy_rfkill_start_polling(rt2x00dev->hw->wiphy);
387}
388
389static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev)
390{
391 if (test_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags))
392 wiphy_rfkill_stop_polling(rt2x00dev->hw->wiphy);
393}
394
395
396
397
398#ifdef CONFIG_RT2X00_LIB_LEDS
399void rt2x00leds_led_quality(struct rt2x00_dev *rt2x00dev, int rssi);
400void rt2x00led_led_activity(struct rt2x00_dev *rt2x00dev, bool enabled);
401void rt2x00leds_led_assoc(struct rt2x00_dev *rt2x00dev, bool enabled);
402void rt2x00leds_led_radio(struct rt2x00_dev *rt2x00dev, bool enabled);
403void rt2x00leds_register(struct rt2x00_dev *rt2x00dev);
404void rt2x00leds_unregister(struct rt2x00_dev *rt2x00dev);
405void rt2x00leds_suspend(struct rt2x00_dev *rt2x00dev);
406void rt2x00leds_resume(struct rt2x00_dev *rt2x00dev);
407#else
408static inline void rt2x00leds_led_quality(struct rt2x00_dev *rt2x00dev,
409 int rssi)
410{
411}
412
413static inline void rt2x00led_led_activity(struct rt2x00_dev *rt2x00dev,
414 bool enabled)
415{
416}
417
418static inline void rt2x00leds_led_assoc(struct rt2x00_dev *rt2x00dev,
419 bool enabled)
420{
421}
422
423static inline void rt2x00leds_led_radio(struct rt2x00_dev *rt2x00dev,
424 bool enabled)
425{
426}
427
428static inline void rt2x00leds_register(struct rt2x00_dev *rt2x00dev)
429{
430}
431
432static inline void rt2x00leds_unregister(struct rt2x00_dev *rt2x00dev)
433{
434}
435
436static inline void rt2x00leds_suspend(struct rt2x00_dev *rt2x00dev)
437{
438}
439
440static inline void rt2x00leds_resume(struct rt2x00_dev *rt2x00dev)
441{
442}
443#endif
444
445#endif
446