ieee80211_i.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2002-2005, Instant802 Networks, Inc.
00003  * Copyright 2005, Devicescape Software, Inc.
00004  * Copyright 2006-2007  Jiri Benc <jbenc@suse.cz>
00005  * Copyright 2007-2010  Johannes Berg <johannes@sipsolutions.net>
00006  *
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License version 2 as
00009  * published by the Free Software Foundation.
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 <linux/idr.h>
00028 #include <net/ieee80211_radiotap.h>
00029 #include <net/cfg80211.h>
00030 #include <net/mac80211.h>
00031 #include "key.h"
00032 #include "sta_info.h"
00033 
00034 struct ieee80211_local;
00035 
00036 /* Maximum number of broadcast/multicast frames to buffer when some of the
00037  * associated stations are using power saving. */
00038 #define AP_MAX_BC_BUFFER 128
00039 
00040 /* Maximum number of frames buffered to all STAs, including multicast frames.
00041  * Note: increasing this limit increases the potential memory requirement. Each
00042  * frame can be up to about 2 kB long. */
00043 #define TOTAL_MAX_TX_BUFFER 512
00044 
00045 /* Required encryption head and tailroom */
00046 #define IEEE80211_ENCRYPT_HEADROOM 8
00047 #define IEEE80211_ENCRYPT_TAILROOM 18
00048 
00049 /* IEEE 802.11 (Ch. 9.5 Defragmentation) requires support for concurrent
00050  * reception of at least three fragmented frames. This limit can be increased
00051  * by changing this define, at the cost of slower frame reassembly and
00052  * increased memory use (about 2 kB of RAM per entry). */
00053 #define IEEE80211_FRAGMENT_MAX 4
00054 
00055 #define TU_TO_JIFFIES(x)        (usecs_to_jiffies((x) * 1024))
00056 #define TU_TO_EXP_TIME(x)       (jiffies + TU_TO_JIFFIES(x))
00057 
00058 #define IEEE80211_DEFAULT_UAPSD_QUEUES \
00059         (IEEE80211_WMM_IE_STA_QOSINFO_AC_BK |   \
00060          IEEE80211_WMM_IE_STA_QOSINFO_AC_BE |   \
00061          IEEE80211_WMM_IE_STA_QOSINFO_AC_VI |   \
00062          IEEE80211_WMM_IE_STA_QOSINFO_AC_VO)
00063 
00064 #define IEEE80211_DEFAULT_MAX_SP_LEN            \
00065         IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL
00066 
00067 struct ieee80211_fragment_entry {
00068         unsigned long first_frag_time;
00069         unsigned int seq;
00070         unsigned int rx_queue;
00071         unsigned int last_frag;
00072         unsigned int extra_len;
00073         struct sk_buff_head skb_list;
00074         int ccmp; /* Whether fragments were encrypted with CCMP */
00075         u8 last_pn[6]; /* PN of the last fragment if CCMP was used */
00076 };
00077 
00078 
00079 struct ieee80211_bss {
00080         /* don't want to look up all the time */
00081         size_t ssid_len;
00082         u8 ssid[IEEE80211_MAX_SSID_LEN];
00083 
00084         u8 dtim_period;
00085 
00086         bool wmm_used;
00087         bool uapsd_supported;
00088 
00089         unsigned long last_probe_resp;
00090 
00091 #ifdef CONFIG_MAC80211_MESH
00092         u8 *mesh_id;
00093         size_t mesh_id_len;
00094         u8 *mesh_cfg;
00095 #endif
00096 
00097 #define IEEE80211_MAX_SUPP_RATES 32
00098         u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
00099         size_t supp_rates_len;
00100 
00101         /*
00102          * During association, we save an ERP value from a probe response so
00103          * that we can feed ERP info to the driver when handling the
00104          * association completes. these fields probably won't be up-to-date
00105          * otherwise, you probably don't want to use them.
00106          */
00107         bool has_erp_value;
00108         u8 erp_value;
00109 
00110         /* Keep track of the corruption of the last beacon/probe response. */
00111         u8 corrupt_data;
00112 
00113         /* Keep track of what bits of information we have valid info for. */
00114         u8 valid_data;
00115 };
00116 
00125 enum ieee80211_bss_corrupt_data_flags {
00126         IEEE80211_BSS_CORRUPT_BEACON            = BIT(0),
00127         IEEE80211_BSS_CORRUPT_PROBE_RESP        = BIT(1)
00128 };
00129 
00142 enum ieee80211_bss_valid_data_flags {
00143         IEEE80211_BSS_VALID_DTIM                = BIT(0),
00144         IEEE80211_BSS_VALID_WMM                 = BIT(1),
00145         IEEE80211_BSS_VALID_RATES               = BIT(2),
00146         IEEE80211_BSS_VALID_ERP                 = BIT(3)
00147 };
00148 
00149 static inline u8 *bss_mesh_cfg(struct ieee80211_bss *bss)
00150 {
00151 #ifdef CONFIG_MAC80211_MESH
00152         return bss->mesh_cfg;
00153 #endif
00154         return NULL;
00155 }
00156 
00157 static inline u8 *bss_mesh_id(struct ieee80211_bss *bss)
00158 {
00159 #ifdef CONFIG_MAC80211_MESH
00160         return bss->mesh_id;
00161 #endif
00162         return NULL;
00163 }
00164 
00165 static inline u8 bss_mesh_id_len(struct ieee80211_bss *bss)
00166 {
00167 #ifdef CONFIG_MAC80211_MESH
00168         return bss->mesh_id_len;
00169 #endif
00170         return 0;
00171 }
00172 
00173 
00174 typedef unsigned __bitwise__ ieee80211_tx_result;
00175 #define TX_CONTINUE     ((__force ieee80211_tx_result) 0u)
00176 #define TX_DROP         ((__force ieee80211_tx_result) 1u)
00177 #define TX_QUEUED       ((__force ieee80211_tx_result) 2u)
00178 
00179 #define IEEE80211_TX_UNICAST            BIT(1)
00180 #define IEEE80211_TX_PS_BUFFERED        BIT(2)
00181 
00182 struct ieee80211_tx_data {
00183         struct sk_buff *skb;
00184         struct sk_buff_head skbs;
00185         struct ieee80211_local *local;
00186         struct ieee80211_sub_if_data *sdata;
00187         struct sta_info *sta;
00188         struct ieee80211_key *key;
00189 
00190         struct ieee80211_channel *channel;
00191 
00192         unsigned int flags;
00193 };
00194 
00195 
00196 typedef unsigned __bitwise__ ieee80211_rx_result;
00197 #define RX_CONTINUE             ((__force ieee80211_rx_result) 0u)
00198 #define RX_DROP_UNUSABLE        ((__force ieee80211_rx_result) 1u)
00199 #define RX_DROP_MONITOR         ((__force ieee80211_rx_result) 2u)
00200 #define RX_QUEUED               ((__force ieee80211_rx_result) 3u)
00201 
00215 enum ieee80211_packet_rx_flags {
00216         IEEE80211_RX_IN_SCAN                    = BIT(0),
00217         IEEE80211_RX_RA_MATCH                   = BIT(1),
00218         IEEE80211_RX_FRAGMENTED                 = BIT(2),
00219         IEEE80211_RX_AMSDU                      = BIT(3),
00220         IEEE80211_RX_MALFORMED_ACTION_FRM       = BIT(4),
00221         IEEE80211_RX_DEFERRED_RELEASE           = BIT(5),
00222 };
00223 
00234 enum ieee80211_rx_flags {
00235         IEEE80211_RX_CMNTR              = BIT(0),
00236         IEEE80211_RX_BEACON_REPORTED    = BIT(1),
00237 };
00238 
00239 struct ieee80211_rx_data {
00240         struct sk_buff *skb;
00241         struct ieee80211_local *local;
00242         struct ieee80211_sub_if_data *sdata;
00243         struct sta_info *sta;
00244         struct ieee80211_key *key;
00245 
00246         unsigned int flags;
00247 
00248         /*
00249          * Index into sequence numbers array, 0..16
00250          * since the last (16) is used for non-QoS,
00251          * will be 16 on non-QoS frames.
00252          */
00253         int seqno_idx;
00254 
00255         /*
00256          * Index into the security IV/PN arrays, 0..16
00257          * since the last (16) is used for CCMP-encrypted
00258          * management frames, will be set to 16 on mgmt
00259          * frames and 0 on non-QoS frames.
00260          */
00261         int security_idx;
00262 
00263         u32 tkip_iv32;
00264         u16 tkip_iv16;
00265 };
00266 
00267 struct beacon_data {
00268         u8 *head, *tail;
00269         int head_len, tail_len;
00270         struct rcu_head rcu_head;
00271 };
00272 
00273 struct ieee80211_if_ap {
00274         struct beacon_data __rcu *beacon;
00275         struct sk_buff __rcu *probe_resp;
00276 
00277         struct list_head vlans;
00278 
00279         /* yes, this looks ugly, but guarantees that we can later use
00280          * bitmap_empty :)
00281          * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */
00282         u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)];
00283         struct sk_buff_head ps_bc_buf;
00284         atomic_t num_sta_ps; /* number of stations in PS mode */
00285         atomic_t num_mcast_sta; /* number of stations receiving multicast */
00286         int dtim_count;
00287         bool dtim_bc_mc;
00288 };
00289 
00290 struct ieee80211_if_wds {
00291         struct sta_info *sta;
00292         u8 remote_addr[ETH_ALEN];
00293 };
00294 
00295 struct ieee80211_if_vlan {
00296         struct list_head list;
00297 
00298         /* used for all tx if the VLAN is configured to 4-addr mode */
00299         struct sta_info __rcu *sta;
00300 };
00301 
00302 struct mesh_stats {
00303         __u32 fwded_mcast;              /* Mesh forwarded multicast frames */
00304         __u32 fwded_unicast;            /* Mesh forwarded unicast frames */
00305         __u32 fwded_frames;             /* Mesh total forwarded frames */
00306         __u32 dropped_frames_ttl;       /* Not transmitted since mesh_ttl == 0*/
00307         __u32 dropped_frames_no_route;  /* Not transmitted, no route found */
00308         __u32 dropped_frames_congestion;/* Not forwarded due to congestion */
00309         atomic_t estab_plinks;
00310 };
00311 
00312 #define PREQ_Q_F_START          0x1
00313 #define PREQ_Q_F_REFRESH        0x2
00314 struct mesh_preq_queue {
00315         struct list_head list;
00316         u8 dst[ETH_ALEN];
00317         u8 flags;
00318 };
00319 
00320 enum ieee80211_work_type {
00321         IEEE80211_WORK_ABORT,
00322         IEEE80211_WORK_REMAIN_ON_CHANNEL,
00323         IEEE80211_WORK_OFFCHANNEL_TX,
00324 };
00325 
00333 enum work_done_result {
00334         WORK_DONE_DESTROY,
00335         WORK_DONE_REQUEUE,
00336 };
00337 
00338 struct ieee80211_work {
00339         struct list_head list;
00340 
00341         struct rcu_head rcu_head;
00342 
00343         struct ieee80211_sub_if_data *sdata;
00344 
00345         enum work_done_result (*done)(struct ieee80211_work *wk,
00346                                       struct sk_buff *skb);
00347 
00348         struct ieee80211_channel *chan;
00349         enum nl80211_channel_type chan_type;
00350 
00351         unsigned long timeout;
00352         enum ieee80211_work_type type;
00353 
00354         bool started;
00355 
00356         union {
00357                 struct {
00358                         u32 duration;
00359                 } remain;
00360                 struct {
00361                         struct sk_buff *frame;
00362                         u32 wait;
00363                         bool status;
00364                 } offchan_tx;
00365         };
00366 
00367         size_t data_len;
00368         u8 data[];
00369 };
00370 
00371 /* flags used in struct ieee80211_if_managed.flags */
00372 enum ieee80211_sta_flags {
00373         IEEE80211_STA_BEACON_POLL       = BIT(0),
00374         IEEE80211_STA_CONNECTION_POLL   = BIT(1),
00375         IEEE80211_STA_CONTROL_PORT      = BIT(2),
00376         IEEE80211_STA_DISABLE_11N       = BIT(4),
00377         IEEE80211_STA_CSA_RECEIVED      = BIT(5),
00378         IEEE80211_STA_MFP_ENABLED       = BIT(6),
00379         IEEE80211_STA_UAPSD_ENABLED     = BIT(7),
00380         IEEE80211_STA_NULLFUNC_ACKED    = BIT(8),
00381         IEEE80211_STA_RESET_SIGNAL_AVE  = BIT(9),
00382         IEEE80211_STA_DISABLE_40MHZ     = BIT(10),
00383 };
00384 
00385 struct ieee80211_mgd_auth_data {
00386         struct cfg80211_bss *bss;
00387         unsigned long timeout;
00388         int tries;
00389         u16 algorithm, expected_transaction;
00390 
00391         u8 key[WLAN_KEY_LEN_WEP104];
00392         u8 key_len, key_idx;
00393         bool done;
00394 
00395         size_t ie_len;
00396         u8 ie[];
00397 };
00398 
00399 struct ieee80211_mgd_assoc_data {
00400         struct cfg80211_bss *bss;
00401         const u8 *supp_rates;
00402         const u8 *ht_operation_ie;
00403 
00404         unsigned long timeout;
00405         int tries;
00406 
00407         u16 capability;
00408         u8 prev_bssid[ETH_ALEN];
00409         u8 ssid[IEEE80211_MAX_SSID_LEN];
00410         u8 ssid_len;
00411         u8 supp_rates_len;
00412         bool wmm, uapsd;
00413         bool have_beacon;
00414         bool sent_assoc;
00415         bool synced;
00416 
00417         size_t ie_len;
00418         u8 ie[];
00419 };
00420 
00421 struct ieee80211_if_managed {
00422         struct timer_list timer;
00423         struct timer_list conn_mon_timer;
00424         struct timer_list bcn_mon_timer;
00425         struct timer_list chswitch_timer;
00426         struct work_struct monitor_work;
00427         struct work_struct chswitch_work;
00428         struct work_struct beacon_connection_loss_work;
00429 
00430         unsigned long beacon_timeout;
00431         unsigned long probe_timeout;
00432         int probe_send_count;
00433         bool nullfunc_failed;
00434 
00435         struct mutex mtx;
00436         struct cfg80211_bss *associated;
00437         struct ieee80211_mgd_auth_data *auth_data;
00438         struct ieee80211_mgd_assoc_data *assoc_data;
00439 
00440         u8 bssid[ETH_ALEN];
00441 
00442         u16 aid;
00443 
00444         unsigned long timers_running; /* used for quiesce/restart */
00445         bool powersave; /* powersave requested for this iface */
00446         bool broken_ap; /* AP is broken -- turn off powersave */
00447         enum ieee80211_smps_mode req_smps, /* requested smps mode */
00448                                  ap_smps, /* smps mode AP thinks we're in */
00449                                  driver_smps_mode; /* smps mode request */
00450 
00451         struct work_struct request_smps_work;
00452 
00453         unsigned int flags;
00454 
00455         bool beacon_crc_valid;
00456         u32 beacon_crc;
00457 
00458         enum {
00459                 IEEE80211_MFP_DISABLED,
00460                 IEEE80211_MFP_OPTIONAL,
00461                 IEEE80211_MFP_REQUIRED
00462         } mfp; /* management frame protection */
00463 
00464         /*
00465          * Bitmask of enabled u-apsd queues,
00466          * IEEE80211_WMM_IE_STA_QOSINFO_AC_BE & co. Needs a new association
00467          * to take effect.
00468          */
00469         unsigned int uapsd_queues;
00470 
00471         /*
00472          * Maximum number of buffered frames AP can deliver during a
00473          * service period, IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL or similar.
00474          * Needs a new association to take effect.
00475          */
00476         unsigned int uapsd_max_sp_len;
00477 
00478         int wmm_last_param_set;
00479 
00480         u8 use_4addr;
00481 
00482         /* Signal strength from the last Beacon frame in the current BSS. */
00483         int last_beacon_signal;
00484 
00485         /*
00486          * Weighted average of the signal strength from Beacon frames in the
00487          * current BSS. This is in units of 1/16 of the signal unit to maintain
00488          * accuracy and to speed up calculations, i.e., the value need to be
00489          * divided by 16 to get the actual value.
00490          */
00491         int ave_beacon_signal;
00492 
00493         /*
00494          * Number of Beacon frames used in ave_beacon_signal. This can be used
00495          * to avoid generating less reliable cqm events that would be based
00496          * only on couple of received frames.
00497          */
00498         unsigned int count_beacon_signal;
00499 
00500         /*
00501          * Last Beacon frame signal strength average (ave_beacon_signal / 16)
00502          * that triggered a cqm event. 0 indicates that no event has been
00503          * generated for the current association.
00504          */
00505         int last_cqm_event_signal;
00506 
00507         /*
00508          * State variables for keeping track of RSSI of the AP currently
00509          * connected to and informing driver when RSSI has gone
00510          * below/above a certain threshold.
00511          */
00512         int rssi_min_thold, rssi_max_thold;
00513         int last_ave_beacon_signal;
00514 
00515         struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */
00516         struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */
00517 };
00518 
00519 struct ieee80211_if_ibss {
00520         struct timer_list timer;
00521 
00522         struct mutex mtx;
00523 
00524         unsigned long last_scan_completed;
00525 
00526         u32 basic_rates;
00527 
00528         bool timer_running;
00529 
00530         bool fixed_bssid;
00531         bool fixed_channel;
00532         bool privacy;
00533 
00534         bool control_port;
00535 
00536         u8 bssid[ETH_ALEN] __aligned(2);
00537         u8 ssid[IEEE80211_MAX_SSID_LEN];
00538         u8 ssid_len, ie_len;
00539         u8 *ie;
00540         struct ieee80211_channel *channel;
00541         enum nl80211_channel_type channel_type;
00542 
00543         unsigned long ibss_join_req;
00544         /* probe response/beacon for IBSS */
00545         struct sk_buff __rcu *presp;
00546         struct sk_buff *skb;
00547 
00548         spinlock_t incomplete_lock;
00549         struct list_head incomplete_stations;
00550 
00551         enum {
00552                 IEEE80211_IBSS_MLME_SEARCH,
00553                 IEEE80211_IBSS_MLME_JOINED,
00554         } state;
00555 };
00556 
00564 struct ieee802_11_elems;
00565 struct ieee80211_mesh_sync_ops {
00566         void (*rx_bcn_presp)(struct ieee80211_sub_if_data *sdata,
00567                              u16 stype,
00568                              struct ieee80211_mgmt *mgmt,
00569                              struct ieee802_11_elems *elems,
00570                              struct ieee80211_rx_status *rx_status);
00571         void (*adjust_tbtt)(struct ieee80211_sub_if_data *sdata);
00572         /* add other framework functions here */
00573 };
00574 
00575 struct ieee80211_if_mesh {
00576         struct timer_list housekeeping_timer;
00577         struct timer_list mesh_path_timer;
00578         struct timer_list mesh_path_root_timer;
00579 
00580         unsigned long timers_running;
00581 
00582         unsigned long wrkq_flags;
00583 
00584         u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN];
00585         size_t mesh_id_len;
00586         /* Active Path Selection Protocol Identifier */
00587         u8 mesh_pp_id;
00588         /* Active Path Selection Metric Identifier */
00589         u8 mesh_pm_id;
00590         /* Congestion Control Mode Identifier */
00591         u8 mesh_cc_id;
00592         /* Synchronization Protocol Identifier */
00593         u8 mesh_sp_id;
00594         /* Authentication Protocol Identifier */
00595         u8 mesh_auth_id;
00596         /* Local mesh Sequence Number */
00597         u32 sn;
00598         /* Last used PREQ ID */
00599         u32 preq_id;
00600         atomic_t mpaths;
00601         /* Timestamp of last SN update */
00602         unsigned long last_sn_update;
00603         /* Time when it's ok to send next PERR */
00604         unsigned long next_perr;
00605         /* Timestamp of last PREQ sent */
00606         unsigned long last_preq;
00607         struct mesh_rmc *rmc;
00608         spinlock_t mesh_preq_queue_lock;
00609         struct mesh_preq_queue preq_queue;
00610         int preq_queue_len;
00611         struct mesh_stats mshstats;
00612         struct mesh_config mshcfg;
00613         u32 mesh_seqnum;
00614         bool accepting_plinks;
00615         int num_gates;
00616         const u8 *ie;
00617         u8 ie_len;
00618         enum {
00619                 IEEE80211_MESH_SEC_NONE = 0x0,
00620                 IEEE80211_MESH_SEC_AUTHED = 0x1,
00621                 IEEE80211_MESH_SEC_SECURED = 0x2,
00622         } security;
00623         /* Extensible Synchronization Framework */
00624         struct ieee80211_mesh_sync_ops *sync_ops;
00625         s64 sync_offset_clockdrift_max;
00626         spinlock_t sync_offset_lock;
00627         bool adjusting_tbtt;
00628 };
00629 
00630 #ifdef CONFIG_MAC80211_MESH
00631 #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \
00632         do { (msh)->mshstats.name++; } while (0)
00633 #else
00634 #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \
00635         do { } while (0)
00636 #endif
00637 
00650 enum ieee80211_sub_if_data_flags {
00651         IEEE80211_SDATA_ALLMULTI                = BIT(0),
00652         IEEE80211_SDATA_PROMISC                 = BIT(1),
00653         IEEE80211_SDATA_OPERATING_GMODE         = BIT(2),
00654         IEEE80211_SDATA_DONT_BRIDGE_PACKETS     = BIT(3),
00655         IEEE80211_SDATA_DISCONNECT_RESUME       = BIT(4),
00656         IEEE80211_SDATA_IN_DRIVER               = BIT(5),
00657 };
00658 
00667 enum ieee80211_sdata_state_bits {
00668         SDATA_STATE_RUNNING,
00669         SDATA_STATE_OFFCHANNEL,
00670 };
00671 
00672 struct ieee80211_sub_if_data {
00673         struct list_head list;
00674 
00675         struct wireless_dev wdev;
00676 
00677         /* keys */
00678         struct list_head key_list;
00679 
00680         /* count for keys needing tailroom space allocation */
00681         int crypto_tx_tailroom_needed_cnt;
00682 
00683         struct net_device *dev;
00684         struct ieee80211_local *local;
00685 
00686         unsigned int flags;
00687 
00688         unsigned long state;
00689 
00690         int drop_unencrypted;
00691 
00692         char name[IFNAMSIZ];
00693 
00694         /* to detect idle changes */
00695         bool old_idle;
00696 
00697         /* Fragment table for host-based reassembly */
00698         struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX];
00699         unsigned int fragment_next;
00700 
00701         /* TID bitmap for NoAck policy */
00702         u16 noack_map;
00703 
00704         struct ieee80211_key __rcu *keys[NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS];
00705         struct ieee80211_key __rcu *default_unicast_key;
00706         struct ieee80211_key __rcu *default_multicast_key;
00707         struct ieee80211_key __rcu *default_mgmt_key;
00708 
00709         u16 sequence_number;
00710         __be16 control_port_protocol;
00711         bool control_port_no_encrypt;
00712 
00713         struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS];
00714 
00715         struct work_struct work;
00716         struct sk_buff_head skb_queue;
00717 
00718         bool arp_filter_state;
00719 
00720         /*
00721          * AP this belongs to: self in AP mode and
00722          * corresponding AP in VLAN mode, NULL for
00723          * all others (might be needed later in IBSS)
00724          */
00725         struct ieee80211_if_ap *bss;
00726 
00727         /* bitmap of allowed (non-MCS) rate indexes for rate control */
00728         u32 rc_rateidx_mask[IEEE80211_NUM_BANDS];
00729         u8  rc_rateidx_mcs_mask[IEEE80211_NUM_BANDS][IEEE80211_HT_MCS_MASK_LEN];
00730 
00731         union {
00732                 struct ieee80211_if_ap ap;
00733                 struct ieee80211_if_wds wds;
00734                 struct ieee80211_if_vlan vlan;
00735                 struct ieee80211_if_managed mgd;
00736                 struct ieee80211_if_ibss ibss;
00737                 struct ieee80211_if_mesh mesh;
00738                 u32 mntr_flags;
00739         } u;
00740 
00741 #ifdef CONFIG_MAC80211_DEBUGFS
00742         struct {
00743                 struct dentry *dir;
00744                 struct dentry *subdir_stations;
00745                 struct dentry *default_unicast_key;
00746                 struct dentry *default_multicast_key;
00747                 struct dentry *default_mgmt_key;
00748         } debugfs;
00749 #endif
00750         /* must be last, dynamically sized area in this! */
00751         struct ieee80211_vif vif;
00752 };
00753 
00754 static inline
00755 struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p)
00756 {
00757         return container_of(p, struct ieee80211_sub_if_data, vif);
00758 }
00759 
00760 enum sdata_queue_type {
00761         IEEE80211_SDATA_QUEUE_TYPE_FRAME        = 0,
00762         IEEE80211_SDATA_QUEUE_AGG_START         = 1,
00763         IEEE80211_SDATA_QUEUE_AGG_STOP          = 2,
00764 };
00765 
00766 enum {
00767         IEEE80211_RX_MSG        = 1,
00768         IEEE80211_TX_STATUS_MSG = 2,
00769         IEEE80211_EOSP_MSG      = 3,
00770 };
00771 
00772 struct skb_eosp_msg_data {
00773         u8 sta[ETH_ALEN], iface[ETH_ALEN];
00774 };
00775 
00776 enum queue_stop_reason {
00777         IEEE80211_QUEUE_STOP_REASON_DRIVER,
00778         IEEE80211_QUEUE_STOP_REASON_PS,
00779         IEEE80211_QUEUE_STOP_REASON_CSA,
00780         IEEE80211_QUEUE_STOP_REASON_AGGREGATION,
00781         IEEE80211_QUEUE_STOP_REASON_SUSPEND,
00782         IEEE80211_QUEUE_STOP_REASON_SKB_ADD,
00783 };
00784 
00785 #ifdef CONFIG_MAC80211_LEDS
00786 struct tpt_led_trigger {
00787         struct led_trigger trig;
00788         char name[32];
00789         const struct ieee80211_tpt_blink *blink_table;
00790         unsigned int blink_table_len;
00791         struct timer_list timer;
00792         unsigned long prev_traffic;
00793         unsigned long tx_bytes, rx_bytes;
00794         unsigned int active, want;
00795         bool running;
00796 };
00797 #endif
00798 
00813 enum {
00814         SCAN_SW_SCANNING,
00815         SCAN_HW_SCANNING,
00816         SCAN_ONCHANNEL_SCANNING,
00817         SCAN_COMPLETED,
00818         SCAN_ABORTED,
00819 };
00820 
00833 enum mac80211_scan_state {
00834         SCAN_DECISION,
00835         SCAN_SET_CHANNEL,
00836         SCAN_SEND_PROBE,
00837         SCAN_SUSPEND,
00838         SCAN_RESUME,
00839 };
00840 
00841 struct ieee80211_local {
00842         /* embed the driver visible part.
00843          * don't cast (use the static inlines below), but we keep
00844          * it first anyway so they become a no-op */
00845         struct ieee80211_hw hw;
00846 
00847         const struct ieee80211_ops *ops;
00848 
00849         /*
00850          * work stuff, potentially off-channel (in the future)
00851          */
00852         struct list_head work_list;
00853         struct timer_list work_timer;
00854         struct work_struct work_work;
00855 
00856         /*
00857          * private workqueue to mac80211. mac80211 makes this accessible
00858          * via ieee80211_queue_work()
00859          */
00860         struct workqueue_struct *workqueue;
00861 
00862         unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES];
00863         /* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */
00864         spinlock_t queue_stop_reason_lock;
00865 
00866         int open_count;
00867         int monitors, cooked_mntrs;
00868         /* number of interfaces with corresponding FIF_ flags */
00869         int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll,
00870             fif_probe_req;
00871         int probe_req_reg;
00872         unsigned int filter_flags; /* FIF_* */
00873 
00874         bool wiphy_ciphers_allocated;
00875 
00876         /* protects the aggregated multicast list and filter calls */
00877         spinlock_t filter_lock;
00878 
00879         /* used for uploading changed mc list */
00880         struct work_struct reconfig_filter;
00881 
00882         /* used to reconfigure hardware SM PS */
00883         struct work_struct recalc_smps;
00884 
00885         /* aggregated multicast list */
00886         struct netdev_hw_addr_list mc_list;
00887 
00888         bool tim_in_locked_section; /* see ieee80211_beacon_get() */
00889 
00890         /*
00891          * suspended is true if we finished all the suspend _and_ we have
00892          * not yet come up from resume. This is to be used by mac80211
00893          * to ensure driver sanity during suspend and mac80211's own
00894          * sanity. It can eventually be used for WoW as well.
00895          */
00896         bool suspended;
00897 
00898         /*
00899          * Resuming is true while suspended, but when we're reprogramming the
00900          * hardware -- at that time it's allowed to use ieee80211_queue_work()
00901          * again even though some other parts of the stack are still suspended
00902          * and we still drop received frames to avoid waking the stack.
00903          */
00904         bool resuming;
00905 
00906         /*
00907          * quiescing is true during the suspend process _only_ to
00908          * ease timer cancelling etc.
00909          */
00910         bool quiescing;
00911 
00912         /* device is started */
00913         bool started;
00914 
00915         /* wowlan is enabled -- don't reconfig on resume */
00916         bool wowlan;
00917 
00918         int tx_headroom; /* required headroom for hardware/radiotap */
00919 
00920         /* Tasklet and skb queue to process calls from IRQ mode. All frames
00921          * added to skb_queue will be processed, but frames in
00922          * skb_queue_unreliable may be dropped if the total length of these
00923          * queues increases over the limit. */
00924 #define IEEE80211_IRQSAFE_QUEUE_LIMIT 128
00925         struct tasklet_struct tasklet;
00926         struct sk_buff_head skb_queue;
00927         struct sk_buff_head skb_queue_unreliable;
00928 
00929         /*
00930          * Internal FIFO queue which is shared between multiple rx path
00931          * stages. Its main task is to provide a serialization mechanism,
00932          * so all rx handlers can enjoy having exclusive access to their
00933          * private data structures.
00934          */
00935         struct sk_buff_head rx_skb_queue;
00936         bool running_rx_handler;        /* protected by rx_skb_queue.lock */
00937 
00938         /* Station data */
00939         /*
00940          * The mutex only protects the list, hash table and
00941          * counter, reads are done with RCU.
00942          */
00943         struct mutex sta_mtx;
00944         spinlock_t tim_lock;
00945         unsigned long num_sta;
00946         struct list_head sta_list;
00947         struct sta_info __rcu *sta_hash[STA_HASH_SIZE];
00948         struct timer_list sta_cleanup;
00949         int sta_generation;
00950 
00951         struct sk_buff_head pending[IEEE80211_MAX_QUEUES];
00952         struct tasklet_struct tx_pending_tasklet;
00953 
00954         atomic_t agg_queue_stop[IEEE80211_MAX_QUEUES];
00955 
00956         /* number of interfaces with corresponding IFF_ flags */
00957         atomic_t iff_allmultis, iff_promiscs;
00958 
00959         struct rate_control_ref *rate_ctrl;
00960 
00961         struct crypto_cipher *wep_tx_tfm;
00962         struct crypto_cipher *wep_rx_tfm;
00963         u32 wep_iv;
00964 
00965         /* see iface.c */
00966         struct list_head interfaces;
00967         struct mutex iflist_mtx;
00968 
00969         /*
00970          * Key mutex, protects sdata's key_list and sta_info's
00971          * key pointers (write access, they're RCU.)
00972          */
00973         struct mutex key_mtx;
00974 
00975         /* mutex for scan and work locking */
00976         struct mutex mtx;
00977 
00978         /* Scanning and BSS list */
00979         unsigned long scanning;
00980         struct cfg80211_ssid scan_ssid;
00981         struct cfg80211_scan_request *int_scan_req;
00982         struct cfg80211_scan_request *scan_req, *hw_scan_req;
00983         struct ieee80211_channel *scan_channel;
00984         enum ieee80211_band hw_scan_band;
00985         int scan_channel_idx;
00986         int scan_ies_len;
00987 
00988         bool sched_scanning;
00989         struct ieee80211_sched_scan_ies sched_scan_ies;
00990         struct work_struct sched_scan_stopped_work;
00991 
00992         unsigned long leave_oper_channel_time;
00993         enum mac80211_scan_state next_scan_state;
00994         struct delayed_work scan_work;
00995         struct ieee80211_sub_if_data *scan_sdata;
00996         enum nl80211_channel_type _oper_channel_type;
00997         struct ieee80211_channel *oper_channel, *csa_channel;
00998 
00999         /* Temporary remain-on-channel for off-channel operations */
01000         struct ieee80211_channel *tmp_channel;
01001         enum nl80211_channel_type tmp_channel_type;
01002 
01003         /* SNMP counters */
01004         /* dot11CountersTable */
01005         u32 dot11TransmittedFragmentCount;
01006         u32 dot11MulticastTransmittedFrameCount;
01007         u32 dot11FailedCount;
01008         u32 dot11RetryCount;
01009         u32 dot11MultipleRetryCount;
01010         u32 dot11FrameDuplicateCount;
01011         u32 dot11ReceivedFragmentCount;
01012         u32 dot11MulticastReceivedFrameCount;
01013         u32 dot11TransmittedFrameCount;
01014 
01015 #ifdef CONFIG_MAC80211_LEDS
01016         int tx_led_counter, rx_led_counter;
01017         struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led;
01018         struct tpt_led_trigger *tpt_led_trigger;
01019         char tx_led_name[32], rx_led_name[32],
01020              assoc_led_name[32], radio_led_name[32];
01021 #endif
01022 
01023 #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
01024         /* TX/RX handler statistics */
01025         unsigned int tx_handlers_drop;
01026         unsigned int tx_handlers_queued;
01027         unsigned int tx_handlers_drop_unencrypted;
01028         unsigned int tx_handlers_drop_fragment;
01029         unsigned int tx_handlers_drop_wep;
01030         unsigned int tx_handlers_drop_not_assoc;
01031         unsigned int tx_handlers_drop_unauth_port;
01032         unsigned int rx_handlers_drop;
01033         unsigned int rx_handlers_queued;
01034         unsigned int rx_handlers_drop_nullfunc;
01035         unsigned int rx_handlers_drop_defrag;
01036         unsigned int rx_handlers_drop_short;
01037         unsigned int rx_handlers_drop_passive_scan;
01038         unsigned int tx_expand_skb_head;
01039         unsigned int tx_expand_skb_head_cloned;
01040         unsigned int rx_expand_skb_head;
01041         unsigned int rx_expand_skb_head2;
01042         unsigned int rx_handlers_fragments;
01043         unsigned int tx_status_drop;
01044 #define I802_DEBUG_INC(c) (c)++
01045 #else /* CONFIG_MAC80211_DEBUG_COUNTERS */
01046 #define I802_DEBUG_INC(c) do { } while (0)
01047 #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
01048 
01049 
01050         int total_ps_buffered; /* total number of all buffered unicast and
01051                                 * multicast packets for power saving stations
01052                                 */
01053         unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */
01054 
01055         bool pspolling;
01056         bool offchannel_ps_enabled;
01057         /*
01058          * PS can only be enabled when we have exactly one managed
01059          * interface (and monitors) in PS, this then points there.
01060          */
01061         struct ieee80211_sub_if_data *ps_sdata;
01062         struct work_struct dynamic_ps_enable_work;
01063         struct work_struct dynamic_ps_disable_work;
01064         struct timer_list dynamic_ps_timer;
01065         struct notifier_block network_latency_notifier;
01066         struct notifier_block ifa_notifier;
01067 
01068         /*
01069          * The dynamic ps timeout configured from user space via WEXT -
01070          * this will override whatever chosen by mac80211 internally.
01071          */
01072         int dynamic_ps_forced_timeout;
01073         int dynamic_ps_user_timeout;
01074         bool disable_dynamic_ps;
01075 
01076         int user_power_level; /* in dBm */
01077         int power_constr_level; /* in dBm */
01078 
01079         enum ieee80211_smps_mode smps_mode;
01080 
01081         struct work_struct restart_work;
01082 
01083 #ifdef CONFIG_MAC80211_DEBUGFS
01084         struct local_debugfsdentries {
01085                 struct dentry *rcdir;
01086                 struct dentry *keys;
01087         } debugfs;
01088 #endif
01089 
01090         struct ieee80211_channel *hw_roc_channel;
01091         struct net_device *hw_roc_dev;
01092         struct sk_buff *hw_roc_skb, *hw_roc_skb_for_status;
01093         struct work_struct hw_roc_start, hw_roc_done;
01094         enum nl80211_channel_type hw_roc_channel_type;
01095         unsigned int hw_roc_duration;
01096         u32 hw_roc_cookie;
01097         bool hw_roc_for_tx;
01098 
01099         struct idr ack_status_frames;
01100         spinlock_t ack_status_lock;
01101 
01102         /* dummy netdev for use w/ NAPI */
01103         struct net_device napi_dev;
01104 
01105         struct napi_struct napi;
01106 
01107         /* virtual monitor interface */
01108         struct ieee80211_sub_if_data __rcu *monitor_sdata;
01109 };
01110 
01111 static inline struct ieee80211_sub_if_data *
01112 IEEE80211_DEV_TO_SUB_IF(struct net_device *dev)
01113 {
01114         return netdev_priv(dev);
01115 }
01116 
01117 /* this struct represents 802.11n's RA/TID combination */
01118 struct ieee80211_ra_tid {
01119         u8 ra[ETH_ALEN];
01120         u16 tid;
01121 };
01122 
01123 /* Parsed Information Elements */
01124 struct ieee802_11_elems {
01125         u8 *ie_start;
01126         size_t total_len;
01127 
01128         /* pointers to IEs */
01129         u8 *ssid;
01130         u8 *supp_rates;
01131         u8 *fh_params;
01132         u8 *ds_params;
01133         u8 *cf_params;
01134         struct ieee80211_tim_ie *tim;
01135         u8 *ibss_params;
01136         u8 *challenge;
01137         u8 *wpa;
01138         u8 *rsn;
01139         u8 *erp_info;
01140         u8 *ext_supp_rates;
01141         u8 *wmm_info;
01142         u8 *wmm_param;
01143         struct ieee80211_ht_cap *ht_cap_elem;
01144         struct ieee80211_ht_operation *ht_operation;
01145         struct ieee80211_meshconf_ie *mesh_config;
01146         u8 *mesh_id;
01147         u8 *peering;
01148         u8 *preq;
01149         u8 *prep;
01150         u8 *perr;
01151         struct ieee80211_rann_ie *rann;
01152         u8 *ch_switch_elem;
01153         u8 *country_elem;
01154         u8 *pwr_constr_elem;
01155         u8 *quiet_elem; /* first quite element */
01156         u8 *timeout_int;
01157 
01158         /* length of them, respectively */
01159         u8 ssid_len;
01160         u8 supp_rates_len;
01161         u8 fh_params_len;
01162         u8 ds_params_len;
01163         u8 cf_params_len;
01164         u8 tim_len;
01165         u8 ibss_params_len;
01166         u8 challenge_len;
01167         u8 wpa_len;
01168         u8 rsn_len;
01169         u8 erp_info_len;
01170         u8 ext_supp_rates_len;
01171         u8 wmm_info_len;
01172         u8 wmm_param_len;
01173         u8 mesh_id_len;
01174         u8 peering_len;
01175         u8 preq_len;
01176         u8 prep_len;
01177         u8 perr_len;
01178         u8 ch_switch_elem_len;
01179         u8 country_elem_len;
01180         u8 pwr_constr_elem_len;
01181         u8 quiet_elem_len;
01182         u8 num_of_quiet_elem;   /* can be more the one */
01183         u8 timeout_int_len;
01184 
01185         /* whether a parse error occurred while retrieving these elements */
01186         bool parse_error;
01187 };
01188 
01189 static inline struct ieee80211_local *hw_to_local(
01190         struct ieee80211_hw *hw)
01191 {
01192         return container_of(hw, struct ieee80211_local, hw);
01193 }
01194 
01195 
01196 static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
01197 {
01198         return ether_addr_equal(raddr, addr) ||
01199                is_broadcast_ether_addr(raddr);
01200 }
01201 
01202 
01203 int ieee80211_hw_config(struct ieee80211_local *local, u32 changed);
01204 void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx);
01205 void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
01206                                       u32 changed);
01207 void ieee80211_configure_filter(struct ieee80211_local *local);
01208 u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata);
01209 
01210 /* STA code */
01211 void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata);
01212 int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
01213                        struct cfg80211_auth_request *req);
01214 int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
01215                         struct cfg80211_assoc_request *req);
01216 int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
01217                          struct cfg80211_deauth_request *req);
01218 int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
01219                            struct cfg80211_disassoc_request *req);
01220 void ieee80211_send_pspoll(struct ieee80211_local *local,
01221                            struct ieee80211_sub_if_data *sdata);
01222 void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency);
01223 int ieee80211_max_network_latency(struct notifier_block *nb,
01224                                   unsigned long data, void *dummy);
01225 int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata);
01226 void ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
01227                                       struct ieee80211_channel_sw_ie *sw_elem,
01228                                       struct ieee80211_bss *bss,
01229                                       u64 timestamp);
01230 void ieee80211_sta_quiesce(struct ieee80211_sub_if_data *sdata);
01231 void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata);
01232 void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata);
01233 void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
01234                                   struct sk_buff *skb);
01235 void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata);
01236 void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata);
01237 void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata);
01238 
01239 /* IBSS code */
01240 void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local);
01241 void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata);
01242 void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata,
01243                               const u8 *bssid, const u8 *addr, u32 supp_rates);
01244 int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
01245                         struct cfg80211_ibss_params *params);
01246 int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata);
01247 void ieee80211_ibss_quiesce(struct ieee80211_sub_if_data *sdata);
01248 void ieee80211_ibss_restart(struct ieee80211_sub_if_data *sdata);
01249 void ieee80211_ibss_work(struct ieee80211_sub_if_data *sdata);
01250 void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
01251                                    struct sk_buff *skb);
01252 
01253 /* mesh code */
01254 void ieee80211_mesh_work(struct ieee80211_sub_if_data *sdata);
01255 void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
01256                                    struct sk_buff *skb);
01257 
01258 /* scan/BSS handling */
01259 void ieee80211_scan_work(struct work_struct *work);
01260 int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata,
01261                                     const u8 *ssid, u8 ssid_len,
01262                                     struct ieee80211_channel *chan);
01263 int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
01264                            struct cfg80211_scan_request *req);
01265 void ieee80211_scan_cancel(struct ieee80211_local *local);
01266 void ieee80211_run_deferred_scan(struct ieee80211_local *local);
01267 ieee80211_rx_result
01268 ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);
01269 
01270 void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local);
01271 struct ieee80211_bss *
01272 ieee80211_bss_info_update(struct ieee80211_local *local,
01273                           struct ieee80211_rx_status *rx_status,
01274                           struct ieee80211_mgmt *mgmt,
01275                           size_t len,
01276                           struct ieee802_11_elems *elems,
01277                           struct ieee80211_channel *channel,
01278                           bool beacon);
01279 void ieee80211_rx_bss_put(struct ieee80211_local *local,
01280                           struct ieee80211_bss *bss);
01281 
01282 /* scheduled scan handling */
01283 int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
01284                                        struct cfg80211_sched_scan_request *req);
01285 int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata);
01286 void ieee80211_sched_scan_stopped_work(struct work_struct *work);
01287 
01288 /* off-channel helpers */
01289 void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local,
01290                                     bool offchannel_ps_enable);
01291 void ieee80211_offchannel_return(struct ieee80211_local *local,
01292                                  bool offchannel_ps_disable);
01293 void ieee80211_hw_roc_setup(struct ieee80211_local *local);
01294 
01295 /* interface handling */
01296 int ieee80211_iface_init(void);
01297 void ieee80211_iface_exit(void);
01298 int ieee80211_if_add(struct ieee80211_local *local, const char *name,
01299                      struct net_device **new_dev, enum nl80211_iftype type,
01300                      struct vif_params *params);
01301 int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
01302                              enum nl80211_iftype type);
01303 void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata);
01304 void ieee80211_remove_interfaces(struct ieee80211_local *local);
01305 u32 __ieee80211_recalc_idle(struct ieee80211_local *local);
01306 void ieee80211_recalc_idle(struct ieee80211_local *local);
01307 void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata,
01308                                     const int offset);
01309 
01310 static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata)
01311 {
01312         return test_bit(SDATA_STATE_RUNNING, &sdata->state);
01313 }
01314 
01315 /* tx handling */
01316 void ieee80211_clear_tx_pending(struct ieee80211_local *local);
01317 void ieee80211_tx_pending(unsigned long data);
01318 netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
01319                                          struct net_device *dev);
01320 netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
01321                                        struct net_device *dev);
01322 
01323 /* HT */
01324 void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata,
01325                                      struct ieee80211_sta_ht_cap *ht_cap);
01326 void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata,
01327                                        struct ieee80211_supported_band *sband,
01328                                        struct ieee80211_ht_cap *ht_cap_ie,
01329                                        struct ieee80211_sta_ht_cap *ht_cap);
01330 void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,
01331                           const u8 *da, u16 tid,
01332                           u16 initiator, u16 reason_code);
01333 int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata,
01334                                enum ieee80211_smps_mode smps, const u8 *da,
01335                                const u8 *bssid);
01336 void ieee80211_request_smps_work(struct work_struct *work);
01337 
01338 void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
01339                                      u16 initiator, u16 reason, bool stop);
01340 void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
01341                                     u16 initiator, u16 reason, bool stop);
01342 void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta, bool tx);
01343 void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
01344                              struct sta_info *sta,
01345                              struct ieee80211_mgmt *mgmt, size_t len);
01346 void ieee80211_process_addba_resp(struct ieee80211_local *local,
01347                                   struct sta_info *sta,
01348                                   struct ieee80211_mgmt *mgmt,
01349                                   size_t len);
01350 void ieee80211_process_addba_request(struct ieee80211_local *local,
01351                                      struct sta_info *sta,
01352                                      struct ieee80211_mgmt *mgmt,
01353                                      size_t len);
01354 
01355 int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
01356                                    enum ieee80211_back_parties initiator,
01357                                    bool tx);
01358 int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
01359                                     enum ieee80211_back_parties initiator,
01360                                     bool tx);
01361 void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid);
01362 void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid);
01363 void ieee80211_ba_session_work(struct work_struct *work);
01364 void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid);
01365 void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid);
01366 
01367 /* Spectrum management */
01368 void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
01369                                        struct ieee80211_mgmt *mgmt,
01370                                        size_t len);
01371 
01372 /* Suspend/resume and hw reconfiguration */
01373 int ieee80211_reconfig(struct ieee80211_local *local);
01374 void ieee80211_stop_device(struct ieee80211_local *local);
01375 
01376 #ifdef CONFIG_PM
01377 int __ieee80211_suspend(struct ieee80211_hw *hw,
01378                         struct cfg80211_wowlan *wowlan);
01379 
01380 static inline int __ieee80211_resume(struct ieee80211_hw *hw)
01381 {
01382         struct ieee80211_local *local = hw_to_local(hw);
01383 
01384         WARN(test_bit(SCAN_HW_SCANNING, &local->scanning),
01385                 "%s: resume with hardware scan still in progress\n",
01386                 wiphy_name(hw->wiphy));
01387 
01388         return ieee80211_reconfig(hw_to_local(hw));
01389 }
01390 #else
01391 static inline int __ieee80211_suspend(struct ieee80211_hw *hw,
01392                                       struct cfg80211_wowlan *wowlan)
01393 {
01394         return 0;
01395 }
01396 
01397 static inline int __ieee80211_resume(struct ieee80211_hw *hw)
01398 {
01399         return 0;
01400 }
01401 #endif
01402 
01403 /* utility functions/constants */
01404 extern void *mac80211_wiphy_privid; /* for wiphy privid */
01405 u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len,
01406                         enum nl80211_iftype type);
01407 int ieee80211_frame_duration(enum ieee80211_band band, size_t len,
01408                              int rate, int erp, int short_preamble);
01409 void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx,
01410                                      struct ieee80211_hdr *hdr, const u8 *tsc,
01411                                      gfp_t gfp);
01412 void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
01413                                bool bss_notify);
01414 void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);
01415 
01416 void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata,
01417                           struct sk_buff *skb, int tid);
01418 static void inline ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata,
01419                                     struct sk_buff *skb)
01420 {
01421         /* Send all internal mgmt frames on VO. Accordingly set TID to 7. */
01422         ieee80211_tx_skb_tid(sdata, skb, 7);
01423 }
01424 
01425 void ieee802_11_parse_elems(u8 *start, size_t len,
01426                             struct ieee802_11_elems *elems);
01427 u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
01428                                struct ieee802_11_elems *elems,
01429                                u64 filter, u32 crc);
01430 u32 ieee80211_mandatory_rates(struct ieee80211_local *local,
01431                               enum ieee80211_band band);
01432 
01433 void ieee80211_dynamic_ps_enable_work(struct work_struct *work);
01434 void ieee80211_dynamic_ps_disable_work(struct work_struct *work);
01435 void ieee80211_dynamic_ps_timer(unsigned long data);
01436 void ieee80211_send_nullfunc(struct ieee80211_local *local,
01437                              struct ieee80211_sub_if_data *sdata,
01438                              int powersave);
01439 void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata,
01440                              struct ieee80211_hdr *hdr);
01441 void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,
01442                              struct ieee80211_hdr *hdr, bool ack);
01443 void ieee80211_beacon_connection_loss_work(struct work_struct *work);
01444 
01445 void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw,
01446                                      enum queue_stop_reason reason);
01447 void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw,
01448                                      enum queue_stop_reason reason);
01449 void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue,
01450                                     enum queue_stop_reason reason);
01451 void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue,
01452                                     enum queue_stop_reason reason);
01453 void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue);
01454 void ieee80211_add_pending_skb(struct ieee80211_local *local,
01455                                struct sk_buff *skb);
01456 void ieee80211_add_pending_skbs_fn(struct ieee80211_local *local,
01457                                    struct sk_buff_head *skbs,
01458                                    void (*fn)(void *data), void *data);
01459 static inline void ieee80211_add_pending_skbs(struct ieee80211_local *local,
01460                                               struct sk_buff_head *skbs)
01461 {
01462         ieee80211_add_pending_skbs_fn(local, skbs, NULL, NULL);
01463 }
01464 
01465 void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
01466                          u16 transaction, u16 auth_alg,
01467                          u8 *extra, size_t extra_len, const u8 *bssid,
01468                          const u8 *da, const u8 *key, u8 key_len, u8 key_idx);
01469 int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
01470                              const u8 *ie, size_t ie_len,
01471                              enum ieee80211_band band, u32 rate_mask,
01472                              u8 channel);
01473 struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
01474                                           u8 *dst, u32 ratemask,
01475                                           const u8 *ssid, size_t ssid_len,
01476                                           const u8 *ie, size_t ie_len,
01477                                           bool directed);
01478 void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
01479                               const u8 *ssid, size_t ssid_len,
01480                               const u8 *ie, size_t ie_len,
01481                               u32 ratemask, bool directed, bool no_cck);
01482 
01483 void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata,
01484                                   const size_t supp_rates_len,
01485                                   const u8 *supp_rates);
01486 u32 ieee80211_sta_get_rates(struct ieee80211_local *local,
01487                             struct ieee802_11_elems *elems,
01488                             enum ieee80211_band band, u32 *basic_rates);
01489 int __ieee80211_request_smps(struct ieee80211_sub_if_data *sdata,
01490                              enum ieee80211_smps_mode smps_mode);
01491 void ieee80211_recalc_smps(struct ieee80211_local *local);
01492 
01493 size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
01494                           const u8 *ids, int n_ids, size_t offset);
01495 size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset);
01496 u8 *ieee80211_ie_build_ht_cap(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap,
01497                               u16 cap);
01498 u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap,
01499                                struct ieee80211_channel *channel,
01500                                enum nl80211_channel_type channel_type,
01501                                u16 prot_mode);
01502 
01503 /* internal work items */
01504 void ieee80211_work_init(struct ieee80211_local *local);
01505 void ieee80211_add_work(struct ieee80211_work *wk);
01506 void free_work(struct ieee80211_work *wk);
01507 void ieee80211_work_purge(struct ieee80211_sub_if_data *sdata);
01508 int ieee80211_wk_remain_on_channel(struct ieee80211_sub_if_data *sdata,
01509                                    struct ieee80211_channel *chan,
01510                                    enum nl80211_channel_type channel_type,
01511                                    unsigned int duration, u64 *cookie);
01512 int ieee80211_wk_cancel_remain_on_channel(
01513         struct ieee80211_sub_if_data *sdata, u64 cookie);
01514 
01515 /* channel management */
01516 enum ieee80211_chan_mode {
01517         CHAN_MODE_UNDEFINED,
01518         CHAN_MODE_HOPPING,
01519         CHAN_MODE_FIXED,
01520 };
01521 
01522 enum ieee80211_chan_mode
01523 ieee80211_get_channel_mode(struct ieee80211_local *local,
01524                            struct ieee80211_sub_if_data *ignore);
01525 bool ieee80211_set_channel_type(struct ieee80211_local *local,
01526                                 struct ieee80211_sub_if_data *sdata,
01527                                 enum nl80211_channel_type chantype);
01528 enum nl80211_channel_type
01529 ieee80211_ht_oper_to_channel_type(struct ieee80211_ht_operation *ht_oper);
01530 
01531 #ifdef CONFIG_MAC80211_NOINLINE
01532 #define debug_noinline noinline
01533 #else
01534 #define debug_noinline
01535 #endif
01536 
01537 #endif /* IEEE80211_I_H */


ros_rt_wmp
Author(s): Danilo Tardioli, dantard@unizar.es
autogenerated on Fri Jan 3 2014 12:07:54