2
* Copyright 2002-2005, Instant802 Networks, Inc.
3
* Copyright 2005, Devicescape Software, Inc.
4
* Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2 as
8
* published by the Free Software Foundation.
14
#include <linux/kernel.h>
15
#include <linux/device.h>
16
#include <linux/if_ether.h>
17
#include <linux/interrupt.h>
18
#include <linux/list.h>
19
#include <linux/netdevice.h>
20
#include <linux/skbuff.h>
21
#include <linux/workqueue.h>
22
#include <linux/types.h>
23
#include <linux/spinlock.h>
24
#include <net/wireless.h>
25
#include "ieee80211_key.h"
28
/* ieee80211.o internal definitions, etc. These are not included into
29
* low-level drivers. */
32
#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
33
#endif /* ETH_P_PAE */
35
#define WLAN_FC_DATA_PRESENT(fc) (((fc) & 0x4c) == 0x08)
37
struct ieee80211_local;
40
#define IEEE80211_ALIGN32_PAD(a) ((4 - ((a) & 3)) & 3)
42
/* Maximum number of broadcast/multicast frames to buffer when some of the
43
* associated stations are using power saving. */
44
#define AP_MAX_BC_BUFFER 128
46
/* Maximum number of frames buffered to all STAs, including multicast frames.
47
* Note: increasing this limit increases the potential memory requirement. Each
48
* frame can be up to about 2 kB long. */
49
#define TOTAL_MAX_TX_BUFFER 512
51
/* Required encryption head and tailroom */
52
#define IEEE80211_ENCRYPT_HEADROOM 8
53
#define IEEE80211_ENCRYPT_TAILROOM 12
55
/* IEEE 802.11 (Ch. 9.5 Defragmentation) requires support for concurrent
56
* reception of at least three fragmented frames. This limit can be increased
57
* by changing this define, at the cost of slower frame reassembly and
58
* increased memory use (about 2 kB of RAM per entry). */
59
#define IEEE80211_FRAGMENT_MAX 4
61
/* Minimum and Maximum TSID used by EDCA. EDCA uses 0~7; HCCA uses 8~15 */
62
#define EDCA_TSID_MIN 0
63
#define EDCA_TSID_MAX 7
65
struct ieee80211_fragment_entry {
66
unsigned long first_frag_time;
68
unsigned int rx_queue;
69
unsigned int last_frag;
70
unsigned int extra_len;
71
struct sk_buff_head skb_list;
72
int ccmp; /* Whether fragments were encrypted with CCMP */
73
u8 last_pn[6]; /* PN of the last fragment if CCMP was used */
77
struct ieee80211_sta_bss {
78
struct list_head list;
79
struct ieee80211_sta_bss *hnext;
83
u8 ssid[IEEE80211_MAX_SSID_LEN];
85
u16 capability; /* host byte order */
89
int rssi, signal, noise;
98
#define IEEE80211_MAX_SUPP_RATES 32
99
u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
100
size_t supp_rates_len;
105
unsigned long last_update;
107
/* during assocation, we save an ERP value from a probe response so
108
* that we can feed ERP info to the driver when handling the
109
* association completes. these fields probably won't be up-to-date
110
* otherwise, you probably don't want to use them. */
117
TXRX_CONTINUE, TXRX_DROP, TXRX_QUEUED
118
} ieee80211_txrx_result;
120
struct ieee80211_txrx_data {
122
struct net_device *dev;
123
struct ieee80211_local *local;
124
struct ieee80211_sub_if_data *sdata;
125
struct sta_info *sta;
127
struct ieee80211_key *key;
128
unsigned int fragmented:1; /* whether the MSDU was fragmented */
131
struct ieee80211_tx_control *control;
132
unsigned int unicast:1;
133
unsigned int ps_buffered:1;
134
unsigned int short_preamble:1;
135
unsigned int probe_last_frag:1;
136
struct ieee80211_hw_mode *mode;
137
struct ieee80211_rate *rate;
138
/* use this rate (if set) for last fragment; rate can
139
* be set to lower rate for the first fragments, e.g.,
140
* when using CTS protection with IEEE 802.11g. */
141
struct ieee80211_rate *last_frag_rate;
142
int last_frag_hwrate;
145
/* Extra fragments (in addition to the first fragment
148
struct sk_buff **extra_frag;
151
struct ieee80211_rx_status *status;
152
int sent_ps_buffered;
156
unsigned int in_scan:1;
157
/* frame is destined to interface currently processed
158
* (including multicast frames) */
159
unsigned int ra_match:1;
160
unsigned int is_agg_frame:1;
165
/* Stored in sk_buff->cb */
166
struct ieee80211_tx_packet_data {
168
unsigned long jiffies;
169
unsigned int req_tx_status:1;
170
unsigned int do_not_encrypt:1;
171
unsigned int requeue:1;
172
unsigned int mgmt_iface:1;
173
unsigned int queue:4;
174
unsigned int ht_queue:1;
177
struct ieee80211_tx_stored_packet {
178
struct ieee80211_tx_control control;
181
struct sk_buff **extra_frag;
182
int last_frag_rateidx;
183
int last_frag_hwrate;
184
struct ieee80211_rate *last_frag_rate;
185
unsigned int last_frag_rate_ctrl_probe:1;
190
TS_STATUS_UNUSED = 0,
191
TS_STATUS_ACTIVE = 1,
192
TS_STATUS_INACTIVE = 2,
193
TS_STATUS_THROTTLING = 3,
197
u32 admitted_time_usec;
201
typedef ieee80211_txrx_result (*ieee80211_tx_handler)
202
(struct ieee80211_txrx_data *tx);
204
typedef ieee80211_txrx_result (*ieee80211_rx_handler)
205
(struct ieee80211_txrx_data *rx);
207
struct ieee80211_if_ap {
208
u8 *beacon_head, *beacon_tail;
209
int beacon_head_len, beacon_tail_len;
211
u8 ssid[IEEE80211_MAX_SSID_LEN];
214
size_t generic_elem_len;
216
/* yes, this looks ugly, but guarantees that we can later use
218
* NB: don't ever use set_bit, use bss_tim_set/bss_tim_clear! */
219
u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)];
220
atomic_t num_sta_ps; /* number of stations in PS mode */
221
struct sk_buff_head ps_bc_buf;
222
int dtim_period, dtim_count;
223
int force_unicast_rateidx; /* forced TX rateidx for unicast frames */
224
int max_ratectrl_rateidx; /* max TX rateidx for rate control */
225
int num_beacons; /* number of TXed beacon frames for this BSS */
228
struct ieee80211_if_wds {
229
u8 remote_addr[ETH_ALEN];
230
struct sta_info *sta;
233
struct ieee80211_if_vlan {
237
struct ieee80211_if_sta {
239
IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
240
IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED,
241
IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED,
242
IEEE80211_CHANNEL_SWITCH
244
struct timer_list timer;
245
struct work_struct work;
246
struct timer_list admit_timer; /* Recompute EDCA admitted time */
247
u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
248
u8 ssid[IEEE80211_MAX_SSID_LEN];
252
u8 *extra_ie; /* to be added to the end of AssocReq */
254
u8 nick[IW_ESSID_MAX_SIZE];
256
/* The last AssocReq/Resp IEs */
257
u8 *assocreq_ies, *assocresp_ies;
258
size_t assocreq_ies_len, assocresp_ies_len;
260
int auth_tries, assoc_tries;
262
unsigned int ssid_set:1;
263
unsigned int bssid_set:1;
264
unsigned int prev_bssid_set:1;
265
unsigned int authenticated:1;
266
unsigned int associated:1;
267
unsigned int probereq_poll:1;
268
unsigned int create_ibss:1;
269
unsigned int mixed_cell:1;
270
unsigned int wmm_enabled:1;
271
unsigned int ht_enabled:1;
272
unsigned int auto_ssid_sel:1;
273
unsigned int auto_bssid_sel:1;
274
unsigned int auto_channel_sel:1;
275
#define IEEE80211_STA_REQ_SCAN 0
276
#define IEEE80211_STA_REQ_AUTH 1
277
#define IEEE80211_STA_REQ_RUN 2
278
unsigned long request;
279
struct sk_buff_head skb_queue;
282
unsigned long last_probe;
284
#define IEEE80211_AUTH_ALG_OPEN BIT(0)
285
#define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1)
286
#define IEEE80211_AUTH_ALG_LEAP BIT(2)
287
unsigned int auth_algs; /* bitfield of allowed auth algs */
288
int auth_alg; /* currently used IEEE 802.11 authentication algorithm */
289
int auth_transaction;
291
unsigned long ibss_join_req;
292
struct sk_buff *probe_resp; /* ProbeResp template for IBSS */
295
u32 last_rate; /* last tx data rate value. management and multi cast frame
298
int wmm_last_param_set;
300
u32 dot11EDCAAveragingPeriod;
301
u32 MPDUExchangeTime;
302
#define STA_TSID_NUM 16
303
#define STA_TSDIR_NUM 2
304
/* EDCA: 0~7, HCCA: 8~15 */
305
struct sta_ts_data ts_data[STA_TSID_NUM][STA_TSDIR_NUM];
306
#ifdef CONFIG_MAC80211_DEBUGFS
307
struct ieee80211_elem_tspec tspec;
308
u8 dls_mac[ETH_ALEN];
310
struct ieee80211_channel *switch_channel;
314
struct ieee80211_sub_if_data {
315
struct list_head list;
318
struct wireless_dev wdev;
320
struct net_device *dev;
321
struct ieee80211_local *local;
324
unsigned int allmulti:1;
325
unsigned int promisc:1;
326
unsigned int use_protection:1; /* CTS protect ERP frames */
328
struct net_device_stats stats;
329
int drop_unencrypted;
330
int eapol; /* 0 = process EAPOL frames as normal data frames,
331
* 1 = send EAPOL frames through wlan#ap to hostapd
333
int ieee802_1x; /* IEEE 802.1X PAE - drop packet to/from unauthorized
338
/* Fragment table for host-based reassembly */
339
struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX];
340
unsigned int fragment_next;
342
#define NUM_DEFAULT_KEYS 4
343
struct ieee80211_key *keys[NUM_DEFAULT_KEYS];
344
struct ieee80211_key *default_key;
346
struct ieee80211_if_ap *bss; /* BSS that this device belongs to */
349
struct ieee80211_if_ap ap;
350
struct ieee80211_if_wds wds;
351
struct ieee80211_if_vlan vlan;
352
struct ieee80211_if_sta sta;
357
#ifdef CONFIG_MAC80211_DEBUGFS
358
struct dentry *debugfsdir;
361
struct dentry *channel_use;
362
struct dentry *drop_unencrypted;
363
struct dentry *eapol;
364
struct dentry *ieee8021_x;
365
struct dentry *state;
366
struct dentry *bssid;
367
struct dentry *prev_bssid;
368
struct dentry *ssid_len;
370
struct dentry *ap_capab;
371
struct dentry *capab;
372
struct dentry *extra_ie_len;
373
struct dentry *auth_tries;
374
struct dentry *assoc_tries;
375
struct dentry *auth_algs;
376
struct dentry *auth_alg;
377
struct dentry *auth_transaction;
378
struct dentry *flags;
379
struct dentry *qos_dir;
381
struct dentry *addts_11e;
382
struct dentry *addts_wmm;
383
struct dentry *delts_11e;
384
struct dentry *delts_wmm;
385
struct dentry *dls_mac;
386
struct dentry *dls_op;
388
struct dentry *tsinfo_dir;
391
struct dentry *direction;
394
struct dentry *tspec_dir;
396
struct dentry *nominal_msdu_size;
397
struct dentry *max_msdu_size;
398
struct dentry *min_service_interval;
399
struct dentry *max_service_interval;
400
struct dentry *inactivity_interval;
401
struct dentry *suspension_interval;
402
struct dentry *service_start_time;
403
struct dentry *min_data_rate;
404
struct dentry *mean_data_rate;
405
struct dentry *peak_data_rate;
406
struct dentry *burst_size;
407
struct dentry *delay_bound;
408
struct dentry *min_phy_rate;
409
struct dentry *surplus_band_allow;
410
struct dentry *medium_time;
414
struct dentry *channel_use;
415
struct dentry *drop_unencrypted;
416
struct dentry *eapol;
417
struct dentry *ieee8021_x;
418
struct dentry *num_sta_ps;
419
struct dentry *dtim_period;
420
struct dentry *dtim_count;
421
struct dentry *num_beacons;
422
struct dentry *force_unicast_rateidx;
423
struct dentry *max_ratectrl_rateidx;
424
struct dentry *num_buffered_multicast;
425
struct dentry *beacon_head_len;
426
struct dentry *beacon_tail_len;
429
struct dentry *channel_use;
430
struct dentry *drop_unencrypted;
431
struct dentry *eapol;
432
struct dentry *ieee8021_x;
436
struct dentry *channel_use;
437
struct dentry *drop_unencrypted;
438
struct dentry *eapol;
439
struct dentry *ieee8021_x;
440
struct dentry *vlan_id;
445
struct dentry *default_key;
450
#define IEEE80211_DEV_TO_SUB_IF(dev) netdev_priv(dev)
453
IEEE80211_RX_MSG = 1,
454
IEEE80211_TX_STATUS_MSG = 2,
457
struct ieee80211_local {
458
/* embed the driver visible part.
459
* don't cast (use the static inlines below), but we keep
460
* it first anyway so they become a no-op */
461
struct ieee80211_hw hw;
463
const struct ieee80211_ops *ops;
465
/* List of registered struct ieee80211_hw_mode */
466
struct list_head modes_list;
468
struct net_device *mdev; /* wmaster# - "master" 802.11 device */
469
struct net_device *apdev; /* wlan#ap - management frames (hostapd) */
472
struct iw_statistics wstats;
474
int tx_headroom; /* required headroom for hardware/radiotap */
477
IEEE80211_DEV_UNINITIALIZED = 0,
478
IEEE80211_DEV_REGISTERED,
479
IEEE80211_DEV_UNREGISTERED,
482
/* Tasklet and skb queue to process calls from IRQ mode. All frames
483
* added to skb_queue will be processed, but frames in
484
* skb_queue_unreliable may be dropped if the total length of these
485
* queues increases over the limit. */
486
#define IEEE80211_IRQSAFE_QUEUE_LIMIT 128
487
struct tasklet_struct tasklet;
488
struct sk_buff_head skb_queue;
489
struct sk_buff_head skb_queue_unreliable;
491
/* Station data structures */
492
spinlock_t sta_lock; /* mutex for STA data structures */
493
int num_sta; /* number of stations in sta_list */
494
struct list_head sta_list;
495
struct list_head deleted_sta_list;
496
struct sta_info *sta_hash[STA_HASH_SIZE];
497
struct timer_list sta_cleanup;
499
unsigned long state[NUM_TX_DATA_QUEUES_11N];
500
struct ieee80211_tx_stored_packet pending_packet[NUM_TX_DATA_QUEUES_11N];
501
struct tasklet_struct tx_pending_tasklet;
503
int mc_count; /* total count of multicast entries in all interfaces */
504
int iff_allmultis, iff_promiscs;
505
/* number of interfaces with corresponding IFF_ flags */
507
struct rate_control_ref *rate_ctrl;
509
int next_mode; /* MODE_IEEE80211*
510
* The mode preference for next channel change. This is
511
* used to select .11g vs. .11b channels (or 4.9 GHz vs.
512
* .11a) when the channel number is not unique. */
514
/* Supported and basic rate filters for different modes. These are
515
* pointers to -1 terminated lists and rates in 100 kbps units. */
516
int *supp_rates[NUM_IEEE80211_MODES];
517
int *basic_rates[NUM_IEEE80211_MODES];
520
int fragmentation_threshold;
521
int short_retry_limit; /* dot11ShortRetryLimit */
522
int long_retry_limit; /* dot11LongRetryLimit */
523
int short_preamble; /* use short preamble with IEEE 802.11b */
525
struct crypto_blkcipher *wep_tx_tfm;
526
struct crypto_blkcipher *wep_rx_tfm;
528
int key_tx_rx_threshold; /* number of times any key can be used in TX
529
* or RX before generating a rekey
530
* notification; 0 = notification disabled. */
532
int bridge_packets; /* bridge packets between associated stations and
533
* deliver multicast frames both back to wireless
534
* media and to the local net stack */
536
ieee80211_rx_handler *rx_pre_handlers;
537
ieee80211_rx_handler *rx_handlers;
538
ieee80211_tx_handler *tx_handlers;
540
rwlock_t sub_if_lock; /* Protects sub_if_list. Cannot be taken under
541
* sta_bss_lock or sta_lock. */
542
struct list_head sub_if_list;
545
int scan_channel_idx;
546
enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
547
unsigned long last_scan_completed;
548
struct delayed_work scan_work;
549
struct net_device *scan_dev;
550
struct ieee80211_channel *oper_channel, *scan_channel;
551
struct ieee80211_hw_mode *oper_hw_mode, *scan_hw_mode;
552
u8 scan_ssid[IEEE80211_MAX_SSID_LEN];
553
size_t scan_ssid_len;
554
#define IEEE80211_MAX_TXPOWER 50
556
struct list_head sta_bss_list;
557
struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE];
558
spinlock_t sta_bss_lock;
559
#define IEEE80211_SCAN_MATCH_SSID BIT(0)
560
#define IEEE80211_SCAN_WPA_ONLY BIT(1)
561
#define IEEE80211_SCAN_EXTRA_INFO BIT(2)
565
/* dot11CountersTable */
566
u32 dot11TransmittedFragmentCount;
567
u32 dot11MulticastTransmittedFrameCount;
568
u32 dot11FailedCount;
570
u32 dot11MultipleRetryCount;
571
u32 dot11FrameDuplicateCount;
572
u32 dot11ReceivedFragmentCount;
573
u32 dot11MulticastReceivedFrameCount;
574
u32 dot11TransmittedFrameCount;
575
u32 dot11WEPUndecryptableCount;
577
#ifdef CONFIG_MAC80211_LEDS
578
int tx_led_counter, rx_led_counter;
579
struct led_trigger *tx_led, *rx_led;
580
char tx_led_name[32], rx_led_name[32];
586
struct timer_list stat_timer;
588
#ifdef CONFIG_MAC80211_DEBUGFS
589
struct work_struct sta_debugfs_add;
593
STA_ANTENNA_SEL_AUTO = 0,
594
STA_ANTENNA_SEL_SW_CTRL = 1,
595
STA_ANTENNA_SEL_SW_CTRL_DEBUG = 2
598
#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
599
/* TX/RX handler statistics */
600
unsigned int tx_handlers_drop;
601
unsigned int tx_handlers_queued;
602
unsigned int tx_handlers_drop_unencrypted;
603
unsigned int tx_handlers_drop_fragment;
604
unsigned int tx_handlers_drop_wep;
605
unsigned int tx_handlers_drop_not_assoc;
606
unsigned int tx_handlers_drop_unauth_port;
607
unsigned int rx_handlers_drop;
608
unsigned int rx_handlers_queued;
609
unsigned int rx_handlers_drop_nullfunc;
610
unsigned int rx_handlers_drop_defrag;
611
unsigned int rx_handlers_drop_short;
612
unsigned int rx_handlers_drop_passive_scan;
613
unsigned int tx_expand_skb_head;
614
unsigned int tx_expand_skb_head_cloned;
615
unsigned int rx_expand_skb_head;
616
unsigned int rx_expand_skb_head2;
617
unsigned int rx_handlers_fragments;
618
unsigned int tx_status_drop;
619
unsigned int wme_rx_queue[NUM_RX_DATA_QUEUES];
620
unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES];
621
#define I802_DEBUG_INC(c) (c)++
622
#else /* CONFIG_MAC80211_DEBUG_COUNTERS */
623
#define I802_DEBUG_INC(c) do { } while (0)
624
#endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
627
int default_wep_only; /* only default WEP keys are used with this
628
* interface; this is used to decide when hwaccel
629
* can be used with default keys */
630
int total_ps_buffered; /* total number of all buffered unicast and
631
* multicast packets for power saving stations
633
int allow_broadcast_always; /* whether to allow TX of broadcast frames
634
* even when there are no associated STAs
637
int wifi_wme_noack_test;
638
unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */
640
unsigned int enabled_modes; /* bitfield of allowed modes;
642
unsigned int hw_modes; /* bitfield of supported hardware modes;
647
#ifdef CONFIG_MAC80211_DEBUGFS
648
struct local_debugfsdentries {
649
struct dentry *channel;
650
struct dentry *frequency;
651
struct dentry *radar_detect;
652
struct dentry *antenna_sel_tx;
653
struct dentry *antenna_sel_rx;
654
struct dentry *bridge_packets;
655
struct dentry *key_tx_rx_threshold;
656
struct dentry *rts_threshold;
657
struct dentry *fragmentation_threshold;
658
struct dentry *short_retry_limit;
659
struct dentry *long_retry_limit;
660
struct dentry *total_ps_buffered;
662
struct dentry *wep_iv;
663
struct dentry *tx_power_reduction;
664
struct dentry *modes;
665
struct dentry *statistics;
666
struct local_debugfsdentries_statsdentries {
667
struct dentry *transmitted_fragment_count;
668
struct dentry *multicast_transmitted_frame_count;
669
struct dentry *failed_count;
670
struct dentry *retry_count;
671
struct dentry *multiple_retry_count;
672
struct dentry *frame_duplicate_count;
673
struct dentry *received_fragment_count;
674
struct dentry *multicast_received_frame_count;
675
struct dentry *transmitted_frame_count;
676
struct dentry *wep_undecryptable_count;
677
struct dentry *num_scans;
678
#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
679
struct dentry *tx_handlers_drop;
680
struct dentry *tx_handlers_queued;
681
struct dentry *tx_handlers_drop_unencrypted;
682
struct dentry *tx_handlers_drop_fragment;
683
struct dentry *tx_handlers_drop_wep;
684
struct dentry *tx_handlers_drop_not_assoc;
685
struct dentry *tx_handlers_drop_unauth_port;
686
struct dentry *rx_handlers_drop;
687
struct dentry *rx_handlers_queued;
688
struct dentry *rx_handlers_drop_nullfunc;
689
struct dentry *rx_handlers_drop_defrag;
690
struct dentry *rx_handlers_drop_short;
691
struct dentry *rx_handlers_drop_passive_scan;
692
struct dentry *tx_expand_skb_head;
693
struct dentry *tx_expand_skb_head_cloned;
694
struct dentry *rx_expand_skb_head;
695
struct dentry *rx_expand_skb_head2;
696
struct dentry *rx_handlers_fragments;
697
struct dentry *tx_status_drop;
698
struct dentry *wme_tx_queue;
699
struct dentry *wme_rx_queue;
701
struct dentry *dot11ACKFailureCount;
702
struct dentry *dot11RTSFailureCount;
703
struct dentry *dot11FCSErrorCount;
704
struct dentry *dot11RTSSuccessCount;
706
struct dentry *stations;
712
enum sta_link_direction {
717
static inline struct ieee80211_local *hw_to_local(
718
struct ieee80211_hw *hw)
720
return container_of(hw, struct ieee80211_local, hw);
723
static inline struct ieee80211_hw *local_to_hw(
724
struct ieee80211_local *local)
729
enum ieee80211_link_state_t {
730
IEEE80211_LINK_STATE_XOFF = 0,
731
IEEE80211_LINK_STATE_PENDING,
732
IEEE80211_LINK_STATE_AGGREGATED,
735
struct sta_attribute {
736
struct attribute attr;
737
ssize_t (*show)(const struct sta_info *, char *buf);
738
ssize_t (*store)(struct sta_info *, const char *buf, size_t count);
741
static inline void __bss_tim_set(struct ieee80211_if_ap *bss, int aid)
744
* This format has ben mandated by the IEEE specifications,
745
* so this line may not be changed to use the __set_bit() format.
747
bss->tim[(aid)/8] |= 1<<((aid) % 8);
750
static inline void bss_tim_set(struct ieee80211_local *local,
751
struct ieee80211_if_ap *bss, int aid)
753
spin_lock_bh(&local->sta_lock);
754
__bss_tim_set(bss, aid);
755
spin_unlock_bh(&local->sta_lock);
758
static inline void __bss_tim_clear(struct ieee80211_if_ap *bss, int aid)
761
* This format has ben mandated by the IEEE specifications,
762
* so this line may not be changed to use the __clear_bit() format.
764
bss->tim[(aid)/8] &= !(1<<((aid) % 8));
767
static inline void bss_tim_clear(struct ieee80211_local *local,
768
struct ieee80211_if_ap *bss, int aid)
770
spin_lock_bh(&local->sta_lock);
771
__bss_tim_clear(bss, aid);
772
spin_unlock_bh(&local->sta_lock);
776
* ieee80211_is_erp_rate - Check if a rate is an ERP rate
777
* @phymode: The PHY-mode for this rate (MODE_IEEE80211...)
778
* @rate: Transmission rate to check, in 100 kbps
780
* Check if a given rate is an Extended Rate PHY (ERP) rate.
782
static inline int ieee80211_is_erp_rate(int phymode, int rate)
784
if (phymode == MODE_IEEE80211G) {
785
if (rate != 10 && rate != 20 &&
786
rate != 55 && rate != 110)
793
int ieee80211_hw_config(struct ieee80211_local *local);
794
int ieee80211_if_config(struct net_device *dev);
795
int ieee80211_if_config_beacon(struct net_device *dev);
796
struct ieee80211_key_conf *
797
ieee80211_key_data2conf(struct ieee80211_local *local,
798
const struct ieee80211_key *data);
799
struct ieee80211_key *ieee80211_key_alloc(struct ieee80211_sub_if_data *sdata,
800
int idx, size_t key_len, gfp_t flags);
801
void ieee80211_key_free(struct ieee80211_key *key);
802
void ieee80211_rx_mgmt(struct ieee80211_local *local, struct sk_buff *skb,
803
struct ieee80211_rx_status *status, u32 msg_type);
804
void ieee80211_prepare_rates(struct ieee80211_local *local,
805
struct ieee80211_hw_mode *mode);
806
void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx);
807
int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr);
808
int ieee80211_monitor_start_xmit(struct sk_buff *skb, struct net_device *dev);
809
int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev);
810
void ieee80211_if_setup(struct net_device *dev);
811
void ieee80211_if_mgmt_setup(struct net_device *dev);
812
int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
814
struct net_device_stats *ieee80211_dev_stats(struct net_device *dev);
816
/* ieee80211_ioctl.c */
817
extern const struct iw_handler_def ieee80211_iw_handler_def;
819
void ieee80211_update_default_wep_only(struct ieee80211_local *local);
822
/* Least common multiple of the used rates (in 100 kbps). This is used to
823
* calculate rate_inv values for each rate so that only integers are needed. */
824
#define CHAN_UTIL_RATE_LCM 95040
825
/* 1 usec is 1/8 * (95040/10) = 1188 */
826
#define CHAN_UTIL_PER_USEC 1188
827
/* Amount of bits to shift the result right to scale the total utilization
828
* to values that will not wrap around 32-bit integers. */
829
#define CHAN_UTIL_SHIFT 9
830
/* Theoretical maximum of channel utilization counter in 10 ms (stat_time=1):
831
* (CHAN_UTIL_PER_USEC * 10000) >> CHAN_UTIL_SHIFT = 23203. So dividing the
832
* raw value with about 23 should give utilization in 10th of a percentage
833
* (1/1000). However, utilization is only estimated and not all intervals
834
* between frames etc. are calculated. 18 seems to give numbers that are closer
835
* to the real maximum. */
836
#define CHAN_UTIL_PER_10MS 18
837
#define CHAN_UTIL_HDR_LONG (202 * CHAN_UTIL_PER_USEC)
838
#define CHAN_UTIL_HDR_SHORT (40 * CHAN_UTIL_PER_USEC)
841
/* ieee80211_ioctl.c */
842
int ieee80211_set_compression(struct ieee80211_local *local,
843
struct net_device *dev, struct sta_info *sta);
844
int ieee80211_set_channel(struct ieee80211_local *local, int channel, int freq);
845
/* ieee80211_sta.c */
846
void ieee80211_sta_timer(unsigned long data);
847
void ieee80211_sta_work(struct work_struct *work);
848
void ieee80211_admit_refresh(unsigned long ptr);
849
void ieee80211_sta_scan_work(struct work_struct *work);
850
void ieee80211_sta_rx_mgmt(struct net_device *dev, struct sk_buff *skb,
851
struct ieee80211_rx_status *rx_status);
852
int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len);
853
int ieee80211_sta_get_ssid(struct net_device *dev, char *ssid, size_t *len);
854
int ieee80211_sta_set_bssid(struct net_device *dev, u8 *bssid);
855
int ieee80211_sta_req_scan(struct net_device *dev, u8 *ssid, size_t ssid_len);
856
void ieee80211_sta_req_auth(struct net_device *dev,
857
struct ieee80211_if_sta *ifsta);
858
int ieee80211_sta_scan_results(struct net_device *dev, char *buf, size_t len);
859
ieee80211_txrx_result ieee80211_sta_rx_scan(struct net_device *dev,
861
struct ieee80211_rx_status *rx_status);
862
void ieee80211_rx_bss_list_init(struct net_device *dev);
863
void ieee80211_rx_bss_list_deinit(struct net_device *dev);
864
int ieee80211_sta_set_extra_ie(struct net_device *dev, char *ie, size_t len);
865
struct sta_info * ieee80211_ibss_add_sta(struct net_device *dev,
866
struct sk_buff *skb, u8 *bssid,
868
int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason);
869
int ieee80211_sta_disassociate(struct net_device *dev, u16 reason);
870
void ieee80211_send_addba_request(struct net_device *dev, u8 *da, u16 tid,
871
u8 dialog_token, u16 start_seq_num,
872
u16 agg_size,u16 timeout);
873
void ieee80211_send_delba(struct net_device *dev, u8 *da, u16 tid,
874
u16 initiator, u16 reason_code);
875
void ieee80211_send_addts(struct net_device *dev,
876
struct ieee80211_if_sta *ifsta,
877
struct ieee80211_elem_tspec *tspec);
878
void wmm_send_addts(struct net_device *dev,
879
struct ieee80211_if_sta *ifsta,
880
struct ieee80211_elem_tspec *tspec);
881
void ieee80211_send_delts(struct net_device *dev,
882
struct ieee80211_if_sta *ifsta,
883
struct ieee80211_elem_tspec *tp);
884
void wmm_send_delts(struct net_device *dev,
885
struct ieee80211_if_sta *ifsta,
886
struct ieee80211_elem_tspec *tp);
887
void ieee80211_send_dls_req(struct net_device *dev,
888
struct ieee80211_if_sta *ifsta,
889
u8 *addr, u16 timeout);
890
void ieee80211_send_dls_teardown(struct net_device *dev,
891
struct ieee80211_if_sta *ifsta,
892
u8 *mac, u16 reason);
893
struct sta_info *dls_info_get(struct ieee80211_local *local, u8 *addr);
894
void dls_info_add(struct ieee80211_if_sta *ifsta, struct sta_info *dls);
895
void dls_info_stop(struct ieee80211_if_sta *ifsta);
896
int dls_link_status(struct ieee80211_local *local, u8 *addr);
897
void ieee80211_sta_stop_rx_BA_session(struct net_device *dev,u8 *da,
898
u16 tid, u16 initiator, u16 reason);
899
ieee80211_txrx_result ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
900
struct ieee80211_txrx_data *rx, struct tid_ht_agg_info_rx *tid_rx_info,
901
struct sk_buff *skb, u16 mpdu_seq_num, int bar_req);
904
void ieee80211_rx_mgmt_action(struct net_device *dev,
905
struct ieee80211_if_sta *ifsta,
906
struct ieee80211_mgmt *mgmt,
909
/* ieee80211_iface.c */
910
int ieee80211_if_add(struct net_device *dev, const char *name,
911
struct net_device **new_dev, int type);
912
void ieee80211_if_set_type(struct net_device *dev, int type);
913
void ieee80211_if_reinit(struct net_device *dev);
914
void __ieee80211_if_del(struct ieee80211_local *local,
915
struct ieee80211_sub_if_data *sdata);
916
int ieee80211_if_remove(struct net_device *dev, const char *name, int id);
917
void ieee80211_if_free(struct net_device *dev);
918
void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata);
919
int ieee80211_if_add_mgmt(struct ieee80211_local *local);
920
void ieee80211_if_del_mgmt(struct ieee80211_local *local);
923
void ieee80211_regdomain_init(void);
924
void ieee80211_set_default_regdomain(struct ieee80211_hw_mode *mode);
926
/* for wiphy privid */
927
extern void *mac80211_wiphy_privid;
929
#endif /* IEEE80211_I_H */