madwifi init: set the channel after bringing up the interface (sometimes it needs...
[openwrt.git] / package / d80211 / src / ieee80211_i.h
1 /*
2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2005, Devicescape Software, Inc.
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 version 2 as
7 * published by the Free Software Foundation.
8 */
9
10 #ifndef IEEE80211_I_H
11 #define IEEE80211_I_H
12
13 #include <linux/kernel.h>
14 #include <linux/device.h>
15 #include <linux/if_ether.h>
16 #include <linux/interrupt.h>
17 #include <linux/list.h>
18 #include <linux/netdevice.h>
19 #include <linux/skbuff.h>
20 #include <linux/workqueue.h>
21 #include <linux/types.h>
22 #include <linux/spinlock.h>
23 #include "ieee80211_key.h"
24 #include "sta_info.h"
25
26 /* ieee80211.o internal definitions, etc. These are not included into
27 * low-level drivers. */
28
29 #ifndef ETH_P_PAE
30 #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
31 #endif /* ETH_P_PAE */
32
33 #define IEEE80211_MAX_SSID_LEN 32
34
35 #define WLAN_FC_DATA_PRESENT(fc) (((fc) & 0x4c) == 0x08)
36
37 struct ieee80211_local;
38
39 #define BIT(x) (1 << (x))
40
41 #define IEEE80211_ALIGN32_PAD(a) ((4 - ((a) & 3)) & 3)
42
43 /* Maximum number of broadcast/multicast frames to buffer when some of the
44 * associated stations are using power saving. */
45 #define AP_MAX_BC_BUFFER 128
46
47 /* Maximum number of frames buffered to all STAs, including multicast frames.
48 * Note: increasing this limit increases the potential memory requirement. Each
49 * frame can be up to about 2 kB long. */
50 #define TOTAL_MAX_TX_BUFFER 512
51
52
53 /* IEEE 802.11 (Ch. 9.5 Defragmentation) requires support for concurrent
54 * reception of at least three fragmented frames. This limit can be increased
55 * by changing this define, at the cost of slower frame reassembly and
56 * increased memory use (about 2 kB of RAM per entry). */
57 #define IEEE80211_FRAGMENT_MAX 4
58
59 struct ieee80211_fragment_entry {
60 unsigned long first_frag_time;
61 unsigned int seq;
62 unsigned int rx_queue;
63 unsigned int last_frag;
64 unsigned int extra_len;
65 struct sk_buff_head skb_list;
66 int ccmp; /* Whether fragments were encrypted with CCMP */
67 u8 last_pn[6]; /* PN of the last fragment if CCMP was used */
68 };
69
70
71 struct ieee80211_sta_bss {
72 struct list_head list;
73 struct ieee80211_sta_bss *hnext;
74 atomic_t users;
75
76 u8 bssid[ETH_ALEN];
77 u8 ssid[IEEE80211_MAX_SSID_LEN];
78 size_t ssid_len;
79 u16 capability; /* host byte order */
80 int hw_mode;
81 int channel;
82 int freq;
83 int rssi;
84 u8 *wpa_ie;
85 size_t wpa_ie_len;
86 u8 *rsn_ie;
87 size_t rsn_ie_len;
88 u8 *wmm_ie;
89 size_t wmm_ie_len;
90 #define IEEE80211_MAX_SUPP_RATES 32
91 u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
92 size_t supp_rates_len;
93 int beacon_int;
94 u64 timestamp;
95
96 int probe_resp;
97 unsigned long last_update;
98
99 };
100
101
102 typedef enum {
103 TXRX_CONTINUE, TXRX_DROP, TXRX_QUEUED
104 } ieee80211_txrx_result;
105
106 struct ieee80211_txrx_data {
107 struct sk_buff *skb;
108 struct net_device *dev;
109 struct ieee80211_local *local;
110 struct ieee80211_sub_if_data *sdata;
111 struct sta_info *sta;
112 u16 fc, ethertype;
113 struct ieee80211_key *key;
114 unsigned int fragmented:1; /* whether the MSDU was fragmented */
115 union {
116 struct {
117 struct ieee80211_tx_control *control;
118 unsigned int unicast:1;
119 unsigned int ps_buffered:1;
120 unsigned int short_preamble:1;
121 unsigned int probe_last_frag:1;
122 struct ieee80211_rate *rate;
123 /* use this rate (if set) for last fragment; rate can
124 * be set to lower rate for the first fragments, e.g.,
125 * when using CTS protection with IEEE 802.11g. */
126 struct ieee80211_rate *last_frag_rate;
127 int last_frag_rateidx;
128 int last_frag_hwrate;
129 int mgmt_interface;
130
131 /* Extra fragments (in addition to the first fragment
132 * in skb) */
133 int num_extra_frag;
134 struct sk_buff **extra_frag;
135 } tx;
136 struct {
137 struct ieee80211_rx_status *status;
138 int sent_ps_buffered;
139 int queue;
140 int load;
141 unsigned int in_scan:1;
142 /* frame is destined to interface currently processed
143 * (including multicast frames) */
144 unsigned int ra_match:1;
145 } rx;
146 } u;
147 #ifdef CONFIG_HOSTAPD_WPA_TESTING
148 int wpa_test;
149 #endif /* CONFIG_HOSTAPD_WPA_TESTING */
150 };
151
152 /* Stored in sk_buff->cb */
153 struct ieee80211_tx_packet_data {
154 int ifindex;
155 unsigned long jiffies;
156 unsigned int req_tx_status:1;
157 unsigned int do_not_encrypt:1;
158 unsigned int requeue:1;
159 unsigned int mgmt_iface:1;
160 unsigned int queue:4;
161 };
162
163 struct ieee80211_tx_stored_packet {
164 struct ieee80211_tx_control control;
165 struct sk_buff *skb;
166 int num_extra_frag;
167 struct sk_buff **extra_frag;
168 int last_frag_rateidx;
169 int last_frag_hwrate;
170 unsigned int last_frag_rate_ctrl_probe:1;
171 };
172
173 struct ieee80211_passive_scan {
174 unsigned int in_scan:1; /* this must be cleared before calling
175 * netif_oper(WAKEUP) */
176 unsigned int our_mode_only:1; /* only scan our physical mode a/b/g/etc
177 */
178 int interval; /* time in seconds between scans */
179 int time; /* time in microseconds to scan for */
180 int channel; /* channel to be scanned */
181 int tries;
182
183 struct ieee80211_hw_mode *mode;
184 int chan_idx;
185
186 int freq;
187 int rx_packets;
188 int rx_beacon;
189 int txrx_count;
190
191 struct timer_list timer;
192
193 struct sk_buff *skb; /* skb to transmit before changing channels,
194 * maybe null for none */
195 struct ieee80211_tx_control tx_control;
196
197 unsigned int num_scans;
198 };
199
200 typedef ieee80211_txrx_result (*ieee80211_tx_handler)
201 (struct ieee80211_txrx_data *tx);
202
203 typedef ieee80211_txrx_result (*ieee80211_rx_handler)
204 (struct ieee80211_txrx_data *rx);
205
206 struct ieee80211_if_ap {
207 u8 *beacon_head, *beacon_tail;
208 int beacon_head_len, beacon_tail_len;
209
210 u8 ssid[IEEE80211_MAX_SSID_LEN];
211 size_t ssid_len;
212 u8 *generic_elem;
213 size_t generic_elem_len;
214
215 /* yes, this looks ugly, but guarantees that we can later use
216 * bitmap_empty :)
217 * NB: don't ever use set_bit, use bss_tim_set/bss_tim_clear! */
218 u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)];
219 atomic_t num_sta_ps; /* number of stations in PS mode */
220 struct sk_buff_head ps_bc_buf;
221 int dtim_period, dtim_count;
222 int force_unicast_rateidx; /* forced TX rateidx for unicast frames */
223 int max_ratectrl_rateidx; /* max TX rateidx for rate control */
224 int num_beacons; /* number of TXed beacon frames for this BSS */
225 };
226
227 struct ieee80211_if_wds {
228 u8 remote_addr[ETH_ALEN];
229 struct sta_info *sta;
230 };
231
232 struct ieee80211_if_vlan {
233 u8 id;
234 };
235
236 struct ieee80211_if_sta {
237 enum {
238 IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
239 IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED,
240 IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED
241 } state;
242 struct delayed_work work;
243 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
244 u8 ssid[IEEE80211_MAX_SSID_LEN];
245 size_t ssid_len;
246 u16 aid;
247 u16 ap_capab, capab;
248 u8 *extra_ie; /* to be added to the end of AssocReq */
249 size_t extra_ie_len;
250
251 /* The last AssocReq/Resp IEs */
252 u8 *assocreq_ies, *assocresp_ies;
253 size_t assocreq_ies_len, assocresp_ies_len;
254
255 int auth_tries, assoc_tries;
256
257 unsigned int ssid_set:1;
258 unsigned int bssid_set:1;
259 unsigned int prev_bssid_set:1;
260 unsigned int authenticated:1;
261 unsigned int associated:1;
262 unsigned int probereq_poll:1;
263 unsigned int use_protection:1;
264 unsigned int create_ibss:1;
265 unsigned int mixed_cell:1;
266 unsigned int wmm_enabled:1;
267
268 int key_mgmt;
269 unsigned long last_probe;
270
271 #define IEEE80211_AUTH_ALG_OPEN BIT(0)
272 #define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1)
273 #define IEEE80211_AUTH_ALG_LEAP BIT(2)
274 unsigned int auth_algs; /* bitfield of allowed auth algs */
275 int auth_alg; /* currently used IEEE 802.11 authentication algorithm */
276 int auth_transaction;
277
278 unsigned long ibss_join_req;
279 struct sk_buff *probe_resp; /* ProbeResp template for IBSS */
280 u32 supp_rates_bits;
281
282 int wmm_last_param_set;
283 };
284
285
286 struct ieee80211_sub_if_data {
287 struct list_head list;
288 unsigned int type;
289
290 struct net_device *dev;
291 struct ieee80211_local *local;
292
293 int mc_count;
294 unsigned int allmulti:1;
295 unsigned int promisc:1;
296
297 struct net_device_stats stats;
298 int drop_unencrypted;
299 int eapol; /* 0 = process EAPOL frames as normal data frames,
300 * 1 = send EAPOL frames through wlan#ap to hostapd
301 * (default) */
302 int ieee802_1x; /* IEEE 802.1X PAE - drop packet to/from unauthorized
303 * port */
304
305 /* Fragment table for host-based reassembly */
306 struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX];
307 unsigned int fragment_next;
308
309 #define NUM_DEFAULT_KEYS 4
310 struct ieee80211_key *keys[NUM_DEFAULT_KEYS];
311 struct ieee80211_key *default_key;
312 struct kset key_kset;
313
314 struct ieee80211_if_ap *bss; /* BSS that this device belongs to */
315
316 union {
317 struct ieee80211_if_ap ap;
318 struct ieee80211_if_wds wds;
319 struct ieee80211_if_vlan vlan;
320 struct ieee80211_if_sta sta;
321 } u;
322 int channel_use;
323 int channel_use_raw;
324
325 struct attribute_group *sysfs_group;
326 };
327
328 #define IEEE80211_DEV_TO_SUB_IF(dev) netdev_priv(dev)
329
330 struct ieee80211_local {
331 /* embed the driver visible part.
332 * don't cast (use the static inlines below), but we keep
333 * it first anyway so they become a no-op */
334 struct ieee80211_hw hw;
335
336 const struct ieee80211_ops *ops;
337
338 /* List of registered struct ieee80211_hw_mode */
339 struct list_head modes_list;
340
341 struct net_device *mdev; /* wmaster# - "master" 802.11 device */
342 struct net_device *apdev; /* wlan#ap - management frames (hostapd) */
343 int open_count;
344 int monitors;
345 struct iw_statistics wstats;
346
347 struct class_device class_dev;
348
349 enum {
350 IEEE80211_DEV_UNITIALIZED = 0,
351 IEEE80211_DEV_REGISTERED,
352 IEEE80211_DEV_UNREGISTERED,
353 } reg_state;
354
355 /* Tasklet and skb queue to process calls from IRQ mode. All frames
356 * added to skb_queue will be processed, but frames in
357 * skb_queue_unreliable may be dropped if the total length of these
358 * queues increases over the limit. */
359 #define IEEE80211_IRQSAFE_QUEUE_LIMIT 128
360 struct tasklet_struct tasklet;
361 struct sk_buff_head skb_queue;
362 struct sk_buff_head skb_queue_unreliable;
363 enum {
364 ieee80211_rx_msg = 1,
365 ieee80211_tx_status_msg = 2
366 } ieee80211_msg_enum;
367
368 spinlock_t generic_lock;
369 /* Station data structures */
370 struct kset sta_kset;
371 spinlock_t sta_lock; /* mutex for STA data structures */
372 int num_sta; /* number of stations in sta_list */
373 struct list_head sta_list;
374 struct list_head deleted_sta_list;
375 struct sta_info *sta_hash[STA_HASH_SIZE];
376 struct timer_list sta_cleanup;
377
378 unsigned long state[NUM_TX_DATA_QUEUES];
379 struct ieee80211_tx_stored_packet pending_packet[NUM_TX_DATA_QUEUES];
380 struct tasklet_struct tx_pending_tasklet;
381
382 int mc_count; /* total count of multicast entries in all interfaces */
383 int iff_allmultis, iff_promiscs;
384 /* number of interfaces with corresponding IFF_ flags */
385
386 /* Current rate table. This is a pointer to hw->modes structure. */
387 struct ieee80211_rate *curr_rates;
388 int num_curr_rates;
389
390 struct rate_control_ref *rate_ctrl;
391
392 int next_mode; /* MODE_IEEE80211*
393 * The mode preference for next channel change. This is
394 * used to select .11g vs. .11b channels (or 4.9 GHz vs.
395 * .11a) when the channel number is not unique. */
396
397 /* Supported and basic rate filters for different modes. These are
398 * pointers to -1 terminated lists and rates in 100 kbps units. */
399 int *supp_rates[NUM_IEEE80211_MODES];
400 int *basic_rates[NUM_IEEE80211_MODES];
401
402 int rts_threshold;
403 int cts_protect_erp_frames;
404 int fragmentation_threshold;
405 int short_retry_limit; /* dot11ShortRetryLimit */
406 int long_retry_limit; /* dot11LongRetryLimit */
407 int short_preamble; /* use short preamble with IEEE 802.11b */
408
409 struct crypto_blkcipher *wep_tx_tfm;
410 struct crypto_blkcipher *wep_rx_tfm;
411 u32 wep_iv;
412 int key_tx_rx_threshold; /* number of times any key can be used in TX
413 * or RX before generating a rekey
414 * notification; 0 = notification disabled. */
415
416 int bridge_packets; /* bridge packets between associated stations and
417 * deliver multicast frames both back to wireless
418 * media and to the local net stack */
419
420 struct ieee80211_passive_scan scan;
421
422
423 ieee80211_rx_handler *rx_pre_handlers;
424 ieee80211_rx_handler *rx_handlers;
425 ieee80211_tx_handler *tx_handlers;
426
427 spinlock_t sub_if_lock; /* mutex for STA data structures */
428 struct list_head sub_if_list;
429 int sta_scanning;
430 struct ieee80211_hw_mode *scan_hw_mode;
431 int scan_channel_idx;
432 enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
433 unsigned long last_scan_completed;
434 struct delayed_work scan_work;
435 struct net_device *scan_dev;
436 int scan_oper_channel;
437 int scan_oper_channel_val;
438 int scan_oper_power_level;
439 int scan_oper_freq;
440 int scan_oper_phymode;
441 int scan_oper_antenna_max;
442 u8 scan_ssid[IEEE80211_MAX_SSID_LEN];
443 size_t scan_ssid_len;
444 struct list_head sta_bss_list;
445 struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE];
446 spinlock_t sta_bss_lock;
447 #define IEEE80211_SCAN_MATCH_SSID BIT(0)
448 #define IEEE80211_SCAN_WPA_ONLY BIT(1)
449 #define IEEE80211_SCAN_EXTRA_INFO BIT(2)
450 int scan_flags;
451
452 #ifdef CONFIG_HOSTAPD_WPA_TESTING
453 u32 wpa_trigger;
454 #endif /* CONFIG_HOSTAPD_WPA_TESTING */
455 /* SNMP counters */
456 /* dot11CountersTable */
457 u32 dot11TransmittedFragmentCount;
458 u32 dot11MulticastTransmittedFrameCount;
459 u32 dot11FailedCount;
460 u32 dot11RetryCount;
461 u32 dot11MultipleRetryCount;
462 u32 dot11FrameDuplicateCount;
463 u32 dot11ReceivedFragmentCount;
464 u32 dot11MulticastReceivedFrameCount;
465 u32 dot11TransmittedFrameCount;
466 u32 dot11WEPUndecryptableCount;
467
468 #ifdef CONFIG_D80211_LEDS
469 int tx_led_counter, rx_led_counter;
470 struct led_trigger *tx_led, *rx_led;
471 char tx_led_name[32], rx_led_name[32];
472 #endif
473
474 u32 channel_use;
475 u32 channel_use_raw;
476 u32 stat_time;
477 struct timer_list stat_timer;
478
479 struct proc_dir_entry *proc, *proc_sta, *proc_iface;
480
481 struct work_struct sta_proc_add;
482
483 enum {
484 STA_ANTENNA_SEL_AUTO = 0,
485 STA_ANTENNA_SEL_SW_CTRL = 1,
486 STA_ANTENNA_SEL_SW_CTRL_DEBUG = 2
487 } sta_antenna_sel;
488
489 int rate_ctrl_num_up, rate_ctrl_num_down;
490
491 #ifdef CONFIG_D80211_DEBUG_COUNTERS
492 /* TX/RX handler statistics */
493 unsigned int tx_handlers_drop;
494 unsigned int tx_handlers_queued;
495 unsigned int tx_handlers_drop_unencrypted;
496 unsigned int tx_handlers_drop_fragment;
497 unsigned int tx_handlers_drop_wep;
498 unsigned int tx_handlers_drop_not_assoc;
499 unsigned int tx_handlers_drop_unauth_port;
500 unsigned int rx_handlers_drop;
501 unsigned int rx_handlers_queued;
502 unsigned int rx_handlers_drop_nullfunc;
503 unsigned int rx_handlers_drop_defrag;
504 unsigned int rx_handlers_drop_short;
505 unsigned int rx_handlers_drop_passive_scan;
506 unsigned int tx_expand_skb_head;
507 unsigned int tx_expand_skb_head_cloned;
508 unsigned int rx_expand_skb_head;
509 unsigned int rx_expand_skb_head2;
510 unsigned int rx_handlers_fragments;
511 unsigned int tx_status_drop;
512 unsigned int wme_rx_queue[NUM_RX_DATA_QUEUES];
513 unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES];
514 #define I802_DEBUG_INC(c) (c)++
515 #else /* CONFIG_D80211_DEBUG_COUNTERS */
516 #define I802_DEBUG_INC(c) do { } while (0)
517 #endif /* CONFIG_D80211_DEBUG_COUNTERS */
518
519
520 int default_wep_only; /* only default WEP keys are used with this
521 * interface; this is used to decide when hwaccel
522 * can be used with default keys */
523 int total_ps_buffered; /* total number of all buffered unicast and
524 * multicast packets for power saving stations
525 */
526 int allow_broadcast_always; /* whether to allow TX of broadcast frames
527 * even when there are no associated STAs
528 */
529
530 int wifi_wme_noack_test;
531 unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */
532
533 unsigned int enabled_modes; /* bitfield of allowed modes;
534 * (1 << MODE_*) */
535 unsigned int hw_modes; /* bitfield of supported hardware modes;
536 * (1 << MODE_*) */
537
538 int user_space_mlme;
539 };
540
541 static inline struct ieee80211_local *hw_to_local(
542 struct ieee80211_hw *hw)
543 {
544 return container_of(hw, struct ieee80211_local, hw);
545 }
546
547 static inline struct ieee80211_hw *local_to_hw(
548 struct ieee80211_local *local)
549 {
550 return &local->hw;
551 }
552
553 enum ieee80211_link_state_t {
554 IEEE80211_LINK_STATE_XOFF = 0,
555 IEEE80211_LINK_STATE_PENDING,
556 };
557
558 struct sta_attribute {
559 struct attribute attr;
560 ssize_t (*show)(const struct sta_info *, char *buf);
561 ssize_t (*store)(struct sta_info *, const char *buf, size_t count);
562 };
563
564 static inline void __bss_tim_set(struct ieee80211_if_ap *bss, int aid)
565 {
566 /*
567 * This format has ben mandated by the IEEE specifications,
568 * so this line may not be changed to use the __set_bit() format.
569 */
570 bss->tim[(aid)/8] |= 1<<((aid) % 8);
571 }
572
573 static inline void bss_tim_set(struct ieee80211_local *local,
574 struct ieee80211_if_ap *bss, int aid)
575 {
576 spin_lock_bh(&local->sta_lock);
577 __bss_tim_set(bss, aid);
578 spin_unlock_bh(&local->sta_lock);
579 }
580
581 static inline void __bss_tim_clear(struct ieee80211_if_ap *bss, int aid)
582 {
583 /*
584 * This format has ben mandated by the IEEE specifications,
585 * so this line may not be changed to use the __clear_bit() format.
586 */
587 bss->tim[(aid)/8] &= !(1<<((aid) % 8));
588 }
589
590 static inline void bss_tim_clear(struct ieee80211_local *local,
591 struct ieee80211_if_ap *bss, int aid)
592 {
593 spin_lock_bh(&local->sta_lock);
594 __bss_tim_clear(bss, aid);
595 spin_unlock_bh(&local->sta_lock);
596 }
597
598 /* ieee80211.c */
599 void ieee80211_release_hw(struct ieee80211_local *local);
600 int ieee80211_hw_config(struct ieee80211_local *local);
601 int ieee80211_if_config(struct net_device *dev);
602 int ieee80211_if_config_beacon(struct net_device *dev);
603 struct ieee80211_key_conf *
604 ieee80211_key_data2conf(struct ieee80211_local *local,
605 struct ieee80211_key *data);
606 struct ieee80211_key *ieee80211_key_alloc(struct ieee80211_sub_if_data *sdata,
607 int idx, size_t key_len, gfp_t flags);
608 void ieee80211_key_free(struct ieee80211_key *key);
609 void ieee80211_key_release(struct kobject *kobj);
610 void ieee80211_rx_mgmt(struct ieee80211_local *local, struct sk_buff *skb,
611 struct ieee80211_rx_status *status, u32 msg_type);
612 void ieee80211_prepare_rates(struct ieee80211_local *local);
613 void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx);
614 int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr);
615 void ieee80211_if_setup(struct net_device *dev);
616 void ieee80211_if_mgmt_setup(struct net_device *dev);
617 void ieee80211_if_shutdown(struct net_device *dev);
618 int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
619 const char *name);
620 struct net_device_stats *ieee80211_dev_stats(struct net_device *dev);
621
622 /* ieee80211_ioctl.c */
623 int ieee80211_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
624 extern const struct iw_handler_def ieee80211_iw_handler_def;
625 extern const struct iw_handler_def ieee80211_iw_master_handler_def;
626
627 /* Set hw encryption from ieee80211 */
628 int ieee80211_set_hw_encryption(struct net_device *dev,
629 struct sta_info *sta, u8 addr[ETH_ALEN],
630 struct ieee80211_key *key);
631 void ieee80211_update_default_wep_only(struct ieee80211_local *local);
632
633 /* ieee80211_scan.c */
634 void ieee80211_init_scan(struct ieee80211_local *local);
635 void ieee80211_stop_scan(struct ieee80211_local *local);
636
637
638
639 /* Least common multiple of the used rates (in 100 kbps). This is used to
640 * calculate rate_inv values for each rate so that only integers are needed. */
641 #define CHAN_UTIL_RATE_LCM 95040
642 /* 1 usec is 1/8 * (95040/10) = 1188 */
643 #define CHAN_UTIL_PER_USEC 1188
644 /* Amount of bits to shift the result right to scale the total utilization
645 * to values that will not wrap around 32-bit integers. */
646 #define CHAN_UTIL_SHIFT 9
647 /* Theoretical maximum of channel utilization counter in 10 ms (stat_time=1):
648 * (CHAN_UTIL_PER_USEC * 10000) >> CHAN_UTIL_SHIFT = 23203. So dividing the
649 * raw value with about 23 should give utilization in 10th of a percentage
650 * (1/1000). However, utilization is only estimated and not all intervals
651 * between frames etc. are calculated. 18 seems to give numbers that are closer
652 * to the real maximum. */
653 #define CHAN_UTIL_PER_10MS 18
654 #define CHAN_UTIL_HDR_LONG (202 * CHAN_UTIL_PER_USEC)
655 #define CHAN_UTIL_HDR_SHORT (40 * CHAN_UTIL_PER_USEC)
656
657
658 /* ieee80211_ioctl.c */
659 int ieee80211_set_compression(struct ieee80211_local *local,
660 struct net_device *dev, struct sta_info *sta);
661 int ieee80211_init_client(struct net_device *dev);
662 /* ieee80211_sta.c */
663 void ieee80211_sta_work(struct work_struct *work);
664 void ieee80211_sta_scan_work(struct work_struct *work);
665 void ieee80211_sta_rx_mgmt(struct net_device *dev, struct sk_buff *skb,
666 struct ieee80211_rx_status *rx_status);
667 int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len);
668 int ieee80211_sta_get_ssid(struct net_device *dev, char *ssid, size_t *len);
669 int ieee80211_sta_set_bssid(struct net_device *dev, u8 *bssid);
670 int ieee80211_sta_req_scan(struct net_device *dev, u8 *ssid, size_t ssid_len);
671 int ieee80211_sta_scan_results(struct net_device *dev, char *buf, size_t len);
672 void ieee80211_sta_rx_scan(struct net_device *dev, struct sk_buff *skb,
673 struct ieee80211_rx_status *rx_status);
674 void ieee80211_rx_bss_list_init(struct net_device *dev);
675 void ieee80211_rx_bss_list_deinit(struct net_device *dev);
676 int ieee80211_sta_set_extra_ie(struct net_device *dev, char *ie, size_t len);
677 struct sta_info * ieee80211_ibss_add_sta(struct net_device *dev,
678 struct sk_buff *skb, u8 *bssid,
679 u8 *addr);
680 int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason);
681 int ieee80211_sta_disassociate(struct net_device *dev, u16 reason);
682
683 /* ieee80211_dev.c */
684 int ieee80211_dev_alloc_index(struct ieee80211_local *local);
685 void ieee80211_dev_free_index(struct ieee80211_local *local);
686 struct ieee80211_local *ieee80211_dev_find(int index);
687 int ieee80211_dev_find_index(struct ieee80211_local *local);
688 struct ieee80211_local *ieee80211_dev_alloc(gfp_t flags);
689 void ieee80211_dev_free(struct ieee80211_local *local);
690
691 /* ieee80211_iface.c */
692 int ieee80211_if_add(struct net_device *dev, const char *name,
693 int format, struct net_device **new_dev);
694 void ieee80211_if_set_type(struct net_device *dev, int type);
695 void ieee80211_if_reinit(struct net_device *dev);
696 void __ieee80211_if_del(struct ieee80211_local *local,
697 struct ieee80211_sub_if_data *sdata);
698 void ieee80211_if_del(struct net_device *dev);
699 int ieee80211_if_remove(struct net_device *dev, const char *name, int id);
700 void ieee80211_if_free(struct net_device *dev);
701 void ieee80211_if_flush(struct net_device *dev);
702 void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata);
703 int ieee80211_if_add_mgmt(struct ieee80211_local *local);
704 void ieee80211_if_del_mgmt(struct ieee80211_local *local);
705
706 /* ieee80211_sysfs.c */
707 int ieee80211_sysfs_add_netdevice(struct net_device *dev);
708 void ieee80211_sysfs_remove_netdevice(struct net_device *dev);
709 void ieee80211_dev_sysfs_init(struct ieee80211_local *local);
710 void ieee80211_dev_sysfs_put(struct ieee80211_local *local);
711 int ieee80211_dev_sysfs_add(struct ieee80211_local *local);
712 void ieee80211_dev_sysfs_del(struct ieee80211_local *local);
713 int ieee80211_sysfs_init(void);
714 void ieee80211_sysfs_deinit(void);
715 int ieee80211_sysfs_change_if_type(struct net_device *dev);
716
717 /* ieee80211_sysfs_sta.c */
718 int ieee80211_sta_kset_sysfs_register(struct ieee80211_local *local);
719 void ieee80211_sta_kset_sysfs_unregister(struct ieee80211_local *local);
720 int ieee80211_sta_sysfs_add(struct sta_info *sta);
721 void ieee80211_sta_sysfs_remove(struct sta_info *sta);
722 int ieee80211_key_kset_sysfs_register(struct ieee80211_sub_if_data *sdata);
723 void ieee80211_key_kset_sysfs_unregister(struct ieee80211_sub_if_data *sdata);
724 void ieee80211_key_sysfs_set_kset(struct ieee80211_key *key, struct kset *kset);
725 int ieee80211_key_sysfs_add(struct ieee80211_key *key);
726 void ieee80211_key_sysfs_remove(struct ieee80211_key *key);
727 int ieee80211_key_sysfs_add_default(struct ieee80211_sub_if_data *sdata);
728 void ieee80211_key_sysfs_remove_default(struct ieee80211_sub_if_data *sdata);
729
730 #endif /* IEEE80211_I_H */
This page took 0.088208 seconds and 5 git commands to generate.