0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef RT2X00LIB_H
0015 #define RT2X00LIB_H
0016
0017
0018
0019
0020 #define WATCHDOG_INTERVAL round_jiffies_relative(HZ)
0021 #define LINK_TUNE_SECONDS 1
0022 #define LINK_TUNE_INTERVAL round_jiffies_relative(LINK_TUNE_SECONDS * HZ)
0023 #define AGC_SECONDS 4
0024 #define VCO_SECONDS 10
0025
0026
0027
0028
0029 struct rt2x00_rate {
0030 unsigned short flags;
0031 #define DEV_RATE_CCK 0x0001
0032 #define DEV_RATE_OFDM 0x0002
0033 #define DEV_RATE_SHORT_PREAMBLE 0x0004
0034
0035 unsigned short bitrate;
0036 unsigned short ratemask;
0037
0038 unsigned short plcp;
0039 unsigned short mcs;
0040 };
0041
0042 extern const struct rt2x00_rate rt2x00_supported_rates[12];
0043
0044 static inline const struct rt2x00_rate *rt2x00_get_rate(const u16 hw_value)
0045 {
0046 return &rt2x00_supported_rates[hw_value & 0xff];
0047 }
0048
0049 #define RATE_MCS(__mode, __mcs) \
0050 ((((__mode) & 0x00ff) << 8) | ((__mcs) & 0x00ff))
0051
0052 static inline int rt2x00_get_rate_mcs(const u16 mcs_value)
0053 {
0054 return (mcs_value & 0x00ff);
0055 }
0056
0057
0058
0059
0060 int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev);
0061 void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev);
0062
0063
0064
0065
0066 int rt2x00lib_start(struct rt2x00_dev *rt2x00dev);
0067 void rt2x00lib_stop(struct rt2x00_dev *rt2x00dev);
0068
0069
0070
0071
0072 void rt2x00lib_config_intf(struct rt2x00_dev *rt2x00dev,
0073 struct rt2x00_intf *intf,
0074 enum nl80211_iftype type,
0075 const u8 *mac, const u8 *bssid);
0076 void rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev,
0077 struct rt2x00_intf *intf,
0078 struct ieee80211_bss_conf *conf,
0079 u32 changed);
0080 void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
0081 struct antenna_setup ant);
0082 void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
0083 struct ieee80211_conf *conf,
0084 const unsigned int changed_flags);
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094 struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry, gfp_t gfp);
0095
0096
0097
0098
0099
0100 void rt2x00queue_free_skb(struct queue_entry *entry);
0101
0102
0103
0104
0105
0106
0107
0108
0109 void rt2x00queue_align_frame(struct sk_buff *skb);
0110
0111
0112
0113
0114
0115
0116
0117
0118 void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int header_length);
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128 void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int header_length);
0129
0130
0131
0132
0133
0134
0135
0136 int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
0137 struct ieee80211_sta *sta, bool local);
0138
0139
0140
0141
0142
0143
0144
0145 int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
0146 struct ieee80211_vif *vif);
0147
0148
0149
0150
0151
0152
0153
0154 int rt2x00queue_update_beacon_locked(struct rt2x00_dev *rt2x00dev,
0155 struct ieee80211_vif *vif);
0156
0157
0158
0159
0160
0161
0162 int rt2x00queue_clear_beacon(struct rt2x00_dev *rt2x00dev,
0163 struct ieee80211_vif *vif);
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174 void rt2x00queue_index_inc(struct queue_entry *entry, enum queue_index index);
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184 void rt2x00queue_init_queues(struct rt2x00_dev *rt2x00dev);
0185
0186 int rt2x00queue_initialize(struct rt2x00_dev *rt2x00dev);
0187 void rt2x00queue_uninitialize(struct rt2x00_dev *rt2x00dev);
0188 int rt2x00queue_allocate(struct rt2x00_dev *rt2x00dev);
0189 void rt2x00queue_free(struct rt2x00_dev *rt2x00dev);
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200 void rt2x00link_update_stats(struct rt2x00_dev *rt2x00dev,
0201 struct sk_buff *skb,
0202 struct rxdone_entry_desc *rxdesc);
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212 void rt2x00link_start_tuner(struct rt2x00_dev *rt2x00dev);
0213
0214
0215
0216
0217
0218
0219
0220
0221 void rt2x00link_stop_tuner(struct rt2x00_dev *rt2x00dev);
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242 void rt2x00link_reset_tuner(struct rt2x00_dev *rt2x00dev, bool antenna);
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252 void rt2x00link_start_watchdog(struct rt2x00_dev *rt2x00dev);
0253
0254
0255
0256
0257
0258
0259
0260
0261 void rt2x00link_stop_watchdog(struct rt2x00_dev *rt2x00dev);
0262
0263
0264
0265
0266
0267
0268
0269
0270 void rt2x00link_register(struct rt2x00_dev *rt2x00dev);
0271
0272
0273
0274
0275 #ifdef CONFIG_RT2X00_LIB_FIRMWARE
0276 int rt2x00lib_load_firmware(struct rt2x00_dev *rt2x00dev);
0277 void rt2x00lib_free_firmware(struct rt2x00_dev *rt2x00dev);
0278 #else
0279 static inline int rt2x00lib_load_firmware(struct rt2x00_dev *rt2x00dev)
0280 {
0281 return 0;
0282 }
0283 static inline void rt2x00lib_free_firmware(struct rt2x00_dev *rt2x00dev)
0284 {
0285 }
0286 #endif
0287
0288
0289
0290
0291 #ifdef CONFIG_RT2X00_LIB_DEBUGFS
0292 void rt2x00debug_register(struct rt2x00_dev *rt2x00dev);
0293 void rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev);
0294 void rt2x00debug_update_crypto(struct rt2x00_dev *rt2x00dev,
0295 struct rxdone_entry_desc *rxdesc);
0296 #else
0297 static inline void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)
0298 {
0299 }
0300
0301 static inline void rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev)
0302 {
0303 }
0304
0305 static inline void rt2x00debug_update_crypto(struct rt2x00_dev *rt2x00dev,
0306 struct rxdone_entry_desc *rxdesc)
0307 {
0308 }
0309 #endif
0310
0311
0312
0313
0314 #ifdef CONFIG_RT2X00_LIB_CRYPTO
0315 enum cipher rt2x00crypto_key_to_cipher(struct ieee80211_key_conf *key);
0316 void rt2x00crypto_create_tx_descriptor(struct rt2x00_dev *rt2x00dev,
0317 struct sk_buff *skb,
0318 struct txentry_desc *txdesc);
0319 unsigned int rt2x00crypto_tx_overhead(struct rt2x00_dev *rt2x00dev,
0320 struct sk_buff *skb);
0321 void rt2x00crypto_tx_copy_iv(struct sk_buff *skb,
0322 struct txentry_desc *txdesc);
0323 void rt2x00crypto_tx_remove_iv(struct sk_buff *skb,
0324 struct txentry_desc *txdesc);
0325 void rt2x00crypto_tx_insert_iv(struct sk_buff *skb, unsigned int header_length);
0326 void rt2x00crypto_rx_insert_iv(struct sk_buff *skb,
0327 unsigned int header_length,
0328 struct rxdone_entry_desc *rxdesc);
0329 #else
0330 static inline enum cipher rt2x00crypto_key_to_cipher(struct ieee80211_key_conf *key)
0331 {
0332 return CIPHER_NONE;
0333 }
0334
0335 static inline void rt2x00crypto_create_tx_descriptor(struct rt2x00_dev *rt2x00dev,
0336 struct sk_buff *skb,
0337 struct txentry_desc *txdesc)
0338 {
0339 }
0340
0341 static inline unsigned int rt2x00crypto_tx_overhead(struct rt2x00_dev *rt2x00dev,
0342 struct sk_buff *skb)
0343 {
0344 return 0;
0345 }
0346
0347 static inline void rt2x00crypto_tx_copy_iv(struct sk_buff *skb,
0348 struct txentry_desc *txdesc)
0349 {
0350 }
0351
0352 static inline void rt2x00crypto_tx_remove_iv(struct sk_buff *skb,
0353 struct txentry_desc *txdesc)
0354 {
0355 }
0356
0357 static inline void rt2x00crypto_tx_insert_iv(struct sk_buff *skb,
0358 unsigned int header_length)
0359 {
0360 }
0361
0362 static inline void rt2x00crypto_rx_insert_iv(struct sk_buff *skb,
0363 unsigned int header_length,
0364 struct rxdone_entry_desc *rxdesc)
0365 {
0366 }
0367 #endif
0368
0369
0370
0371
0372 static inline void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev)
0373 {
0374 if (test_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags))
0375 wiphy_rfkill_start_polling(rt2x00dev->hw->wiphy);
0376 }
0377
0378 static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev)
0379 {
0380 if (test_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags))
0381 wiphy_rfkill_stop_polling(rt2x00dev->hw->wiphy);
0382 }
0383
0384
0385
0386
0387 #ifdef CONFIG_RT2X00_LIB_LEDS
0388 void rt2x00leds_led_quality(struct rt2x00_dev *rt2x00dev, int rssi);
0389 void rt2x00led_led_activity(struct rt2x00_dev *rt2x00dev, bool enabled);
0390 void rt2x00leds_led_assoc(struct rt2x00_dev *rt2x00dev, bool enabled);
0391 void rt2x00leds_led_radio(struct rt2x00_dev *rt2x00dev, bool enabled);
0392 void rt2x00leds_register(struct rt2x00_dev *rt2x00dev);
0393 void rt2x00leds_unregister(struct rt2x00_dev *rt2x00dev);
0394 void rt2x00leds_suspend(struct rt2x00_dev *rt2x00dev);
0395 void rt2x00leds_resume(struct rt2x00_dev *rt2x00dev);
0396 #else
0397 static inline void rt2x00leds_led_quality(struct rt2x00_dev *rt2x00dev,
0398 int rssi)
0399 {
0400 }
0401
0402 static inline void rt2x00led_led_activity(struct rt2x00_dev *rt2x00dev,
0403 bool enabled)
0404 {
0405 }
0406
0407 static inline void rt2x00leds_led_assoc(struct rt2x00_dev *rt2x00dev,
0408 bool enabled)
0409 {
0410 }
0411
0412 static inline void rt2x00leds_led_radio(struct rt2x00_dev *rt2x00dev,
0413 bool enabled)
0414 {
0415 }
0416
0417 static inline void rt2x00leds_register(struct rt2x00_dev *rt2x00dev)
0418 {
0419 }
0420
0421 static inline void rt2x00leds_unregister(struct rt2x00_dev *rt2x00dev)
0422 {
0423 }
0424
0425 static inline void rt2x00leds_suspend(struct rt2x00_dev *rt2x00dev)
0426 {
0427 }
0428
0429 static inline void rt2x00leds_resume(struct rt2x00_dev *rt2x00dev)
0430 {
0431 }
0432 #endif
0433
0434 #endif