00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef IEEE80211_I_H
00013 #define IEEE80211_I_H
00014
00015 #include <linux/kernel.h>
00016 #include <linux/device.h>
00017 #include <linux/if_ether.h>
00018 #include <linux/interrupt.h>
00019 #include <linux/list.h>
00020 #include <linux/netdevice.h>
00021 #include <linux/skbuff.h>
00022 #include <linux/workqueue.h>
00023 #include <linux/types.h>
00024 #include <linux/spinlock.h>
00025 #include <linux/etherdevice.h>
00026 #include <linux/leds.h>
00027 #include <net/ieee80211_radiotap.h>
00028 #include <net/cfg80211.h>
00029 #include <net/mac80211.h>
00030 #include "key.h"
00031 #include "sta_info.h"
00032
00033 struct ieee80211_local;
00034
00035
00036
00037 #define AP_MAX_BC_BUFFER 128
00038
00039
00040
00041
00042 #define TOTAL_MAX_TX_BUFFER 512
00043
00044
00045 #define IEEE80211_ENCRYPT_HEADROOM 8
00046 #define IEEE80211_ENCRYPT_TAILROOM 18
00047
00048
00049
00050
00051
00052 #define IEEE80211_FRAGMENT_MAX 4
00053
00054 #define TU_TO_EXP_TIME(x) (jiffies + usecs_to_jiffies((x) * 1024))
00055
00056 #define IEEE80211_DEFAULT_UAPSD_QUEUES \
00057 (IEEE80211_WMM_IE_STA_QOSINFO_AC_BK | \
00058 IEEE80211_WMM_IE_STA_QOSINFO_AC_BE | \
00059 IEEE80211_WMM_IE_STA_QOSINFO_AC_VI | \
00060 IEEE80211_WMM_IE_STA_QOSINFO_AC_VO)
00061
00062 #define IEEE80211_DEFAULT_MAX_SP_LEN \
00063 IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL
00064
00065 struct ieee80211_fragment_entry {
00066 unsigned long first_frag_time;
00067 unsigned int seq;
00068 unsigned int rx_queue;
00069 unsigned int last_frag;
00070 unsigned int extra_len;
00071 struct sk_buff_head skb_list;
00072 int ccmp;
00073 u8 last_pn[6];
00074 };
00075
00076
00077 struct ieee80211_bss {
00078
00079 size_t ssid_len;
00080 u8 ssid[IEEE80211_MAX_SSID_LEN];
00081
00082 u8 dtim_period;
00083
00084 bool wmm_used;
00085 bool uapsd_supported;
00086
00087 unsigned long last_probe_resp;
00088
00089 #ifdef CONFIG_MAC80211_MESH
00090 u8 *mesh_id;
00091 size_t mesh_id_len;
00092 u8 *mesh_cfg;
00093 #endif
00094
00095 #define IEEE80211_MAX_SUPP_RATES 32
00096 u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
00097 size_t supp_rates_len;
00098
00099
00100
00101
00102
00103
00104
00105 bool has_erp_value;
00106 u8 erp_value;
00107 };
00108
00109 static inline u8 *bss_mesh_cfg(struct ieee80211_bss *bss)
00110 {
00111 #ifdef CONFIG_MAC80211_MESH
00112 return bss->mesh_cfg;
00113 #endif
00114 return NULL;
00115 }
00116
00117 static inline u8 *bss_mesh_id(struct ieee80211_bss *bss)
00118 {
00119 #ifdef CONFIG_MAC80211_MESH
00120 return bss->mesh_id;
00121 #endif
00122 return NULL;
00123 }
00124
00125 static inline u8 bss_mesh_id_len(struct ieee80211_bss *bss)
00126 {
00127 #ifdef CONFIG_MAC80211_MESH
00128 return bss->mesh_id_len;
00129 #endif
00130 return 0;
00131 }
00132
00133
00134 typedef unsigned __bitwise__ ieee80211_tx_result;
00135 #define TX_CONTINUE ((__force ieee80211_tx_result) 0u)
00136 #define TX_DROP ((__force ieee80211_tx_result) 1u)
00137 #define TX_QUEUED ((__force ieee80211_tx_result) 2u)
00138
00139 #define IEEE80211_TX_UNICAST BIT(1)
00140 #define IEEE80211_TX_PS_BUFFERED BIT(2)
00141
00142 struct ieee80211_tx_data {
00143 struct sk_buff *skb;
00144 struct ieee80211_local *local;
00145 struct ieee80211_sub_if_data *sdata;
00146 struct sta_info *sta;
00147 struct ieee80211_key *key;
00148
00149 struct ieee80211_channel *channel;
00150
00151 unsigned int flags;
00152 };
00153
00154
00155 typedef unsigned __bitwise__ ieee80211_rx_result;
00156 #define RX_CONTINUE ((__force ieee80211_rx_result) 0u)
00157 #define RX_DROP_UNUSABLE ((__force ieee80211_rx_result) 1u)
00158 #define RX_DROP_MONITOR ((__force ieee80211_rx_result) 2u)
00159 #define RX_QUEUED ((__force ieee80211_rx_result) 3u)
00160
00174 enum ieee80211_packet_rx_flags {
00175 IEEE80211_RX_IN_SCAN = BIT(0),
00176 IEEE80211_RX_RA_MATCH = BIT(1),
00177 IEEE80211_RX_FRAGMENTED = BIT(2),
00178 IEEE80211_RX_AMSDU = BIT(3),
00179 IEEE80211_RX_MALFORMED_ACTION_FRM = BIT(4),
00180 IEEE80211_RX_DEFERRED_RELEASE = BIT(5),
00181 };
00182
00191 enum ieee80211_rx_flags {
00192 IEEE80211_RX_CMNTR = BIT(0),
00193 };
00194
00195 struct ieee80211_rx_data {
00196 struct sk_buff *skb;
00197 struct ieee80211_local *local;
00198 struct ieee80211_sub_if_data *sdata;
00199 struct sta_info *sta;
00200 struct ieee80211_key *key;
00201
00202 unsigned int flags;
00203
00204
00205
00206
00207
00208
00209 int seqno_idx;
00210
00211
00212
00213
00214
00215
00216
00217 int security_idx;
00218
00219 u32 tkip_iv32;
00220 u16 tkip_iv16;
00221 };
00222
00223 struct beacon_data {
00224 u8 *head, *tail;
00225 int head_len, tail_len;
00226 int dtim_period;
00227 };
00228
00229 struct ieee80211_if_ap {
00230 struct beacon_data __rcu *beacon;
00231
00232 struct list_head vlans;
00233
00234
00235
00236
00237 u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)];
00238 struct sk_buff_head ps_bc_buf;
00239 atomic_t num_sta_ps;
00240 int dtim_count;
00241 bool dtim_bc_mc;
00242 };
00243
00244 struct ieee80211_if_wds {
00245 struct sta_info *sta;
00246 u8 remote_addr[ETH_ALEN];
00247 };
00248
00249 struct ieee80211_if_vlan {
00250 struct list_head list;
00251
00252
00253 struct sta_info __rcu *sta;
00254 };
00255
00256 struct mesh_stats {
00257 __u32 fwded_mcast;
00258 __u32 fwded_unicast;
00259 __u32 fwded_frames;
00260 __u32 dropped_frames_ttl;
00261 __u32 dropped_frames_no_route;
00262 __u32 dropped_frames_congestion;
00263 atomic_t estab_plinks;
00264 };
00265
00266 #define PREQ_Q_F_START 0x1
00267 #define PREQ_Q_F_REFRESH 0x2
00268 struct mesh_preq_queue {
00269 struct list_head list;
00270 u8 dst[ETH_ALEN];
00271 u8 flags;
00272 };
00273
00274 enum ieee80211_work_type {
00275 IEEE80211_WORK_ABORT,
00276 IEEE80211_WORK_DIRECT_PROBE,
00277 IEEE80211_WORK_AUTH,
00278 IEEE80211_WORK_ASSOC_BEACON_WAIT,
00279 IEEE80211_WORK_ASSOC,
00280 IEEE80211_WORK_REMAIN_ON_CHANNEL,
00281 IEEE80211_WORK_OFFCHANNEL_TX,
00282 };
00283
00291 enum work_done_result {
00292 WORK_DONE_DESTROY,
00293 WORK_DONE_REQUEUE,
00294 };
00295
00296 struct ieee80211_work {
00297 struct list_head list;
00298
00299 struct rcu_head rcu_head;
00300
00301 struct ieee80211_sub_if_data *sdata;
00302
00303 enum work_done_result (*done)(struct ieee80211_work *wk,
00304 struct sk_buff *skb);
00305
00306 struct ieee80211_channel *chan;
00307 enum nl80211_channel_type chan_type;
00308
00309 unsigned long timeout;
00310 enum ieee80211_work_type type;
00311
00312 u8 filter_ta[ETH_ALEN];
00313
00314 bool started;
00315
00316 union {
00317 struct {
00318 int tries;
00319 u16 algorithm, transaction;
00320 u8 ssid[IEEE80211_MAX_SSID_LEN];
00321 u8 ssid_len;
00322 u8 key[WLAN_KEY_LEN_WEP104];
00323 u8 key_len, key_idx;
00324 bool privacy;
00325 bool synced;
00326 } probe_auth;
00327 struct {
00328 struct cfg80211_bss *bss;
00329 const u8 *supp_rates;
00330 const u8 *ht_information_ie;
00331 enum ieee80211_smps_mode smps;
00332 int tries;
00333 u16 capability;
00334 u8 prev_bssid[ETH_ALEN];
00335 u8 ssid[IEEE80211_MAX_SSID_LEN];
00336 u8 ssid_len;
00337 u8 supp_rates_len;
00338 bool wmm_used, use_11n, uapsd_used;
00339 bool synced;
00340 } assoc;
00341 struct {
00342 u32 duration;
00343 } remain;
00344 struct {
00345 struct sk_buff *frame;
00346 u32 wait;
00347 bool status;
00348 } offchan_tx;
00349 };
00350
00351 int ie_len;
00352
00353 u8 ie[0];
00354 };
00355
00356
00357 enum ieee80211_sta_flags {
00358 IEEE80211_STA_BEACON_POLL = BIT(0),
00359 IEEE80211_STA_CONNECTION_POLL = BIT(1),
00360 IEEE80211_STA_CONTROL_PORT = BIT(2),
00361 IEEE80211_STA_DISABLE_11N = BIT(4),
00362 IEEE80211_STA_CSA_RECEIVED = BIT(5),
00363 IEEE80211_STA_MFP_ENABLED = BIT(6),
00364 IEEE80211_STA_UAPSD_ENABLED = BIT(7),
00365 IEEE80211_STA_NULLFUNC_ACKED = BIT(8),
00366 IEEE80211_STA_RESET_SIGNAL_AVE = BIT(9),
00367 };
00368
00369 struct ieee80211_if_managed {
00370 struct timer_list timer;
00371 struct timer_list conn_mon_timer;
00372 struct timer_list bcn_mon_timer;
00373 struct timer_list chswitch_timer;
00374 struct work_struct monitor_work;
00375 struct work_struct chswitch_work;
00376 struct work_struct beacon_connection_loss_work;
00377
00378 unsigned long beacon_timeout;
00379 unsigned long probe_timeout;
00380 int probe_send_count;
00381 bool nullfunc_failed;
00382
00383 struct mutex mtx;
00384 struct cfg80211_bss *associated;
00385
00386 u8 bssid[ETH_ALEN];
00387
00388 u16 aid;
00389
00390 unsigned long timers_running;
00391 bool powersave;
00392 bool broken_ap;
00393 enum ieee80211_smps_mode req_smps,
00394 ap_smps,
00395 driver_smps_mode;
00396
00397 struct work_struct request_smps_work;
00398
00399 unsigned int flags;
00400
00401 bool beacon_crc_valid;
00402 u32 beacon_crc;
00403
00404 enum {
00405 IEEE80211_MFP_DISABLED,
00406 IEEE80211_MFP_OPTIONAL,
00407 IEEE80211_MFP_REQUIRED
00408 } mfp;
00409
00410 int wmm_last_param_set;
00411
00412 u8 use_4addr;
00413
00414
00415 int last_beacon_signal;
00416
00417
00418
00419
00420
00421
00422
00423 int ave_beacon_signal;
00424
00425
00426
00427
00428
00429
00430 unsigned int count_beacon_signal;
00431
00432
00433
00434
00435
00436
00437 int last_cqm_event_signal;
00438
00439
00440
00441
00442
00443
00444 int rssi_min_thold, rssi_max_thold;
00445 int last_ave_beacon_signal;
00446 };
00447
00448 struct ieee80211_if_ibss {
00449 struct timer_list timer;
00450
00451 struct mutex mtx;
00452
00453 unsigned long last_scan_completed;
00454
00455 u32 basic_rates;
00456
00457 bool timer_running;
00458
00459 bool fixed_bssid;
00460 bool fixed_channel;
00461 bool privacy;
00462
00463 u8 bssid[ETH_ALEN];
00464 u8 ssid[IEEE80211_MAX_SSID_LEN];
00465 u8 ssid_len, ie_len;
00466 u8 *ie;
00467 struct ieee80211_channel *channel;
00468
00469 unsigned long ibss_join_req;
00470
00471 struct sk_buff __rcu *presp;
00472 struct sk_buff *skb;
00473
00474 enum {
00475 IEEE80211_IBSS_MLME_SEARCH,
00476 IEEE80211_IBSS_MLME_JOINED,
00477 } state;
00478 };
00479
00480 struct ieee80211_if_mesh {
00481 struct timer_list housekeeping_timer;
00482 struct timer_list mesh_path_timer;
00483 struct timer_list mesh_path_root_timer;
00484
00485 unsigned long timers_running;
00486
00487 unsigned long wrkq_flags;
00488
00489 u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN];
00490 size_t mesh_id_len;
00491
00492 u8 mesh_pp_id;
00493
00494 u8 mesh_pm_id;
00495
00496 u8 mesh_cc_id;
00497
00498 u8 mesh_sp_id;
00499
00500 u8 mesh_auth_id;
00501
00502 u32 sn;
00503
00504 u32 preq_id;
00505 atomic_t mpaths;
00506
00507 unsigned long last_sn_update;
00508
00509 unsigned long last_preq;
00510 struct mesh_rmc *rmc;
00511 spinlock_t mesh_preq_queue_lock;
00512 struct mesh_preq_queue preq_queue;
00513 int preq_queue_len;
00514 struct mesh_stats mshstats;
00515 struct mesh_config mshcfg;
00516 u32 mesh_seqnum;
00517 bool accepting_plinks;
00518 int num_gates;
00519 const u8 *ie;
00520 u8 ie_len;
00521 enum {
00522 IEEE80211_MESH_SEC_NONE = 0x0,
00523 IEEE80211_MESH_SEC_AUTHED = 0x1,
00524 IEEE80211_MESH_SEC_SECURED = 0x2,
00525 } security;
00526 };
00527
00528 #ifdef CONFIG_MAC80211_MESH
00529 #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \
00530 do { (msh)->mshstats.name++; } while (0)
00531 #else
00532 #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \
00533 do { } while (0)
00534 #endif
00535
00547 enum ieee80211_sub_if_data_flags {
00548 IEEE80211_SDATA_ALLMULTI = BIT(0),
00549 IEEE80211_SDATA_PROMISC = BIT(1),
00550 IEEE80211_SDATA_OPERATING_GMODE = BIT(2),
00551 IEEE80211_SDATA_DONT_BRIDGE_PACKETS = BIT(3),
00552 IEEE80211_SDATA_DISCONNECT_RESUME = BIT(4),
00553 };
00554
00563 enum ieee80211_sdata_state_bits {
00564 SDATA_STATE_RUNNING,
00565 SDATA_STATE_OFFCHANNEL,
00566 };
00567
00568 struct ieee80211_sub_if_data {
00569 struct list_head list;
00570
00571 struct wireless_dev wdev;
00572
00573
00574 struct list_head key_list;
00575
00576
00577 int crypto_tx_tailroom_needed_cnt;
00578
00579 struct net_device *dev;
00580 struct ieee80211_local *local;
00581
00582 unsigned int flags;
00583
00584 unsigned long state;
00585
00586 int drop_unencrypted;
00587
00588 char name[IFNAMSIZ];
00589
00590
00591
00592
00593
00594 bool ht_opmode_valid;
00595
00596
00597 bool old_idle;
00598
00599
00600 struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX];
00601 unsigned int fragment_next;
00602
00603 struct ieee80211_key __rcu *keys[NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS];
00604 struct ieee80211_key __rcu *default_unicast_key;
00605 struct ieee80211_key __rcu *default_multicast_key;
00606 struct ieee80211_key __rcu *default_mgmt_key;
00607
00608 u16 sequence_number;
00609 __be16 control_port_protocol;
00610 bool control_port_no_encrypt;
00611
00612 struct ieee80211_tx_queue_params tx_conf[IEEE80211_MAX_QUEUES];
00613
00614 struct work_struct work;
00615 struct sk_buff_head skb_queue;
00616
00617 bool arp_filter_state;
00618
00619
00620
00621
00622
00623
00624 struct ieee80211_if_ap *bss;
00625
00626
00627 u32 rc_rateidx_mask[IEEE80211_NUM_BANDS];
00628
00629 union {
00630 struct ieee80211_if_ap ap;
00631 struct ieee80211_if_wds wds;
00632 struct ieee80211_if_vlan vlan;
00633 struct ieee80211_if_managed mgd;
00634 struct ieee80211_if_ibss ibss;
00635 struct ieee80211_if_mesh mesh;
00636 u32 mntr_flags;
00637 } u;
00638
00639 #ifdef CONFIG_MAC80211_DEBUGFS
00640 struct {
00641 struct dentry *dir;
00642 struct dentry *subdir_stations;
00643 struct dentry *default_unicast_key;
00644 struct dentry *default_multicast_key;
00645 struct dentry *default_mgmt_key;
00646 } debugfs;
00647 #endif
00648
00649 struct ieee80211_vif vif;
00650 };
00651
00652 static inline
00653 struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p)
00654 {
00655 return container_of(p, struct ieee80211_sub_if_data, vif);
00656 }
00657
00658 enum sdata_queue_type {
00659 IEEE80211_SDATA_QUEUE_TYPE_FRAME = 0,
00660 IEEE80211_SDATA_QUEUE_AGG_START = 1,
00661 IEEE80211_SDATA_QUEUE_AGG_STOP = 2,
00662 };
00663
00664 enum {
00665 IEEE80211_RX_MSG = 1,
00666 IEEE80211_TX_STATUS_MSG = 2,
00667 IEEE80211_EOSP_MSG = 3,
00668 };
00669
00670 struct skb_eosp_msg_data {
00671 u8 sta[ETH_ALEN], iface[ETH_ALEN];
00672 };
00673
00674 enum queue_stop_reason {
00675 IEEE80211_QUEUE_STOP_REASON_DRIVER,
00676 IEEE80211_QUEUE_STOP_REASON_PS,
00677 IEEE80211_QUEUE_STOP_REASON_CSA,
00678 IEEE80211_QUEUE_STOP_REASON_AGGREGATION,
00679 IEEE80211_QUEUE_STOP_REASON_SUSPEND,
00680 IEEE80211_QUEUE_STOP_REASON_SKB_ADD,
00681 IEEE80211_QUEUE_STOP_REASON_CHTYPE_CHANGE,
00682 };
00683
00684 #ifdef CONFIG_MAC80211_LEDS
00685 struct tpt_led_trigger {
00686 struct led_trigger trig;
00687 char name[32];
00688 const struct ieee80211_tpt_blink *blink_table;
00689 unsigned int blink_table_len;
00690 struct timer_list timer;
00691 unsigned long prev_traffic;
00692 unsigned long tx_bytes, rx_bytes;
00693 unsigned int active, want;
00694 bool running;
00695 };
00696 #endif
00697
00712 enum {
00713 SCAN_SW_SCANNING,
00714 SCAN_HW_SCANNING,
00715 SCAN_OFF_CHANNEL,
00716 SCAN_COMPLETED,
00717 SCAN_ABORTED,
00718 };
00719
00733 enum mac80211_scan_state {
00734 SCAN_DECISION,
00735 SCAN_SET_CHANNEL,
00736 SCAN_SEND_PROBE,
00737 SCAN_LEAVE_OPER_CHANNEL,
00738 SCAN_ENTER_OPER_CHANNEL,
00739 };
00740
00741 struct ieee80211_local {
00742
00743
00744
00745 struct ieee80211_hw hw;
00746
00747 const struct ieee80211_ops *ops;
00748
00749
00750
00751
00752 struct list_head work_list;
00753 struct timer_list work_timer;
00754 struct work_struct work_work;
00755 struct sk_buff_head work_skb_queue;
00756
00757
00758
00759
00760
00761 struct workqueue_struct *workqueue;
00762
00763 unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES];
00764
00765 spinlock_t queue_stop_reason_lock;
00766
00767 int open_count;
00768 int monitors, cooked_mntrs;
00769
00770 int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll,
00771 fif_probe_req;
00772 int probe_req_reg;
00773 unsigned int filter_flags;
00774
00775 bool wiphy_ciphers_allocated;
00776
00777
00778 spinlock_t filter_lock;
00779
00780
00781 struct work_struct reconfig_filter;
00782
00783
00784 struct work_struct recalc_smps;
00785
00786
00787 struct netdev_hw_addr_list mc_list;
00788
00789 bool tim_in_locked_section;
00790
00791
00792
00793
00794
00795
00796
00797 bool suspended;
00798
00799
00800
00801
00802
00803
00804
00805 bool resuming;
00806
00807
00808
00809
00810
00811 bool quiescing;
00812
00813
00814 bool started;
00815
00816
00817 bool wowlan;
00818
00819 int tx_headroom;
00820
00821
00822
00823
00824
00825 #define IEEE80211_IRQSAFE_QUEUE_LIMIT 128
00826 struct tasklet_struct tasklet;
00827 struct sk_buff_head skb_queue;
00828 struct sk_buff_head skb_queue_unreliable;
00829
00830
00831
00832
00833
00834
00835
00836 struct sk_buff_head rx_skb_queue;
00837 bool running_rx_handler;
00838
00839
00840
00841
00842
00843
00844
00845
00846 struct mutex sta_mtx;
00847 spinlock_t sta_lock;
00848 unsigned long num_sta;
00849 struct list_head sta_list, sta_pending_list;
00850 struct sta_info __rcu *sta_hash[STA_HASH_SIZE];
00851 struct timer_list sta_cleanup;
00852 struct work_struct sta_finish_work;
00853 int sta_generation;
00854
00855 struct sk_buff_head pending[IEEE80211_MAX_QUEUES];
00856 struct tasklet_struct tx_pending_tasklet;
00857
00858 atomic_t agg_queue_stop[IEEE80211_MAX_QUEUES];
00859
00860
00861 atomic_t iff_allmultis, iff_promiscs;
00862
00863 struct rate_control_ref *rate_ctrl;
00864
00865 struct crypto_cipher *wep_tx_tfm;
00866 struct crypto_cipher *wep_rx_tfm;
00867 u32 wep_iv;
00868
00869
00870 struct list_head interfaces;
00871 struct mutex iflist_mtx;
00872
00873
00874
00875
00876
00877 struct mutex key_mtx;
00878
00879
00880 struct mutex mtx;
00881
00882
00883 unsigned long scanning;
00884 struct cfg80211_ssid scan_ssid;
00885 struct cfg80211_scan_request *int_scan_req;
00886 struct cfg80211_scan_request *scan_req, *hw_scan_req;
00887 struct ieee80211_channel *scan_channel;
00888 enum ieee80211_band hw_scan_band;
00889 int scan_channel_idx;
00890 int scan_ies_len;
00891
00892 bool sched_scanning;
00893 struct ieee80211_sched_scan_ies sched_scan_ies;
00894 struct work_struct sched_scan_stopped_work;
00895
00896 unsigned long leave_oper_channel_time;
00897 enum mac80211_scan_state next_scan_state;
00898 struct delayed_work scan_work;
00899 struct ieee80211_sub_if_data *scan_sdata;
00900 enum nl80211_channel_type _oper_channel_type;
00901 struct ieee80211_channel *oper_channel, *csa_channel;
00902
00903
00904 struct ieee80211_channel *tmp_channel;
00905 enum nl80211_channel_type tmp_channel_type;
00906
00907
00908
00909 u32 dot11TransmittedFragmentCount;
00910 u32 dot11MulticastTransmittedFrameCount;
00911 u32 dot11FailedCount;
00912 u32 dot11RetryCount;
00913 u32 dot11MultipleRetryCount;
00914 u32 dot11FrameDuplicateCount;
00915 u32 dot11ReceivedFragmentCount;
00916 u32 dot11MulticastReceivedFrameCount;
00917 u32 dot11TransmittedFrameCount;
00918
00919 #ifdef CONFIG_MAC80211_LEDS
00920 int tx_led_counter, rx_led_counter;
00921 struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led;
00922 struct tpt_led_trigger *tpt_led_trigger;
00923 char tx_led_name[32], rx_led_name[32],
00924 assoc_led_name[32], radio_led_name[32];
00925 #endif
00926
00927 #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
00928
00929 unsigned int tx_handlers_drop;
00930 unsigned int tx_handlers_queued;
00931 unsigned int tx_handlers_drop_unencrypted;
00932 unsigned int tx_handlers_drop_fragment;
00933 unsigned int tx_handlers_drop_wep;
00934 unsigned int tx_handlers_drop_not_assoc;
00935 unsigned int tx_handlers_drop_unauth_port;
00936 unsigned int rx_handlers_drop;
00937 unsigned int rx_handlers_queued;
00938 unsigned int rx_handlers_drop_nullfunc;
00939 unsigned int rx_handlers_drop_defrag;
00940 unsigned int rx_handlers_drop_short;
00941 unsigned int rx_handlers_drop_passive_scan;
00942 unsigned int tx_expand_skb_head;
00943 unsigned int tx_expand_skb_head_cloned;
00944 unsigned int rx_expand_skb_head;
00945 unsigned int rx_expand_skb_head2;
00946 unsigned int rx_handlers_fragments;
00947 unsigned int tx_status_drop;
00948 #define I802_DEBUG_INC(c) (c)++
00949 #else
00950 #define I802_DEBUG_INC(c) do { } while (0)
00951 #endif
00952
00953
00954 int total_ps_buffered;
00955
00956
00957 int wifi_wme_noack_test;
00958 unsigned int wmm_acm;
00959
00960
00961
00962
00963
00964
00965 unsigned int uapsd_queues;
00966
00967
00968
00969
00970
00971
00972 unsigned int uapsd_max_sp_len;
00973
00974 bool pspolling;
00975 bool offchannel_ps_enabled;
00976
00977
00978
00979
00980 struct ieee80211_sub_if_data *ps_sdata;
00981 struct work_struct dynamic_ps_enable_work;
00982 struct work_struct dynamic_ps_disable_work;
00983 struct timer_list dynamic_ps_timer;
00984 struct notifier_block network_latency_notifier;
00985 struct notifier_block ifa_notifier;
00986
00987
00988
00989
00990
00991 int dynamic_ps_forced_timeout;
00992 int dynamic_ps_user_timeout;
00993 bool disable_dynamic_ps;
00994
00995 int user_power_level;
00996 int power_constr_level;
00997
00998 enum ieee80211_smps_mode smps_mode;
00999
01000 struct work_struct restart_work;
01001
01002 #ifdef CONFIG_MAC80211_DEBUGFS
01003 struct local_debugfsdentries {
01004 struct dentry *rcdir;
01005 struct dentry *keys;
01006 } debugfs;
01007 #endif
01008
01009 struct ieee80211_channel *hw_roc_channel;
01010 struct net_device *hw_roc_dev;
01011 struct sk_buff *hw_roc_skb, *hw_roc_skb_for_status;
01012 struct work_struct hw_roc_start, hw_roc_done;
01013 enum nl80211_channel_type hw_roc_channel_type;
01014 unsigned int hw_roc_duration;
01015 u32 hw_roc_cookie;
01016 bool hw_roc_for_tx;
01017
01018
01019 struct net_device napi_dev;
01020
01021 struct napi_struct napi;
01022 };
01023
01024 static inline struct ieee80211_sub_if_data *
01025 IEEE80211_DEV_TO_SUB_IF(struct net_device *dev)
01026 {
01027 return netdev_priv(dev);
01028 }
01029
01030
01031 struct ieee80211_ra_tid {
01032 u8 ra[ETH_ALEN];
01033 u16 tid;
01034 };
01035
01036 static inline struct ieee80211_local *hw_to_local(
01037 struct ieee80211_hw *hw)
01038 {
01039 return container_of(hw, struct ieee80211_local, hw);
01040 }
01041
01042 static inline struct ieee80211_hw *local_to_hw(
01043 struct ieee80211_local *local)
01044 {
01045 return &local->hw;
01046 }
01047
01048
01049 static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
01050 {
01051 return compare_ether_addr(raddr, addr) == 0 ||
01052 is_broadcast_ether_addr(raddr);
01053 }
01054
01055
01056 int ieee80211_hw_config(struct ieee80211_local *local, u32 changed);
01057 void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx);
01058 void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
01059 u32 changed);
01060 void ieee80211_configure_filter(struct ieee80211_local *local);
01061 u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata);
01062
01063
01064 void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata);
01065 int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
01066 struct cfg80211_auth_request *req);
01067 int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
01068 struct cfg80211_assoc_request *req);
01069 int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
01070 struct cfg80211_deauth_request *req,
01071 void *cookie);
01072 int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
01073 struct cfg80211_disassoc_request *req,
01074 void *cookie);
01075 void ieee80211_send_pspoll(struct ieee80211_local *local,
01076 struct ieee80211_sub_if_data *sdata);
01077 void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency);
01078 int ieee80211_max_network_latency(struct notifier_block *nb,
01079 unsigned long data, void *dummy);
01080 int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata);
01081 void ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
01082 struct ieee80211_channel_sw_ie *sw_elem,
01083 struct ieee80211_bss *bss,
01084 u64 timestamp);
01085 void ieee80211_sta_quiesce(struct ieee80211_sub_if_data *sdata);
01086 void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata);
01087 void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata);
01088 void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
01089 struct sk_buff *skb);
01090 void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata);
01091 void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata);
01092
01093
01094 void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local);
01095 void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata);
01096 struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
01097 u8 *bssid, u8 *addr, u32 supp_rates,
01098 gfp_t gfp);
01099 int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
01100 struct cfg80211_ibss_params *params);
01101 int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata);
01102 void ieee80211_ibss_quiesce(struct ieee80211_sub_if_data *sdata);
01103 void ieee80211_ibss_restart(struct ieee80211_sub_if_data *sdata);
01104 void ieee80211_ibss_work(struct ieee80211_sub_if_data *sdata);
01105 void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
01106 struct sk_buff *skb);
01107
01108
01109 void ieee80211_mesh_work(struct ieee80211_sub_if_data *sdata);
01110 void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
01111 struct sk_buff *skb);
01112
01113
01114 void ieee80211_scan_work(struct work_struct *work);
01115 int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata,
01116 const u8 *ssid, u8 ssid_len,
01117 struct ieee80211_channel *chan);
01118 int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
01119 struct cfg80211_scan_request *req);
01120 void ieee80211_scan_cancel(struct ieee80211_local *local);
01121 ieee80211_rx_result
01122 ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);
01123
01124 void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local);
01125 struct ieee80211_bss *
01126 ieee80211_bss_info_update(struct ieee80211_local *local,
01127 struct ieee80211_rx_status *rx_status,
01128 struct ieee80211_mgmt *mgmt,
01129 size_t len,
01130 struct ieee802_11_elems *elems,
01131 struct ieee80211_channel *channel,
01132 bool beacon);
01133 struct ieee80211_bss *
01134 ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq,
01135 u8 *ssid, u8 ssid_len);
01136 void ieee80211_rx_bss_put(struct ieee80211_local *local,
01137 struct ieee80211_bss *bss);
01138
01139
01140 int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
01141 struct cfg80211_sched_scan_request *req);
01142 int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata);
01143 void ieee80211_sched_scan_stopped_work(struct work_struct *work);
01144
01145
01146 void ieee80211_offchannel_stop_beaconing(struct ieee80211_local *local);
01147 void ieee80211_offchannel_stop_station(struct ieee80211_local *local);
01148 void ieee80211_offchannel_return(struct ieee80211_local *local,
01149 bool enable_beaconing);
01150 void ieee80211_hw_roc_setup(struct ieee80211_local *local);
01151
01152
01153 int ieee80211_iface_init(void);
01154 void ieee80211_iface_exit(void);
01155 int ieee80211_if_add(struct ieee80211_local *local, const char *name,
01156 struct net_device **new_dev, enum nl80211_iftype type,
01157 struct vif_params *params);
01158 int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
01159 enum nl80211_iftype type);
01160 void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata);
01161 void ieee80211_remove_interfaces(struct ieee80211_local *local);
01162 u32 __ieee80211_recalc_idle(struct ieee80211_local *local);
01163 void ieee80211_recalc_idle(struct ieee80211_local *local);
01164 void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata,
01165 const int offset);
01166
01167 static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata)
01168 {
01169 return test_bit(SDATA_STATE_RUNNING, &sdata->state);
01170 }
01171
01172
01173 void ieee80211_clear_tx_pending(struct ieee80211_local *local);
01174 void ieee80211_tx_pending(unsigned long data);
01175 netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
01176 struct net_device *dev);
01177 netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
01178 struct net_device *dev);
01179
01180
01181 void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband,
01182 struct ieee80211_ht_cap *ht_cap_ie,
01183 struct ieee80211_sta_ht_cap *ht_cap);
01184 void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,
01185 const u8 *da, u16 tid,
01186 u16 initiator, u16 reason_code);
01187 int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata,
01188 enum ieee80211_smps_mode smps, const u8 *da,
01189 const u8 *bssid);
01190 void ieee80211_request_smps_work(struct work_struct *work);
01191
01192 void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
01193 u16 initiator, u16 reason, bool stop);
01194 void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
01195 u16 initiator, u16 reason, bool stop);
01196 void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta, bool tx);
01197 void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
01198 struct sta_info *sta,
01199 struct ieee80211_mgmt *mgmt, size_t len);
01200 void ieee80211_process_addba_resp(struct ieee80211_local *local,
01201 struct sta_info *sta,
01202 struct ieee80211_mgmt *mgmt,
01203 size_t len);
01204 void ieee80211_process_addba_request(struct ieee80211_local *local,
01205 struct sta_info *sta,
01206 struct ieee80211_mgmt *mgmt,
01207 size_t len);
01208
01209 int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
01210 enum ieee80211_back_parties initiator,
01211 bool tx);
01212 int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
01213 enum ieee80211_back_parties initiator,
01214 bool tx);
01215 void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid);
01216 void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid);
01217 void ieee80211_ba_session_work(struct work_struct *work);
01218 void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid);
01219 void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid);
01220
01221
01222 void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
01223 struct ieee80211_mgmt *mgmt,
01224 size_t len);
01225
01226
01227 int ieee80211_reconfig(struct ieee80211_local *local);
01228 void ieee80211_stop_device(struct ieee80211_local *local);
01229
01230 #ifdef CONFIG_PM
01231 int __ieee80211_suspend(struct ieee80211_hw *hw,
01232 struct cfg80211_wowlan *wowlan);
01233
01234 static inline int __ieee80211_resume(struct ieee80211_hw *hw)
01235 {
01236 struct ieee80211_local *local = hw_to_local(hw);
01237
01238 WARN(test_bit(SCAN_HW_SCANNING, &local->scanning),
01239 "%s: resume with hardware scan still in progress\n",
01240 wiphy_name(hw->wiphy));
01241
01242 return ieee80211_reconfig(hw_to_local(hw));
01243 }
01244 #else
01245 static inline int __ieee80211_suspend(struct ieee80211_hw *hw,
01246 struct cfg80211_wowlan *wowlan)
01247 {
01248 return 0;
01249 }
01250
01251 static inline int __ieee80211_resume(struct ieee80211_hw *hw)
01252 {
01253 return 0;
01254 }
01255 #endif
01256
01257
01258 extern void *mac80211_wiphy_privid;
01259 u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len,
01260 enum nl80211_iftype type);
01261 int ieee80211_frame_duration(struct ieee80211_local *local, size_t len,
01262 int rate, int erp, int short_preamble);
01263 void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx,
01264 struct ieee80211_hdr *hdr, const u8 *tsc,
01265 gfp_t gfp);
01266 void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata);
01267 void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);
01268 void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);
01269 void ieee802_11_parse_elems(u8 *start, size_t len,
01270 struct ieee802_11_elems *elems);
01271 u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
01272 struct ieee802_11_elems *elems,
01273 u64 filter, u32 crc);
01274 u32 ieee80211_mandatory_rates(struct ieee80211_local *local,
01275 enum ieee80211_band band);
01276
01277 void ieee80211_dynamic_ps_enable_work(struct work_struct *work);
01278 void ieee80211_dynamic_ps_disable_work(struct work_struct *work);
01279 void ieee80211_dynamic_ps_timer(unsigned long data);
01280 void ieee80211_send_nullfunc(struct ieee80211_local *local,
01281 struct ieee80211_sub_if_data *sdata,
01282 int powersave);
01283 void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata,
01284 struct ieee80211_hdr *hdr);
01285 void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,
01286 struct ieee80211_hdr *hdr, bool ack);
01287 void ieee80211_beacon_connection_loss_work(struct work_struct *work);
01288
01289 void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw,
01290 enum queue_stop_reason reason);
01291 void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw,
01292 enum queue_stop_reason reason);
01293 void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue,
01294 enum queue_stop_reason reason);
01295 void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue,
01296 enum queue_stop_reason reason);
01297 void ieee80211_add_pending_skb(struct ieee80211_local *local,
01298 struct sk_buff *skb);
01299 void ieee80211_add_pending_skbs(struct ieee80211_local *local,
01300 struct sk_buff_head *skbs);
01301 void ieee80211_add_pending_skbs_fn(struct ieee80211_local *local,
01302 struct sk_buff_head *skbs,
01303 void (*fn)(void *data), void *data);
01304
01305 void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
01306 u16 transaction, u16 auth_alg,
01307 u8 *extra, size_t extra_len, const u8 *bssid,
01308 const u8 *key, u8 key_len, u8 key_idx);
01309 int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
01310 const u8 *ie, size_t ie_len,
01311 enum ieee80211_band band, u32 rate_mask,
01312 u8 channel);
01313 struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
01314 u8 *dst, u32 ratemask,
01315 const u8 *ssid, size_t ssid_len,
01316 const u8 *ie, size_t ie_len,
01317 bool directed);
01318 void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
01319 const u8 *ssid, size_t ssid_len,
01320 const u8 *ie, size_t ie_len,
01321 u32 ratemask, bool directed, bool no_cck);
01322
01323 void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata,
01324 const size_t supp_rates_len,
01325 const u8 *supp_rates);
01326 u32 ieee80211_sta_get_rates(struct ieee80211_local *local,
01327 struct ieee802_11_elems *elems,
01328 enum ieee80211_band band);
01329 int __ieee80211_request_smps(struct ieee80211_sub_if_data *sdata,
01330 enum ieee80211_smps_mode smps_mode);
01331 void ieee80211_recalc_smps(struct ieee80211_local *local);
01332
01333 size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
01334 const u8 *ids, int n_ids, size_t offset);
01335 size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset);
01336
01337
01338 void ieee80211_work_init(struct ieee80211_local *local);
01339 void ieee80211_add_work(struct ieee80211_work *wk);
01340 void free_work(struct ieee80211_work *wk);
01341 void ieee80211_work_purge(struct ieee80211_sub_if_data *sdata);
01342 ieee80211_rx_result ieee80211_work_rx_mgmt(struct ieee80211_sub_if_data *sdata,
01343 struct sk_buff *skb);
01344 int ieee80211_wk_remain_on_channel(struct ieee80211_sub_if_data *sdata,
01345 struct ieee80211_channel *chan,
01346 enum nl80211_channel_type channel_type,
01347 unsigned int duration, u64 *cookie);
01348 int ieee80211_wk_cancel_remain_on_channel(
01349 struct ieee80211_sub_if_data *sdata, u64 cookie);
01350
01351
01352 enum ieee80211_chan_mode {
01353 CHAN_MODE_UNDEFINED,
01354 CHAN_MODE_HOPPING,
01355 CHAN_MODE_FIXED,
01356 };
01357
01358 enum ieee80211_chan_mode
01359 ieee80211_get_channel_mode(struct ieee80211_local *local,
01360 struct ieee80211_sub_if_data *ignore);
01361 bool ieee80211_set_channel_type(struct ieee80211_local *local,
01362 struct ieee80211_sub_if_data *sdata,
01363 enum nl80211_channel_type chantype);
01364
01365 #ifdef CONFIG_MAC80211_NOINLINE
01366 #define debug_noinline noinline
01367 #else
01368 #define debug_noinline
01369 #endif
01370
01371 #endif